Add simplified Git fields on workers and worker versions
https://redmine.teklia.com/issues/5720
Closes #1500 (closed) by removing revision_id from CreateWorkerVersion.
-
Add three fields:
-
Worker.repository_url, a nullable CharField that will take the URL of the worker'sRepository. -
WorkerVersion.revision_url, a nullable CharField that will be the URL of the commit for this version. -
WorkerVersion.tag, a nullable CharField obeying the same semantics asModelVersion.tag.
-
-
Add a
UniqueConstraintto make worker version tags unique per worker. -
Write a data migration that:
- For workers with repositories, sets
repository_urltoWorker.repository.url, which is doable in one straightforward.update(); - For worker versions with revisions:
- sets
revision_urlto the same value computed by thecommit_urlPython property, which is also doable in one.update()usingarkindex.project.tools.RTrimChrand concatenation; - sets
tagto the name of the first GitRef with the typeTag, ordered by descending name.
- sets
- For workers with repositories, sets
-
Add
repository_urlto theWorkerSerializeras aURLField, so that it is available inListWorkers,RetrieveWorker,CreateWorkerand[Partial]UpdateWorker. -
Add
revision_urlto theWorkerVersionSerializeras aURLField, so that it is readable inListWorkerVersions,RetrieveWorkerVersion,ListWorkerRuns,ListCorpusWorkerRuns,ListUserWorkerRuns, andRetrieveWorkerRun. It must not be editable with[Partial]UpdateWorkerVersion. -
Add
tagto theWorkerVersionSerializer, so that it is available in all the aforementioned endpoints. This one is writable in bothCreateWorkerVersionand[Partial]UpdateWorkerVersion, and the unique constraint should be validated. -
Replace
revision_idin theWorkerVersionCreateSerializerwithrevision_url, to changeCreateWorkerVersion.-
When authenticated with Ponos task authentication, the
revision_urlis required. -
When the worker has a
repository_urlset, therevision_urlis required.This requirement is intentionally not enforced in
[Partial]UpdateWorker. There could be cases where a worker first does not have a repo, then gets one, so there would be versions with and without revisions. But when a worker has a repo, we do require revisions. -
Whether or not the worker has a
repository_idset does not affect the endpoint anymore. -
These constraints should be documented in the API.
-
-
Update
WorkerRun.build_summary:- When there is a tag and a revision, use
@ {tag} ({truncated_id}). - When there is a tag and no revision, use
@ {tag} (version {version}). - When there is no tag, use the current displays of
@ {truncated_id}or@ version {version}.
- When there is a tag and a revision, use
-
Verify your API changes using the schema diff tool.