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
UniqueConstraint
to make worker version tags unique per worker. -
Write a data migration that:
- For workers with repositories, sets
repository_url
toWorker.repository.url
, which is doable in one straightforward.update()
; - For worker versions with revisions:
- sets
revision_url
to the same value computed by thecommit_url
Python property, which is also doable in one.update()
usingarkindex.project.tools.RTrimChr
and concatenation; - sets
tag
to the name of the first GitRef with the typeTag
, ordered by descending name.
- sets
- For workers with repositories, sets
-
Add
repository_url
to theWorkerSerializer
as aURLField
, so that it is available inListWorkers
,RetrieveWorker
,CreateWorker
and[Partial]UpdateWorker
. -
Add
revision_url
to theWorkerVersionSerializer
as aURLField
, so that it is readable inListWorkerVersions
,RetrieveWorkerVersion
,ListWorkerRuns
,ListCorpusWorkerRuns
,ListUserWorkerRuns
, andRetrieveWorkerRun
. It must not be editable with[Partial]UpdateWorkerVersion
. -
Add
tag
to theWorkerVersionSerializer
, so that it is available in all the aforementioned endpoints. This one is writable in bothCreateWorkerVersion
and[Partial]UpdateWorkerVersion
, and the unique constraint should be validated. -
Replace
revision_id
in theWorkerVersionCreateSerializer
withrevision_url
, to changeCreateWorkerVersion
.-
When authenticated with Ponos task authentication, the
revision_url
is required. -
When the worker has a
repository_url
set, therevision_url
is 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_id
set 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.