Simplified AuTA assignment management
Description
There should be a simplified interface where the user can simply enter a Docker image URL instead of a script URL, after which Submit performs the necessary AuTA configuration.
Checklist
-
Add a way for users to enter a Docker image URL -
Have Submit authenticate with a (preferably) instructor-level account -
When creating a new script in Submit, POST the following template filled-in to AuTA's /api/v1/assignment
endpoint:{ "name": "${ASSIGNMENT_NAME}", "options": { "static": [ { "metric": "TESTS", "passingScript": "(() => message => { fail(message); })();", "passingScriptTestCases": [], "formattingScript": "", "maxWarnings": 0, "maxFailures": 0 }, { "metric": "DOCKER_LOGS", "passingScript": "(() => (results, templateResults) => { info(ADMINISTRATIVE, results); })();", "passingScriptTestCases": [], "formattingScript": "", "maxWarnings": 0, "maxFailures": 0, "dockerfile": "FROM ${DOCKER_IMAGE}\n" } ], "language": "c" }, "languages": ["c"], "dockerAuthConfigurations": [ { "registry": "${DOCKER_REGISTRY}", "username": "${DOCKER_REGISTRY_USERNAME}", "password": "${DOCKER_REGISTRY_PASSWORD}" } ] }
These fields will need to be filled in:
Field Description ${ASSIGNMENT_NAME}
Name of the assignment in AuTA, must be unique. It's best to generate a human-legible name for troubleshooting ${DOCKER_IMAGE}
URL to the Docker image (without any scheme). This must be sanitized and validated, as it will otherwise be possible to inject additional rules into the Dockerfile These are only necessary if the Docker image is not public:
Field Description ${DOCKER_REGISTRY}
Host of the Docker image URL ${DOCKER_REGISTRY_USERNAME}
Username to authenticate with ${DOCKER_REGISTRY_PASSWORD}
Password to authenticate with If no authentication is necessary, the
dockerAuthConfigurations
array can be left empty.When using the GitLab container registry, a project access token with the
read_api
scope can be created. The username is the GitLab username of the user who created the token and the password is the token itself.AuTA will return the following response (edited for brevity):
HTTP/1.1 201 Created Location: /api/v1/assignment/<aid> { "id": "<aid>", "errors": [] }
-
Updates can PUT the same document to /api/v1/assignment/<aid>
. A successful update will returnHTTP/1.1 200 OK { "id": "<aid>", "errors": [] }
-
Optionally, authenticate again to get a fresh access token -
Generate the Script API URL as documented here
Reasoning
The current method of configuring Submit to check assignments with a Docker image is painful. At a minimum, one needs to:
- log in to AuTA
- create an assignment
- select any language other than the default
- add the "Docker Logs" metric
- enter the image URI in the Dockerfile
- enter registry credentials if necessary
- add the "Tests" metric
- extract the assignment ID
- extract the user's authentication token
- and NOT log out at any point
- construct the right URL and enter it in Submit
This is a lot of work and many things can go wrong, some of which are difficult to diagnose.
Eventually Submit should absorb the relevant AuTA functionality, but until then this method should be sufficient to reduce the number of configuration issues.