Azure DevOps 每晚构建 - 计划 \ cron 语法

Bri*_*oss 5 azure-devops azure-pipelines

我试图在构建管道 YAML 文件中将每晚构建设置为每天 00:30 发生。尝试构建时出现以下错误:

Improperly formed cron syntax: '00 30 00 * * *'

这是我尝试过的:

schedules:
- cron: '00 30 00 * * *'
Run Code Online (Sandbox Code Playgroud)

我已经尝试过:

schedules:
- cron: '0 30 0 * * *'
Run Code Online (Sandbox Code Playgroud)

我正在对照以下工具检查我的工作(但不完全确定该工具是否完美)。

微软文档:azure/devops/pipelines/yaml-schema

iok*_*ins 3

两种可能性:

  1. 双引号而不是单引号 (?)
  2. 五个 cron 字段,而不是六个

两个例子

schedules:
- cron: "0 0 * * *"
  displayName: Daily midnight build
  branches:
    include:
    - master
    - releases/*
    exclude:
    - releases/ancient/*
- cron: "0 12 * * 0"
  displayName: Weekly Sunday build
  branches:
    include:
    - releases/*
  always: true
Run Code Online (Sandbox Code Playgroud)

为了简单参考,每个 cron 表达式代表一个以空格分隔的表达式,其中包含按以下顺序排列的五个条目:

mm HH DD MM DW
 \  \  \  \  \__ Days of week
  \  \  \  \____ Months
   \  \  \______ Days
    \  \________ Hours
     \__________ Minutes
Run Code Online (Sandbox Code Playgroud)

因此,示例在每天 00:30 构建:

schedules:
- cron: "30 0 * * *"
  displayName: Daily 00:30 build
  branches:
    include:
    - master
    - releases/*
    exclude:
    - releases/ancient/*
Run Code Online (Sandbox Code Playgroud)

Cron 描述符链接交叉检查:

http://cronexpressiondescriptor.azurewebsites.net/?expression=30+0+ + +*&locale=en