首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure DevOps管道级过滤器问题

Azure DevOps管道级过滤器问题
EN

Stack Overflow用户
提问于 2022-07-22 08:45:23
回答 1查看 198关注 0票数 1

上下文:

我有两条管道。我们叫他们triggertrigger-two

Trigger管道有多个阶段,称为TroubleshootingTroubleshooting2Troubleshooting3

我的目标是在trigger-two管道的TroubleshootingTroubleshooting2阶段完成时触发trigger管道。

问题:

我已经跟踪了Microsoft ( https://learn.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-triggers?view=azure-devops ),但是无论我如何实现它,只有在trigger-two管道完全完成时才会触发trigger-two管道。由于未知的原因,没有考虑到阶段滤波器。

trigger-two管道的代码:

代码语言:javascript
复制
trigger: none

resources:
  pipelines:
  - pipeline: triggertest  
    source: triggertest
    project: project_name
    trigger:
      stages:
        - Troubleshooting
        - Troubleshooting2
      branches:
        include:
          - refs/heads/branchtest
EN

回答 1

Stack Overflow用户

发布于 2022-07-22 10:42:34

我试图复制这个问题,但它在我的计划中起作用。请试试我的yaml:

管道trigger

代码语言:javascript
复制
trigger:
- none

pool:
  vmImage: windows-latest

stages:
- stage: Troubleshooting1
  jobs:
  - job: Troubleshooting1
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Write-Host "Hello World"
- stage: Troubleshooting2
  jobs:
  - job: Troubleshooting2
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Write-Host "Hello World"
- stage: Troubleshooting3
  jobs:
  - job: Troubleshooting3
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          # Write your PowerShell commands here.
          Write-Host "Hello World" 
          #in order to add the time for this stage, install a Module 
          Install-Module Az -Scope CurrentUser -Force

管道trigger-two

代码语言:javascript
复制
trigger: none

resources:
  pipelines:
  - pipeline: trigger-resource  
    source: trigger
    project: testproject
    trigger:
      stages:
        - Troubleshooting1
        - Troubleshooting2
      branches:
        include:
          - refs/heads/main

pool: Default # Specify a self hosted agent pool by name. Because I only have one MS-hosted agent parallel job. So I use different pool in two yaml.
#pool:
#  vmImage: windows-latest
steps:
- task: CmdLine@2
  inputs:
    script: |
      echo Write your commands here
      echo Hello world

编辑:

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73077572

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档