How to YML Schedule build in Azure DevOps Pipeline

0 votes

I have an existing pipeline created in 'class editor' that includes: this needs to be scheduled to run monthly.

  • JSON file for variable substitutions,
  • install and run .pynb packages

enter image description here

There are 2 ways to achieve scheduling: YML or Classic (classic does not have a monthly option)

I have been using the following YAML to schedule run monthly. Here, this YML does not trigger to run the pipeline create in 'classic editor' to run - How can I include it? OR is there an efficient way to run my .pynb and .json file monthly?

 trigger: none

schedules:
- cron: "0 0 1 * *"
  displayName: (UTC) daily build
  branches:
    include:
    - main
    - releases/*
    exclude:
      - releases/old/*
  always: true

pool:
  vmImage: ubuntu-latest

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'





Mar 28, 2022 in Other DevOps Questions by Kichu
• 19,040 points
1,465 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

This can be done using Cron Job or Cron Expressions.

There are two things you need to consider :

  1. The pipeline that is already created is - MyRelease Pipeline.
  2. The new Pipeline - Scheduler Pipeline.

 

  • Create a New Pipeline.

Azure DevOps page > Pipelines > Choose Pipelines.

  • Click on New Pipeline.

A new pipeline window appears and then click on the new pipeline button in the new window.
  • Choose Azure Repos Git as your source.
You will be asked to choose your source of code and select Azure Repos Git as your source.
  • Choose your Project and Repository.

Choose the location for your YAML file to be saved.
  • Choose Template as YAML.

After completing the above step, a template window will appear, In that choose Start pipeline from the list.

  • Click on Show Assistant.

Azure DevOps YAML pipeline comes with an assistant, This helps you fill the required details in the text box and, It will be added as a YAML script.
  • Add Cron Job Details. 

YAML

schedules:

- cron: "0 2 1-7 * SUN"

displayName: 25th 5:30 AM (IST) Every Month

branches:

include:

- master

 

  • Edit your YAML file according to your preference.
For scheduling, the code will look like this :
schedules:
- cron: "0 2 1-7 * SUN"
  displayName: 25th 5:30 AM (IST) Every Month
  branches:
    include:
    - master
pool:
  vmImage: 'ubuntu-latest'
steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'
- task: releaseorchestrator@2
  inputs:
    endpointType: 'integrated'
    projectName: 'My Project'
    definitionName: 'MyRelease Pipeline'
    releaseStrategy: 'create'
    definitionStage: 'Staging'
  • Click on Save and run button.

Hope this helps you.
answered Apr 6, 2022 by narikkadan
• 63,600 points

edited Mar 5

Related Questions In Other DevOps Questions

0 votes
1 answer

How to configure and execute Azure Devops classic editor pipeline after commit in Github?

If you're looking for CI/CD triggers, all ...READ MORE

answered Feb 10, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
1,211 views
0 votes
0 answers
0 votes
1 answer
0 votes
0 answers

OWASP Zed Attack Proxy Scan in DevOps pipeline

I want to do the "Authenticated Scan" ...READ MORE

Mar 15, 2022 in DevOps Tools by Kichu
• 19,040 points
943 views
0 votes
1 answer
0 votes
0 answers

Multiple YAML build pipelines in Azure DevOps

Using the new YAML way I want ...READ MORE

Mar 15, 2022 in DevOps Tools by Kichu
• 19,040 points
1,280 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP