Azure DevOps管道-管道之间的控制触发器

apeeds0o  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(104)

我有一个关于多管道触发问题的问题。
具体来说:比如我有管道A和管道B

  • 管道A:在午夜有一个cron调度程序
  • 流水线B:当A完成时由A触发

当我们希望它们按顺序运行时,此工作流是可以的,但在白天,我们可能需要手动执行管道A,因此会触发管道B的意外执行。
我想知道是否有任何解决方案来确定管道A是如何触发的。例如,如果A由调度程序触发,则继续B,但如果A是手动启动的,则不继续B。
当前解决方案:因此,目前我已经设置了多个管道,分别用于自动运行和手动运行,但它可能会变得混乱。

zazmityj

zazmityj1#

这是不可能通过管道资源定义来配置的

pipelines:
- pipeline: string # Required as first property. ID of the pipeline resource.
  project: string # Project for the source; defaults to current project.
  source: string # Name of the pipeline that produces the artifact.
  version: string # The pipeline run number to pick the artifact, defaults to latest pipeline successful across all stages; used only for manual or scheduled triggers.
  branch: string # Branch to pick the artifact. Optional; defaults to all branches, used only for manual or scheduled triggers.
  tags: [ string ] # List of tags required on the pipeline to pickup default artifacts. Optional; used only for manual or scheduled triggers.
  trigger:  # Specify none to disable, true to include all branches, or use the full syntax as described in the following examples.
    enabled: boolean # Whether the trigger is enabled; defaults to true.
    branches: branches # Branches to include or exclude for triggering a run.
    stages: [ string ] # List of stages that when matched will trigger the pipeline.
    tags: [ string ] # List of tags that when matched will trigger the pipeline.

字符串
并且在管道资源元数据中也不可用

resources.pipeline.<Alias>.projectName
resources.pipeline.<Alias>.projectID
resources.pipeline.<Alias>.pipelineName
resources.pipeline.<Alias>.pipelineID
resources.pipeline.<Alias>.runName
resources.pipeline.<Alias>.runID
resources.pipeline.<Alias>.runURI
resources.pipeline.<Alias>.sourceBranch
resources.pipeline.<Alias>.sourceCommit
resources.pipeline.<Alias>.sourceProvider
resources.pipeline.<Alias>.requestedFor
resources.pipeline.<Alias>.requestedForID


看来你的选择是:

  • 运行ID resources.pipeline.<Alias>.runID
  • 调用REST API

另一种方法可以是仅当原因是scheduledBuild.Reasonhere)时检查流水线A和trigger pipeline b via REST API中的原因。

相关问题