3

I have the following workflow definition for a CircleCI build

workflows:
  version: 2
  default:
    jobs:
      - verify
      - tests_3_1:
          requires:
            - verify
      - tests_5_0:
          requires:
            - verify
      - pack:
          requires:
            - tests_3_1
            - tests_5_0
      - push:
          requires:
            - pack
          context:
            - GitHub
          filters:
              tags:
                only: /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
              branches:
                ignore: /.*/

The idea is to:

  • run verify, test_3_1, test_5_0, pack on all commits
  • on top of the jobs above, run the job push when on master and with a tag that matches a semver version prepended by a v

For some reason no build is triggered when the commit is tagged. I am not sure if the problem is in the filter or in the regex not matching the build tags.

For now I tried v0.1.0-preview-0001 which matches on RegexPal.

build is not triggered

Could you suggest any improvement? I see there is this question that is pretty similar but I have issues implementing the suggested solution

Kralizek
  • 1,999
  • 1
  • 28
  • 47

1 Answers1

3

I solved this by specifying a tag regex filter for every job before push as shown in the documentation.

workflows:
  version: 2
  default:
    jobs:
      - verify:
          filters:
            tags:
              only: /.*/
      - tests_3_1:
          requires:
            - verify
          filters:
            tags:
              only: /.*/
      - tests_5_0:
          requires:
            - verify
          filters:
            tags:
              only: /.*/
      - pack:
          requires:
            - tests_3_1
            - tests_5_0
          filters:
            tags:
              only: /.*/
      - push:
          requires:
            - pack
          context:
            - GitHub
          filters:
              tags:
                only: /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
              branches:
                ignore: /.*/
Kralizek
  • 1,999
  • 1
  • 28
  • 47