In some of my
group steps, I find all sub-steps might have the same or a common set of conditions, and thus it would be useful if the group step itself could have an
if condition attribute, for example:
- group: ~
if: build.branch == pipeline.default_branch
If present, it would be equivalent to each sub-step listing that same condition (or more specifically, an
&& of the group condition with any condition the sub-step itself may have).
if attribute for group step, one may to achieve this is have a step which checks for the branch like
if: build.branch == pipeline.default_branch then upload the pipeline with group steps like a dynamic pipeline.
Please let me know if this helps with your usecase.
Thank you. I’m aware of the dynamic pipeline upload workaround, though I wouldn’t consider it to be more valuable than just having duplicated conditionals. Thus this is a feature request, not really a matter of solution-seeking.
Dynamic pipelines have a few downsides:
- They make pipeline behavior less transparent (in extreme cases you might have 9/10 steps completed, but then you have 10/20 steps completed, and then 11/30).
- They are very difficult to use well with step dependencies, since you can’t have static steps depend on dynamic steps (because they haven’t shown up yet, and thus the dispatcher rejects the pipeline).
- Without care, they can easily make pipelines non-deterministic: uploaded pipelines that inject a wait step may, due to a race, end up with the wait not being respected by steps that were already present in the build.
env of the generating step is not respected in the generated steps. This is plausible, but may be surprising.
- Generating additional steps pays the overhead cost of waiting for agents, which can add up, and when a step does nothing but generate another set of steps, that overhead is effectively paid twice.
As such, while many feature requests are answered with pipeline uploads as the canonical solution, dynamic pipelines leave a bit to be desired, especially when the problem being solved isn’t intrinsically dynamic.
Thanks for your detailed explanation!
Group step is a relatively new functionality, and I believe there’s still some work around it, but unfortunately, there is nothing planned for this year. We’ll take this into consideration when we start planning some work around it.