Junior — Middle
What key is used to determine the current launch point in GitLab CI/CD?
sobes.tech AI
Answer from AI
In GitLab CI/CD, the current trigger point (current job or pipeline) is determined using the environment variable CI_PIPELINE_SOURCE. This variable indicates what triggered the pipeline, such as push, merge_request, schedule, etc.
Additionally, to identify a specific job, the variable CI_JOB_NAME is used, and for the pipeline — CI_PIPELINE_ID.
An example of usage in .gitlab-ci.yml:
job:
script:
- echo "Pipeline triggered by $CI_PIPELINE_SOURCE"
- echo "Current job: $CI_JOB_NAME"
Thus, the key variable for determining the trigger point is CI_PIPELINE_SOURCE.