Allow tag filtering at workflow level
under review
J
Jaryt Bustard
Currently, to allow a job to run for a workflow, the user must define a tag filter for each job.
With the release of conditional logic, it becomes possible to only compile a workflow with the << pipeline.git.tag >> parameter. However, a workflow will be created with no jobs if the filters are not present.
Two potential options would be to allow a workflow level tag filter parameter, or a boolean to run all jobs on tags.
Nathan Fish
under review
Re-opening for review. We can make the use of tags easier. As mentioned there are a couple of options, it does feel like a workflow level tag filter would a preferred option.
Salil Subbakrishna
complete
This should be possible using a "when". We've introduced the "matches" operator which should help you do a regex match to the tag pipeline parameter.
J
Jaryt Bustard
Salil Subbakrishna:
Hi Salil,
The when parameter helps this, however, you will still be required to use the filter: tags: only: one each job in the workflow to let them run. If you only use the "when" attribute, and do not include the filters, you will receive an empty/no workflow pipeline.
What I'm saying in the feature request is to allow for this to be possible without including a filter for every job in the workflow.
Salil Subbakrishna
Jaryt Bustard: If you use the workflow level "when" (https://circleci.com/docs/2.0/configuration-reference/#using-when-in-workflows), you can filter out entire workflows based on a conditional without having to add anything at each individual job level. You can compare against the tag pipeline variable using "equals" or "matches" (https://circleci.com/docs/2.0/configuration-reference/#logic-statements) depending on whether you want an exact or regex match. This will remove the workflow entirely without leaving an "empty" workflow.
J
Jeff Lee
Salil Subbakrishna: I think Jayrt is correct here. In my own testing, it still seems that despite the presence of a workflow-level
when
expression that uses tags, you _still_ need to add job-level filters that enable the jobs for tag creation. The compromise solution I've come up with is to use the workflow-level tag filter, but also mix the following anchor into each job in the workflow: filter-enable-tag-trigger: &filter-enable-tag-trigger
filters:
tags:
only: /.*/
I'll send links to my test workflows via my support ticket with Jayrt.
Salil Subbakrishna
Jeff Lee: It shouldn't work that way so if that's the behavior you're seeing, we can take a look. Any sample config will be helpful.
J
Jeff Lee
Salil Subbakrishna: Here's a gist. https://gist.github.com/jeffomatic/0c5fb761627f2e5636229b0d8da5a9ab
You can see some sample pipelines in the support ticket I've opened with Jaryt. Thanks!