Trouble with tag build workflow setup


#1

I am having trouble working with the new workflow feature for tagged builds. I am looking for a simple setup that will build any branch push and a tag push where the tag starts with “v” (I have an ideal regex for the tag format, but keeping it simple for now).

All the combinations I have tried I result in 2 outcomes:

  1. both workflow jobs fire for a tag or branch build, or
  2. no workflow jobs fire for a tag or branch build

Here is a copy of my config.yml:

version: 2
jobs:
  build:
    docker:
      - image: codebuilder:latest
    working_directory: /src
    steps:
      - checkout
      - run: build.sh
      - run: test.sh
      - setup_remote_docker
      - run: deployment.sh

workflows:
  version: 2
  un-tagged-build:
    jobs:
      - build:
          filters:
            tags:
              none: /v.*/
  tagged-build:
    jobs:
      - build:
          filters:
            tags:
              only: /v.*/

Any help or ideas would be appreciated,
Thanks!

p.s. Future feature: Having some view into git pushes triggering (or not triggering) a build would be very useful here. No feedback does make it hard to troubleshoot.


#2

Here is a working configuration if you need triggered builds for any branch push and also want tag pushes to trigger as well.

version: 2
jobs:
  build:
docker:
  - image: codebuilder:latest
working_directory: /src
steps:
  - checkout
  - run: build.sh
  - run: test.sh
  - setup_remote_docker
  - run: deployment.sh

workflows:
  version: 2
  un-tagged-build:
    jobs:
      - build:
          filters:
            tags:
              ignore: /^.*/
  tagged-build:
    jobs:
      - build:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /v.*/

#3

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