更改 yaml 中特定工作流程的自定义参数

问题描述 投票:0回答:1

有两个工作流程是根据特定条件触发的,我需要更改自定义参数,以防其中一个工作流程被触发。 我默认创建了自定义参数 isFeatureBranch == FALSE 。我还有两个工作流程(feature_branch 和 nightly)。我需要更改 isFeatureBranch == TRUE 以防 feature_branch 被触发

这是我的 yaml 文件

version: 2.1

orbs:
  gcp-cli: circleci/[email protected]

parameters:
  isFeatureBranch:
    type: boolean
    default: false

jobs:
  run_browserstack:
    docker:
      - image: cypress/base:16.14.2-slim
    steps:
      - checkout
      - run:
          name: Install curl
          command: apt-get update && apt-get install -y curl
workflows:
  feature_branch:
    jobs:
      - run_browserstack:
          context:
            - automation
          filters:
            branches:
              ignore:
                - master
  nightly:
    jobs:
      - run_browserstack:
          context:
            - automation

这是我尝试过的

workflows:
  feature_branch:
    jobs:
      - run_browserstack:
          context:
            - automation
          filters:
            branches:
              ignore:
                - master
    # Change parameter for isFeatureBranch if feature_branch workflow is triggered
    parameters:
      isFeatureBranch:
        type: boolean
        default: true 
  nightly:
    jobs:
      - run_browserstack:
          context:
            - automation
yaml configuration-files circleci
1个回答
0
投票

把它分成两份工作怎么样? 您可以创建一个阶段,并在该阶段中执行另一个作业之后的作业。 喜欢:

-stage: stageName
 displayName: Stage Name
 jobs:
 - ${{ if eq(something, 'something') }} <you may include if conditions before the job if needed>
  - job: firstJob
     <job code>
  - job: secondJob
     <job code>
© www.soinside.com 2019 - 2024. All rights reserved.