Issue
I'm working on Azure DevOps Pipeline to schedule a pipeline with two different parameters on different days according to the cron syntax.
Looking through the triggers, conditions, neither a schedule trigger nor a pipeline trigger seems to allow to pass a parameter value. Below are my parameters. Usually a user will trigger the pipeline with an environment of his choice; that doesn't have any problems.
parameters:
- name: environment
displayName: Select the Suite to execute
default: Test
values:
- Test
- Dev
- QA
How do I add parameters to pipeline on a schedule with parameters?
schedules:
- cron: "0 1 10-15 * sat"
displayName: 7PM CST - SAT
branches:
include:
- feature
- cron: "0 3 25-31 * sat"
displayName: 9PM CST - SAT
branches:
include:
- feature
Also checked options with strategy which doesn't satisfy my need, where I cannot have a new job to have the scheduled run with parameters as below, as this pipeline needs to be available for users to trigger based on the environment selection, if I specify these conditions jobs/tasks won't trigger.
pool:
vmImage: '**'
strategy:
matrix:
Run1:
myvar: 12
Run2:
myvar: 14
Run3:
myvar: 16
Solution
I was able to trigger Pipeline Passing parameters (browser,environment) from the API call as below
curl -L -X POST 'https://dev.azure.com/Org/project/_apis/build/builds?definitionId-**&api-version=6.1-preview.6' -H 'Authorization: $(ADO__AUTH)' -H 'Content-Type: application/json' --data
'{"definition": {
"id": 825
}, "resources": {
"repositories": {
"self": {
"refName": "refs/heads/develop"
}
}
},
"templateParameters": {
"browser":"chrome",
"environment": "Test"
} }'
Answered By - saikumar reddy Answer Checked By - Dawn Plyler (WPSolving Volunteer)