SECRET OF CSS

Schedule a Build in Azure DevOps Using CRON Expressions | by Sarah Lean | Jun, 2022


Schedule Azure DevOps pipelines

0* kedtDHo6LEY4Rc

You can trigger Azure DevOps pipelines to run on a number of different events.

When building pipelines, there may be a case when you want to run them on a defined schedule. This is where CRON expressions come in handy.

Yes! You can easily schedule them using a CRON expression as the trigger in your pipeline file.

CRON is a command-line utility that is used to schedule jobs. You’ll hear it referred to as CRON jobs or CRON tasks.

The CRON syntax can sometimes be confusing when first encountered. There are five sections that can be configured within the CRON syntax. You can specify the day of the week, month, day of the month, hour, and minute.

This isn’t something you need to commit to memory but being able to read the syntax is useful. Below is a great diagram to show you how the syntax is broken down.

CRON expressions explained

I love to use the website https://crontab.guru/. You can put the syntax into the website and it will decipher what that schedule would do, or equally, you can use it to build the right syntax for the schedule you want to execute.

I want to show you an example of an Azure DevOps Pipeline that runs on a schedule.

Azure DevOps Pipeline schedule breakdown

The above is a part of my pipeline that will trigger at midnight every Monday, Tuesday, Wednesday, Thursday, and Friday and complete what the pipeline is designed to build.

What you should notice is it will open triggers for the main branch, not any other branches. This allows for granular control over different branches and the needs you might have.

The full pipeline looks like this:

Azure DevOps Pipeline example
Originally published at https://www.techielass.com



News Credit

%d bloggers like this: