Azure DevOps管道,该工作怎么知道它是从时间表触发的?
我有一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
build.Reason
预定义的变量。在您的情况下,检查
$(build.reason)
等于计划是否有效。You could use the
Build.Reason
predefined variable.In your case checking if
$(Build.Reason)
equals Schedule should work.