Is sharing jobs between workflows ok?

This is part of my config related to the problem:

version: 2.0

# ...
# jobs definitions
# ...

workflows:
  version: 2
  build_test:
    jobs:
      - check:
          filters: {tags: {ignore: "/.*/"}}

      - build_dev_debug:
          requires: [check]

      - build_prod_release:
          requires: [check, build_dev_debug]
          filters: {branches: {only: develop}}

      - approve_version_patch_bump:
          type: approval
          requires: [build_prod_release]
          filters: {branches: {only: develop}}

      - approve_version_minor_bump:
          type: approval
          requires: [build_prod_release]
          filters: {branches: {only: develop}}

      - approve_version_major_bump:
          type: approval
          requires: [build_prod_release]
          filters: {branches: {only: develop}}

      - bump_version_patch:
          requires: [approve_version_patch_bump]

      - bump_version_minor:
          requires: [approve_version_minor_bump]

      - bump_version_major:
          requires: [approve_version_major_bump]

  deploy:
    jobs:
      - check:
          filters: {branches: {ignore: "/.*/"}, tags: {only: "/^v[0-9]+\\.[0-9]+\\.[0-9]+$/"}}

      - build_dev_debug:
          requires: [check]


      - build_prod_release:
          requires: [check, build_dev_debug]

There are two workflows: ‘build_test’ and ‘deploy’.
The overall procedure is:

  1. When merge (or new commit) comes to develop, start ‘build_test’.
  2. In ‘build_test’ optionally I can unhold bump version job.
  3. When the tag is added (pushed to develop) trigger ‘deploy’ workflow.

The problem I have is that in the workflow ‘deploy’ only first job (‘check’) is run. And I don’t know the reason why. Is the sharing of jobs between workflows correct practice? Or am I doing something else wrong?

(There is also one more issue with this config: ‘build_test’ doesn’t filter out tags effectively, and once a tag is pushed, both ‘build_test’ and ‘deploy’ start, not only ‘deploy’ as I wanted. )

Any suggestions very welcomed.

Hi @rynkowsg, welcome to the CircleCI Community! In our 2.1 configuration you can use jobs multiple times in your workflows section. You can read more here: CircleCI 2.1 Config Overview under the “Jobs” section.

Please note our 2.1 Configurations require you have pipelines enabled, which can be turned on in your Advanced Settings.

Can you try changing version: 2.0 to version: 2.1 at the top of your configuration, turn on pipelines and run a fresh build? Please let us know if this works for you.