Dynamic continue config doesn't work with a tag filter

# config.yml
version: 2.1
setup: true

orbs:
  path-filtering: circleci/path-filtering@0.1.2

workflows:
  generate-config:
    jobs:
    - path-filtering/filter:
        mapping: |
          api/.* deploy-api true
# continue_config.yml
version: 2.1

parameters:
  deploy-api:
    default: false
    type: boolean

workflows:
  deploy-api:
    when: << pipeline.parameters.deploy-api >>
    jobs:
      - deploy-api-job:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^my-tag.*/


A commit that changes api/.* and is tagged with my-tag-1 will not run the workflow. The deploy-api param will be set to true, but the continue workflow is not run. The tag shows up in the UI with a “No workflow” label. A branch filter does work however. Is this a bug with tag filtering?

1 Like

Hi @dseravalli , how is it going!. Have you tried to put the filters in the path-filtering/filter job like this

workflows:
  generate-config:
    jobs:
    - path-filtering/filter:
        mapping: |
          api/.* deploy-api true
        filters:
          branches:
            only:
              - /.*/
          tags:
            only:
              - /.*

Hi, thanks for the reply. That would prevent the filter job from running on untagged commits which is not what we want.

Hi @dseravalli,

By default, CircleCI will build for any branch but won’t build for any tag. So @efperez 's suggestion is actually correct (I suspect you misread the branches filter in that suggestion; it states only as opposed to ignore).

However, that branches filter is redundant with CircleCI’s default behaviour, so it is not needed for untagged commits to be built.

You would simply need:

workflows:
  generate-config:
    jobs:
    - path-filtering/filter:
        mapping: |
          api/.* deploy-api true
        filters:
          tags:
            only:
              - /.*
1 Like

I understand now. Thanks!

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.