Custom job images
STATUS Sketchy: Author brainstormed ideas and recorded them - read with caution
Why custom job images
...
Suggested guidelines
- 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.
- 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.
- Dockerfile...
- job image version...
- how to build in an MR...
Proposed conventions
- Directory structure:
images/
at the root of the library, with a subfolder for each image Dockerfile
andREADME.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 todocker/build-job.gitlab-ci.yml
withinputs:
.- In the main
.gitlab-ci.yml
for the library, aninclude:
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
- extend custom-job-image-registry base
- 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