简体   繁体   English

Azure DevOps 管道阶段

[英]Azure DevOps pipelines stages

I got a setup where I want to trigger the CI to build on each pull request to our Bitbucket Cloud repository.我有一个设置,我想触发 CI 以构建对我们 Bitbucket Cloud 存储库的每个拉取请求。 In the same setup I also have three different stages that's I would like to trigger manually when we would like to build the artefact to deploy to our environments.在相同的设置中,我还有三个不同的阶段,当我们想要构建工件以部署到我们的环境时,我想手动触发这些阶段。

The problem I got is that the pull request trigger doesn't trigger after I added stages in our build.我遇到的问题是,在我们的构建中添加阶段后,拉取请求触发器不会触发。 This is how the configuration looks like:这是配置的样子:

pr:
  branches:
    include:
    - '*'

pool:
  vmImage: 'macos-latest'

stages:
- stage: CI
  displayName: 'Continues build'
  jobs:
  - job: C1
    steps:
      - template: azure-pipelines-ios.yml
        parameters:
          environment: 'ci'
      - task: PublishBuildArtifacts@1
        
- stage: Test
  displayName: 'Building for Test'
  jobs:
  - job: T1
    steps:
      - template: azure-pipelines-ios.yml
        parameters:
          environment: 'test'
      - task: PublishBuildArtifacts@1

- stage: Stage
  displayName: 'Building for Stage'
  jobs:
  - job: S1
    steps:
      - template: azure-pipelines-ios.yml
        parameters:
          environment: 'stage'
      - task: PublishBuildArtifacts@1

I would like to trigger the CI stage build on each pull request.我想在每个拉取请求上触发 CI 阶段构建。 How do I do that?我怎么做?

If you want to skip other stages for you should use condition:如果你想跳过其他阶段,你应该使用条件:

pr:
  branches:
    include:
    - '*'

pool:
  vmImage: 'macos-latest'

stages:
- stage: CI
  displayName: 'Continues build'
  condition: eq(variables['Build.Reason'], 'PullRequest')
  jobs:
  - job: C1
    steps:
      - script: echo "Hello $(System.StageName)"
        
- stage: Test
  displayName: 'Building for Test'
  condition: ne(variables['Build.Reason'], 'PullRequest')
  jobs:
  - job: T1
    steps:
      - script: echo "Hello $(System.StageName)"

- stage: Stage
  displayName: 'Building for Stage'
  condition: ne(variables['Build.Reason'], 'PullRequest')
  jobs:
  - job: S1
    steps:
      - script: echo "Hello $(System.StageName)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM