New endpoint to create a model version from a Docker image tag
Refs https://redmine.teklia.com/issues/4162
We want Arkindex and Ponos agents to support Docker image tags: this means we do not build anything for these worker versions, and simply let a ponos agent pull the image locally.
We will NOT store any docker credentials in the backend for now, as they are only needed on the various ponos agents, and ca already be set through configuration & Ansible deployments.
As we can already use any docker image tag as WorkerVersion.docker_image_iid
, there is nothing to do there. The WorkerRun.build_task
already seem to create a Task
with self.version.docker_image_iid
when it's set, so the serializer of Task should be OK too (you should add a unit test validating this new configuration: no artifact, a docker_image_iid set). The constraint workerversion_available_requires_docker_image
must be removed.
The main work resides in the creation of a new endpoint named CreateDockerWorkerVersion
that will create a new worker version tied to a remote docker image:
- body:
- worker_slug (required)
- repository_url (required)
- revision_hash (required)
- revision_message (optional)
- revision_author (optional)
- revision_references (optional list of type / name to create GitRef)
- configuration (required)
- docker_image_iid (required)
- gpu_usage (optional, default to disabled)
- model_usage (optional, default to False)
The endpoint must get_or_create
the git stack required for a worker version:
- repository (hook_token is generated when creating)
- revision (generate message & author when not mentionned)
- worker (use slug as name when creation, default type to the first one available)
- git references are applied to that revision
Finally, the worker version is create with the last fields, setting its state immediately to Available
.
A new user scope CreateDockerWorkerVersion
must be enabled on the user account that calls this endpoint. No ponos task should be allowed to reach that endpoint.