Allow rules to set runner tags (rules: tags:)
Proposal
I ultimately have the same problem as #385676, but the proposed solution of using inputs doesn't seem like it would work in my case because I need to set the runner tags to a constant based on the value of a variable (which could be from an input). Thus, I am proposing adding tags
to rules
in the same way that needs
and variables
are available. An example (my exact use-case):
job:
rules:
- if: '"$[[ inputs.architecture ]]" == "aarch64"'
tags:
- arch:arm64
- size:$[[ inputs.runner_size ]]
- if: '"$[[ inputs.architecture ]]" == "x86_64"'
tags:
- arch:amd64
- size:$[[ inputs.runner_size ]]
Without this, I had to make the runner architecture tag an input to the component. I also tried having my component have two jobs, one for aarch64 and one for x86_64, but this did not end up working because if you were to use the component more than one time, you would end up with jobs that have undefined rules - the first time you use the component, it works, but the second time you use the component, it turns off the other architecture you turned on, and if you include it a third time, this affects both of the others. An option to mitigate this would be to make the name of the pair of jobs be different - e.g., $[[ inputs.architecture ]]-aarch64
, but this repeats the architecture. If you have more than one thing you need to do this way, it really doesn't scale (you need a bunch of jobs in one component which are all mutually exclusive).
I should also add, this would also affect regular CI templates (it's not specific to components).