Support depending on `needs:parallel:matrix` variants
Problem to solve
Jobs with parallel:matrix variants can not depend on jobs with corresponding variants, instead they can only depend on jobs as bundle. This makes a sub variant of a job with parallel:matrix to depend on all the jobs instead of depending on the corresponding parallel:matrix variant.
Proposal
See the build job below that builds multiple variants in parallel jobs:
build-firmware:
stage: build
script: |
echo "Building ${BOARD}_${BUILD_TYPE}"
artifacts:
paths:
- firmware_${BOARD}_${BUILD_TYPE}.bin
parallel:
matrix:
- BOARD: [board1, board2]
BUILD_TYPE: [debug, release]
This creates 4 jobs as
build-firmware:board1_debugbuild-firmware:board1_releasebuild-firmware:board2_debugbuild-firmware:board2_release
If we have a new job release-firmware that we intend to use the same parallel matrix variants and want them to depend on only the correspond build job, we can't do this. Instead all the release jobs will depend on all the variants of build jobs.
I suggest that we should be able to make them depend on jobs with corresponding matrix variants. So that release-firmware:board1_debug should depend on build-firmware:board1_debug instead of depending on all build-firmware jobs to be able to run.
See the needs:job section below that is currently rejected:
release-firmware:
stage: release
needs:
- job: build-firmware:${BOARD}:${BOOT_TYPE}:${BUILD_TYPE}
script: |
echo "Releasing firmware for ${BOARD} ${BOOT_TYPE} ${BUILD_TYPE}"
parallel:
matrix:
- BOARD: [board1, board2]
BUILD_TYPE: [debug, release]