Hello, I’m trying to run a job only for specific tags ( and that’s working ) but only after other jobs are completed.
workflows:
analyze_test_publish:
jobs:
- analyze
- test
- testTag:
requires:
- analyze
- test
filters:
# ignore any commit on any branch by default
branches:
ignore: /.*/
# only act on version tags
tags:
only: /^[0-9](\.[0-9]+)+(\-\w+\-[0-9]+){0,1}$/
With this configuration I got
While if I remove the requires block it run as expected, but the testTag runs together with other jobs.
Tags are not built by default, so the analyze and test jobs are not run, meaning the testTag job’s dependencies are never met. You have to add a filter to explicitly allow tags to build. Something like this should work:
workflows:
analyze_test_publish:
jobs:
- analyze:
filters:
# also act on version tags
tags:
only: /^[0-9](\.[0-9]+)+(\-\w+\-[0-9]+){0,1}$/
- test:
filters:
# also act on version tags
tags:
only: /^[0-9](\.[0-9]+)+(\-\w+\-[0-9]+){0,1}$/
- testTag:
requires:
- analyze
- test
filters:
# ignore any commit on any branch by default
branches:
ignore: /.*/
# only act on version tags
tags:
only: /^[0-9](\.[0-9]+)+(\-\w+\-[0-9]+){0,1}$/
That’s a fair bit of duplication, but you can use YAML anchors to reduce that a bit:
workflows:
analyze_test_publish:
jobs:
- analyze:
filters: &tag-version-filter
# also act on version tags
tags:
only: /^[0-9](\.[0-9]+)+(\-\w+\-[0-9]+){0,1}$/
- test:
filters:
<<: *tag-version-filter
- testTag:
requires:
- analyze
- test
filters:
<<: *tag-version-filter
# ignore any commit on any branch by default
branches:
ignore: /.*/