I am not sure if changing the the pre-defined environment is feasible but maybe it’s worth looking to changing it in .pre stage with a bash script/command since all the changes in .pre stage are available to every other pipeline.
In fact, I want a feature that let me use modified values of pre-defined environments variables to define jobs parameters without having to “eval” the variables. Because evaluate variables can only occur when job has started (see example in documentation).
That really simplify jobs definition and avoid DRY.
In that case, would you mind sharing your thought?
what your goal is in term of modifying their values?
It would allow us to have a better overview and provide answer that tailor to your need.
Digging this thread out of the past while trying to fix a similar problem. This is now quite easy to achieve since gitlab 13.x thanks to variable inheritance. Note that as declared in the documentation, those vars can only be used in scripts inside a stage and not to control the pipeline itself.
Here is a simple example calculating a docker image name replacing chars in the reference branch. I took advantage of the .pre stage which will run prior to any other
Here is the relevant part of the output of the build job running against the default test project branch
$ echo "We are on branch ${CI_COMMIT_BRANCH}"
We are on branch master
$ echo "We are building ${DOCKER_IMAGE}"
We are building my.private.repo/my_namespace/test:latest