Ara Galstyan
Ara Galstyan

Reputation: 556

How to schedule the Cypress tests in Azure Devops?

My Cypress tests are running after every commit but I want them to run every 30 minutes. Here is my YAML file - https://pastebin.pl/view/0d56bd33. How can I manage them to run every 30 minutes(or accroding to given CRON time)?

Upvotes: 0

Views: 884

Answers (1)

Walter
Walter

Reputation: 3058

run script A after commit, but run script B after every 30 min

You can add conditions to your script. For example:

schedules:
- cron:  "*/30 * * * *"
  displayName: Every 30 minutes
  branches:
    include:
    - main
  always: true
trigger:
- '*'

pool:
  vmImage: ubuntu-latest

steps:
- script: echo script A
  displayName: 'script A'
  condition: eq(variables['Build.Reason'], 'IndividualCI')

- script: echo  script B
  displayName: 'script B'
  condition: eq(variables['Build.Reason'], 'Schedule')

In this sample:

  • script A will run when you push a commit and script B will be skipped.
  • script B will run every 30 minutes and script A will be skipped.

Upvotes: 1

Related Questions