Azure DevOps管道,该工作怎么知道它是从时间表触发的?

发布于 2025-02-09 23:21:12 字数 445 浏览 3 评论 0原文

我有一个Azure DevOps系统启动和运行,由于PRS和夜间时间表,触发器可以运行管道,例如:

trigger:
 batch: true
 branches:
  include:
   - main
   - release/*
   - pre-release/*

schedules:
  - cron: "0 0 * * *"
    displayName: Daily midnight build
    branches:
      include:
        #- main
        #- release/*
        - pre-release/*
    always: false

有没有办法让工作知道这是从时间表而不是PR中调用的?我想添加另一系列更严格的测试,但只是夜生活,作为通常的工作的一部分。

也许设置一个可以在管道中稍后检查的变量。

I have an Azure DevOps system up and running, with triggers to run the pipeline due to PRs as well as a nightly schedule, like so:

trigger:
 batch: true
 branches:
  include:
   - main
   - release/*
   - pre-release/*

schedules:
  - cron: "0 0 * * *"
    displayName: Daily midnight build
    branches:
      include:
        #- main
        #- release/*
        - pre-release/*
    always: false

Is there a way to let the job know that's being called from a Schedule rather than a PR? I'd like to add another series of more rigorous tests, but just with nightlies, as part of the usual job.

Perhaps setting a variable that can be checked later in the pipeline.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2025-02-16 23:21:12

您可以使用build.Reason 预定义的变量

在您的情况下,检查$(build.reason)等于计划是否有效。

Build.Reason。导致构建运行的事件。

  • 手册:用户手动排队构建。
  • nyseci:连续集成(CI)由git推或tfvc登机触发。
  • batchedci:连续集成(CI)由git推或tfvc登机触发,然后选择了批处理更改。
  • 计划:计划触发器。
  • 验证Heelvese:用户手动排队构建了特定的TFVC架子。
  • CheckInshelveset:封闭式入住触发器。
  • purprequest:构建是由需要构建的git分支策略触发的。
  • resourcetrigger:构建是由资源触发触发的,或者是由另一个构建触发的。

You could use the Build.Reason predefined variable.

In your case checking if $(Build.Reason) equals Schedule should work.

Build.Reason. The event that caused the build to run.

  • Manual: A user manually queued the build.
  • IndividualCI: Continuous integration (CI) triggered by a Git push or a TFVC check-in.
  • BatchedCI: Continuous integration (CI) triggered by a Git push or a TFVC check-in, and the Batch changes was selected.
  • Schedule: Scheduled trigger.
  • ValidateShelvese: A user manually queued the build of a specific TFVC shelveset.
  • CheckInShelveset: Gated check-in trigger.
  • PullRequest: The build was triggered by a Git branch policy that requires a build.
  • ResourceTrigger: The build was triggered by a resource trigger or it was triggered by another build.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文