Docker Image Matrix
Problem to solve
Supporting M versions of a dependency by running N CI jobs requires M * N jobs in the CI yaml file.
Further details
Software libraries often support multiple versions of their primary dependency (like the programming language) by running their CI suite on docker images that provide the specific versions of the dependency. YAML has reusable "anchor" blocks, but it only reduces the repeated code and still requires M * N jobs to be written and maintained.
Proposal
Overload the image
rule to allow a set of images. Run jobs on each image in the set. Add a namespace to the generated jobs to communicate the image version.
Add a matrix
entry that can be set globally or per job. Allow it to have an image
entry. Require the matrix.image
to be a hash of namespaces to image entries.
What does success look like, and how can we measure that?
Supporting M versions of a dependency by running N CI jobs should only require N jobs in the CI yaml file.
matrix:
image:
python3.6: python:3.6-alpine
python3.7: python:3.7-alpine
lint:
script: flake8
test:
script: pytest
pages:
matrix: {}
image: python:alpine
script: sphinx-build docs public
...
would generate:
lint:python3.6
lint:python3.7
test:python3.6
test:python3.7
pages
Links / references
- Similar to #19199 (moved) with a much narrower scope