Azure Pipelines 计划每个月只有 运行 几天
Azure Pipelines Schedule to Run Only Few Days a Month
有没有办法在 Azure 中自定义管道计划选项,使其 运行 仅在每个月的第二周?
我知道您可以将其安排在一周中的特定几天 运行,但我不知道如何按月进行。
在 UI 中似乎没有这样做,但您仍然可以根据自己的计划通过 API 调用来触发构建。
https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1
您可以通过在 YAML 配置中创建计划触发器来实现此目的。请注意,您必须通过使用计划触发器禁用 PR 和 CI 触发器到 运行 您的管道。
您可以通过设置 pr: none
和 trigger: none
来禁用触发器。然后使用 cron 语法定义计划。
schedules:
- cron: "0 0 1/14 * *" # At 00:00 on every 14th day-of-month from 1 through 31.
displayName: Second week of each month
branches:
include:
- master
...
https://github.com/atifaziz/NCrontab/wiki/Crontab-Expression
Can I do this if my pipeline was made as a classic/GUI based, and not
as a YAML pipeline?
在经典管道中,您只能为每周设置计划触发器。据我所知,您不能 运行 仅在经典管道中的每个月的第二周。但是,您可以在 yaml 管道中设置计划触发器并使用它来触发您的经典管道。
如果您要使用 YAML 管道,这里是示例:
schedules:
- cron: "0 0 8-14 * *"
displayName: schedule
branches:
include:
- main
always: true
在这个例子中:
- 流水线会在本次的8号到14号触发
月。您需要每月更新日期。
always: true
表示 run even when there are no code changes.
- 同意 iikkoo 的观点,如果您想通过 仅使用预定触发器 运行 您的管道,您必须通过指定 pr 来禁用 PR 和持续集成触发器:none 并触发:none 在你的 YAML 文件中。
- 您可以在此 yaml 管道中添加一个构建完成触发器来触发您的经典管道:
请在文档中查找有关 Configure schedules for pipelines 的更多详细信息。
有没有办法在 Azure 中自定义管道计划选项,使其 运行 仅在每个月的第二周?
我知道您可以将其安排在一周中的特定几天 运行,但我不知道如何按月进行。
在 UI 中似乎没有这样做,但您仍然可以根据自己的计划通过 API 调用来触发构建。 https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1
您可以通过在 YAML 配置中创建计划触发器来实现此目的。请注意,您必须通过使用计划触发器禁用 PR 和 CI 触发器到 运行 您的管道。
您可以通过设置 pr: none
和 trigger: none
来禁用触发器。然后使用 cron 语法定义计划。
schedules:
- cron: "0 0 1/14 * *" # At 00:00 on every 14th day-of-month from 1 through 31.
displayName: Second week of each month
branches:
include:
- master
...
https://github.com/atifaziz/NCrontab/wiki/Crontab-Expression
Can I do this if my pipeline was made as a classic/GUI based, and not as a YAML pipeline?
在经典管道中,您只能为每周设置计划触发器。据我所知,您不能 运行 仅在经典管道中的每个月的第二周。但是,您可以在 yaml 管道中设置计划触发器并使用它来触发您的经典管道。
如果您要使用 YAML 管道,这里是示例:
schedules:
- cron: "0 0 8-14 * *"
displayName: schedule
branches:
include:
- main
always: true
在这个例子中:
- 流水线会在本次的8号到14号触发 月。您需要每月更新日期。
always: true
表示 run even when there are no code changes.- 同意 iikkoo 的观点,如果您想通过 仅使用预定触发器 运行 您的管道,您必须通过指定 pr 来禁用 PR 和持续集成触发器:none 并触发:none 在你的 YAML 文件中。
- 您可以在此 yaml 管道中添加一个构建完成触发器来触发您的经典管道:
请在文档中查找有关 Configure schedules for pipelines 的更多详细信息。