DevOps构建管道 - 通过PR触发特定阶段

发布于 2025-01-24 07:43:45 字数 1505 浏览 0 评论 0原文

Azure Devops,Yaml管道,通过PR触发特定阶段。

是否可以通过不同的PRS完成触发特定阶段(不是通过创建构建或PR,然后触发另一个构建管道)? 下面的示例,如果我更新we.json并将PR合并到我的Azure存储库中,我希望PR触发我的管道,尤其是阶段Deploy> Deployand-We-We,以及<强>不触发 deploy-ne

trigger:
  branches: 
    include: 
    - main
  paths:
    include: 
    - arm/we.json
    - arm/ne.json

pool:
  vmImage: ubuntu-latest

stages:
- stage: we
  condition: xxx
  jobs:
  - job: Deploy-we
    steps:
    - task: AzureResourceManagerTemplateDeployment@3
      inputs:
        deploymentScope: 'Resource Group'
        azureResourceManagerConnection: 'xxx'
        subscriptionId: 'xxx'
        action: 'Create Or Update Resource Group'
        resourceGroupName: 'xxx-we-rg'
        location: 'West Europe'
        templateLocation: 'Linked artifact'
        csmFile: 'arm/we.json'
        csmParametersFile: 'we-param.json'
        deploymentMode: 'Incremental'

- stage: ne
  condition: xxx
  jobs:
  - job: Deploy-ne
    steps:
    - task: AzureResourceManagerTemplateDeployment@3
      inputs:
        deploymentScope: 'Resource Group'
        azureResourceManagerConnection: 'xxx'
        subscriptionId: 'xxx'
        action: 'Create Or Update Resource Group'
        resourceGroupName: 'xxx-ne-rg'
        location: 'North Europe'
        templateLocation: 'Linked artifact'
        csmFile: 'arm/ne.json'
        csmParametersFile: 'ne-param.json'
        deploymentMode: 'Incremental'

请注意,这不是如何触发“释放管道”的问题。

Azure Devops, yaml pipeline, trigger particular stage by PR.

Is it possible to trigger a particular stage by different PRs completion (not by creating a build or PR and then trigger another build pipeline)?
Example below, if I update we.json and merge a PR to my Azure repository, I want PR to trigger my pipeline and particularly the stage Deploy-we only, and not trigger Deploy-ne.

trigger:
  branches: 
    include: 
    - main
  paths:
    include: 
    - arm/we.json
    - arm/ne.json

pool:
  vmImage: ubuntu-latest

stages:
- stage: we
  condition: xxx
  jobs:
  - job: Deploy-we
    steps:
    - task: AzureResourceManagerTemplateDeployment@3
      inputs:
        deploymentScope: 'Resource Group'
        azureResourceManagerConnection: 'xxx'
        subscriptionId: 'xxx'
        action: 'Create Or Update Resource Group'
        resourceGroupName: 'xxx-we-rg'
        location: 'West Europe'
        templateLocation: 'Linked artifact'
        csmFile: 'arm/we.json'
        csmParametersFile: 'we-param.json'
        deploymentMode: 'Incremental'

- stage: ne
  condition: xxx
  jobs:
  - job: Deploy-ne
    steps:
    - task: AzureResourceManagerTemplateDeployment@3
      inputs:
        deploymentScope: 'Resource Group'
        azureResourceManagerConnection: 'xxx'
        subscriptionId: 'xxx'
        action: 'Create Or Update Resource Group'
        resourceGroupName: 'xxx-ne-rg'
        location: 'North Europe'
        templateLocation: 'Linked artifact'
        csmFile: 'arm/ne.json'
        csmParametersFile: 'ne-param.json'
        deploymentMode: 'Incremental'

Note, this is not a question how to trigger a 'release pipeline'.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文