Variable expressions in only/except sections in gitlab-ci.yml
The only and except parameters in .gitlab-ci.yml are very useful for limiting runs. I have a system where each build is an arbitrary subset of the possible large superset of builds (these are recipes to build other software - I only want to build any recipes in my repository that have changed). I can submit individual builds and use an environment variable to carry out the selected build. However, I can't limit the tags/platforms that it runs on. I am left with something of a hack: run all jobs for all platforms all of the time, but terminate non-matching platforms early based on the trigger variables. This still costs me machine spin-up time. If I bundle all platforms into one build, then the dependency build-out is unnecessarily constrained by waiting for all of the platforms to finish a given dependency - even if they don't use it.
I would like to propose that environment variable expressions be usable in the only/except parameter, so that they can be used to limit which jobs actually run on triggered builds.
some_job: only: - $TARGET_PLATFORM == some_hardcoded_tag
or, even cooler, relate to tags (check for membership?):
some_job: only_in_tags: - $TARGET_PLATFORM
Alternatively, allowing trigger variables in the tags would be a good alternate to the functionality I'd like.
some_job: tags: - $TARGET_PLATFORM