can we use dynamic jobs names in gitlab-ci.yml?
As of gitlab 12.9, this can be done using trigger
and child pipelines — although a little involved:
Quoting the example from the gitlab doc:
generate-config:
stage: build
script: generate-ci-config > generated-config.yml
artifacts:
paths:
- generated-config.yml
child-pipeline:
stage: test
trigger:
include:
- artifact: generated-config.yml
job: generate-config
In your case, you would put the definition of job_%myParam%
in job.yml.in
, then have the script generate-ci-config
be e.g. sed "s/%myParam%/$PARAM/g" job.yml.in
.
This is probably a bit much for just changing the names of course, and there will be a cost associated to the additional stage; but it does answer the question, and may be useful to do more, like start with different versions of the parameter in the same pipeline.
No, it is not possible to have dynamic job names in GitLab CI.