Gitlab's cross-project-pipeline allows me to specify a branch to run a pipeline for. I didn't find any such option to do the same with a tag?
Since my cross-project-pipeline is also being run deliberately, is it also possible to run all manual jobs in a downstream pipeline?
This should be possible with Triggering pipelines through the API.
You just need to add the following to your CI script:
- curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.example.com/api/v4/projects/<project-id>/trigger/pipeline
and update the ref
to be the tag you require, and <project-id>
with the project you are triggering.
In terms of the cross-project pipeline being run deliberately and having manual jobs you want to run when being triggered, you'd probably need to re-write the downstream CI file to allow for that, eg:
Upstream CI file:
build:
stage: build
script:
- echo "Do some building..."
# Trigger downstream project (tag v1.0.0), with a random variable
- curl --request POST --form "token=$CI_JOB_TOKEN" \
--form "variables[RANDOM_VARIABLE]=FOO" \
--form ref=v1.0.0 https://gitlab.com/api/v4/projects/<project_id>/trigger/pipeline
Downstream CI file:
.test:template:
stage: test
script:
- echo "Running some test"
test:manual:
extends:
- .test:template
when: manual
except:
- triggers
test:triggered:
extends:
- .test:template
only:
- triggers
So when a triggered job is run, the test:triggered
should be the only test
job you see in the pipeline.
See only/except documents for more information.