Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CircleCI reports "No workflow" when creating a tagged release

Tags:

circleci

I want to build a CircleCI workflow which builds and pushes to ECR only when I create a tagged release in Github.

I have the following CircleCI workflow:

workflows:
  test-build-and-push-image:
    jobs:
      - get_python_dependencies
      - unit_tests:
          requires:
            - get_python_dependencies
      - aws-ecr/build-and-push-image:
          name: build-and-push-to-ecr
          repo: ${CIRCLE_PROJECT_REPONAME}
          tag: ${CIRCLE_SHA1}
          create-repo: true
          requires:
            - unit_tests
          filters:
            tags:
              only: /.*/
            branches:
              ignore: /.*/

As I understand it, the filters on build-and-push-to-ecr are supposed to mean:

  • Run this job for any tag whatsoever
  • Don't run this job when pushing to any branch

But when I create a tagged release I get:

No workflow

Why aren't my filters working?

like image 255
LondonRob Avatar asked Oct 31 '25 00:10

LondonRob


1 Answers

A very close reading of the docs under Executing workflows for a git tag reveals a well-hidden detail:

if a job requires any other jobs (directly or indirectly), you must use regular expressions to specify tag filters for those jobs.

In other words, every job in the workflow must have the same filters for the build and push job to happen.

We can keep things a bit DRYer using & anchors:

workflows:
  test-build-and-push-image:
    jobs:
      - get_python_dependencies:
          filters: &tagged
            # We only want to trigger this workflow on tags, not pushes to branches.
            branches:
              ignore: /.*/
            tags:
              # Trigger on every tag
              only: /.*/
      - unit_tests:
          requires:
            - get_python_dependencies
          <<: *tagged
      - aws-ecr/build-and-push-image:
          name: build-and-push-to-ecr
          repo: ${CIRCLE_PROJECT_REPONAME}
          tag: ${CIRCLE_SHA1}
          create-repo: true
          requires:
            - unit_tests
          <<: *tagged
like image 155
LondonRob Avatar answered Nov 03 '25 00:11

LondonRob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!