4
votes

I am trying to set my nightly build to occur at 00:30 every day in my build pipeline YAML file. I get the following error when trying to build:

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

This is what I've tried:

schedules:
- cron: '00 30 00 * * *'

and I have tried:

schedules:
- cron: '0 30 0 * * *'

I am checking my work against the following tool (not totally sure if the tool is perfect though).

Microsoft Doc: azure/devops/pipelines/yaml-schema

1

1 Answers

3
votes

Two possibilities:

  1. Double-quotes instead of single-quotes (?)
  2. Five cron fields, not six

Two examples:

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

For simple reference, each cron expression represents a space-delimited expression with five entries in the following order:

mm HH DD MM DW
 \  \  \  \  \__ Days of week
  \  \  \  \____ Months
   \  \  \______ Days
    \  \________ Hours
     \__________ Minutes

So, example build at 00:30 every day:

schedules:
- cron: "30 0 * * *"
  displayName: Daily 00:30 build
  branches:
    include:
    - master
    - releases/*
    exclude:
    - releases/ancient/*

Cron descriptor link cross-check:

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