I am configuring pipeline on Azure DevOps for running e2e tests.
I would like to have two options:
- tests will run automatically at some hour - using schedules for that
- running tests on demand
How can I achieve that? Tried such yaml, but I am receiving Unexpected value 'schedules' when trying to run manually:
jobs:
- job: 'auto-run tests'
displayName: E2E scheduled tests
schedules:
- cron: "0 5 * * 1,3,5"
branches:
include:
- master
steps:
<some auto-run tests job config here>
- job: 'manually run tests'
displayName: E2E manually run tests
steps:
CodePudding user response:
You should use condition to distinguish build reason:
schedules:
- cron: "0 5 * * 1,3,5"
displayName: E2E scheduled tests
branches:
include:
- master
always: true
jobs:
- job: scheduled_run_tests
condition: eq(variables['Build.Reason'], 'Schedule')
displayName: E2E scheduled run tests
steps:
- job: manually_run_tests
condition: eq(variables['Build.Reason'], 'Manual')
displayName: E2E manually run tests
steps:
Here you have list of build resons.
