Hi community,
I find the documentation of Gitlab CI a bit vague on the topic of env variable’s lifecycle.
Scenario:
Pipeline 1 runs: stage A -> stage B -> if you tag, stage C (say we’ve tagged with v 1.1.1)-> deploy to manual testing env -> stage, deploy to production
Requirement:
The “deploy-to-production” stage needs to be able to read the exact same tag as seen by stage C.
Manual testing can take long, and in that time period a second pipeline - pipeline 2 - runs, all the way to stage C, triggered by another tagging. Hence, now CI_COMMIT_TAG = 1.1.2.
At that stage we decide to execute the jobs in the deploy-to-production stage in pipeline 1. Reminder, it needs to see the tag it was triggered by - 1.1.1.
Questions:
Is that guaranteed by Gitlab CI or newer events globally overwrite such default variables, hence pipeline 1 would see the tag that triggered pipeline 2?
Would be nice if the answer to that question is more explicitly state on the official documentation.
Excuse me if it is my bad that I have not understood but I read a few times the env vars’ page and could not assemble a precise answer.
Kind regards,
Me