Custom job images

STATUS Sketchy: Author brainstormed ideas and recorded them - read with caution

Why custom job images

...

Suggested guidelines

  1. Keep the source code (Dockerfile) for custom job images in the CICD library project to manage all the configuration related to one operation in the same place.
  2. Publish custom job images to the GitLab container registry -- even if the company has a policy of storing all container images in an external platform, it's MUCH simpler to keep custom job images -- which are both created and consumed by GitLab -- in GitLab itself.
  3. Dockerfile...
  4. job image version...
  5. how to build in an MR...

Proposed conventions

  • Directory structure: images/ at the root of the library, with a subfolder for each image
  • Dockerfile and README.md (minimum) in each image folder, along with other files required
  • .gitlab-ci.yml fiel within each image directory with instructions for building that image -- typically a reference to docker/build-job.gitlab-ci.yml with inputs:.
  • In the main .gitlab-ci.yml for the library, an include: entry for each image to be built.

See the MDBook image in the base library for a simple example, or Maven for one that includes other files.

Using a custom job image

  1. extend custom-job-image-registry base
  2. Understand the JOB IMAGE variables

Author notes

  • Better approach to versioning of custom images
  • Workarounds for no variables in MR pipelines?
  • Here explain the logic in root CI config and in the build job