Convert Docker configuration to database fields on WorkerVersion

Erwan Rouchet
2025-11-28T10:03:37Z

https://redmine.teklia.com/issues/12459

The existing WorkerVersion.docker_command and .docker_shm_size properties on should be replaced with two nullable CharField defaulting to None.

The docker_shm_size field should include a regex validator to ensure that it is a Docker byte value or just an integer.

A data migration should fill those fields for existing WorkerVersions:

1. Fill docker_command from configuration["docker"]["command"], and delete "command" from "docker".

2. Fill docker_shm_size from configuration["docker"]["shm_size"], and delete "shm_size" from "docker", but only if it validates against the regex.

3. Delete configuration["docker"] entirely, but only if it is empty. If any unknown attributes are left, then leave them there so we can complain about this later when migrating other configuration attributes.

Any endpoint that outputs a docker_image_iid from the WorkerVersion should now also output docker_command and docker_shm_size. Those fields are always read-only.

CreateWorkerVersion should be updated to set docker_command and docker_shm_size and discard those from the configuration, just like the data migration.

ImportWorkerVersion should set the docker_command and docker_shm_size and leave configuration entirely empty, since it was only putting those attributes into configuration and nothing else.