circleci:忽略手动批准步骤

circleci: manual approval step ignored

我定义了以下两个工作流程:

workflows:
  version: 2
  deploy-msp-navigator-production:
    jobs:
      - build-job:
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+$/
            branches:
              ignore: /.*/
          context: msp-navigator
      - approve:
          type: approval
          requires:
            - build-job
      - deploy-job:
          requires:
            - approve
          context: msp-navigator
      - deploy-functions:
          requires:
            - approve
          context: msp-navigator
  deploy-msp-navigator-dev:
    jobs:
      - build-job:
          filters:
            branches:
              only:
                - master
          context: msp-navigator-dev
      - deploy-job:
          requires:
            - build-job
          context: msp-navigator-dev
      - deploy-functions:
          requires:
            - build-job
          context: msp-navigator-dev

msp-navigator-dev 一个(没有批准步骤)工作正常:

但是生产版没有。它只是在 build-job:

之后停止

我觉得我在这里漏掉了一些非常愚蠢的东西,但我就是没有看到它。

我联系了 CircleCI 支持并得到以下答复:

The build was triggered by a "tag push". By default, CircleCI will build for all branches but for no tags.

The build-job in the deploy-msp-navigator-production workflow is executed because a tag filter was specified and the tag you pushed matches the regular expression in the filter.

However when the execution reaches the approve job, as no tag filter is specified the job is skipped.

To modify this behaviour you'll need to add the tag filter to both approve (and subsequent) jobs

所以它适用于以下设置:

workflows:
  version: 2
  deploy-msp-navigator-production:
    jobs:
      - build-job:
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+$/
            branches:
              ignore: /.*/
          context: msp-navigator
      - approve:
          type: approval
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+$/
          requires:
            - build-job
      - deploy-job:
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+$/
          requires:
            - approve
          context: msp-navigator
      - deploy-functions:
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+$/
          requires:
            - approve
          context: msp-navigator
  deploy-msp-navigator-dev:
    jobs:
      - build-job:
          filters:
            branches:
              only:
                - master
          context: msp-navigator-dev
      - deploy-job:
          requires:
            - build-job
          context: msp-navigator-dev
      - deploy-functions:
          requires:
            - build-job
          context: msp-navigator-dev