Expose trigger short token to CI
-
Please check this box if this contribution uses AI-generated content as outlined in the GitLab DCO & CLA
What does this MR do and why?
This MR adds the CI_TRIGGER_SHORT_TOKEN
variable to the CI as requested in #429449 (closed). This is needed to be able to check if a pipeline was triggered via a trigger token and to check which trigger token was used in a pipeline.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Setup a runner for the dev instance
- Create a pipeline in a project. Example:
stages:
- test
test-job:
stage: test
script:
- echo "$CI_JOB_NAME"
- echo "$CI_TRIGGER_SHORT_TOKEN"
- Create a trigger token by navigating to
Settings -> CI/CD -> Pipeline trigger tokens
- Create a pipeline by sending a POST request to
https://<instance url>/api/v4/projects/<project_id>/ref/<ref_name>/trigger/pipeline?token=<token>
- Verify that
CI_TRIGGER_SHORT_TOKEN
has a value in the job output
Edited by 🤖 GitLab Bot 🤖