Is your feature request related to a problem? Please describe.
Cannot queue a pipeline that requires parameters.
Describe the solution you'd like
Support az pipeline run --parameters name=value
Additional context
Parameters were just implemented recently?
Any estimation for this feature? The lack of this feature prevents us from using runtime parameters within our pipelines.
In the meantime, you can use the following curl command to queue a pipeline with runtime parameters. The API call is documented here.
curl -X POST https://dev.azure.com/${DEVOPS_ORG}/${DEVOPS_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs\?api-version\=6.0-preview.1 \
-H "Content-Type: application/json" \
-u "${DEVOPS_PAT}": \
-d @<(cat <<EOF
{
"stagesToSkip": [],
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/master"
}
}
},
"templateParameters": {
"param1": "value1",
"param2": "value2"
},
"variables": {}
}
EOF
)
Hi, How would I implement this into an azure DevOps pipeline I am unsure how to run the curl command?
@MohammedQureshi you can use it in a script or bash task. See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=example%2Cparameter-schema#script
plus one on this - i have been able to use rest api as workaround but super painful
For fellow sufferers - this works (bash) for me and passes template parameters as expected
`# To get pipeline id
# az pipelines show --name build-private-agent-image
# To get repos id
# az repos show --repository YOUR_REPO
# Rest api doc
#https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run%20pipeline?view=azure-devops-rest-6.1#runresourcesparameters
# create body of post
body=$(cat << EOF
{ "templateParameters":
{
THESE_ARE_MINE-USE_YOURS
"runPR": "true",
"runDev": "false",
"runNonProd": "false",
"runProd": "false",
"autoDestroyPR": "true"
},
"resources":
{"repositories":
{"self":
{"repository": {"id": "GET_YOUR_REPO_ID","type": "azureReposGit"},"refName": "refs/heads/main"}
}
}
}
EOF
)
# clean out EOF for json
body=$(echo $body | tr 'EOF' ' ')
# create url string
url_string="https://dev.azure.com/$(DEVOPS_ORG_SHORT)/$(DEVOPS_PROJECT)/_apis/pipelines/YOUR_PIPELINE_ID/runs?api-version=6.0-preview.1"
echo "url="$url_string
# kick off build
curl -X POST -u :${AZURE_DEVOPS_CLI_PAT} $url_string \
-H "Content-Type: application/json" \
-d "$body"`
Another plus one. Not being able to specify parameters to my builds is a gross oversight in this tool.
Plus one. Really need this - have to revert to REST api for now...
Plus one. This seems a massive oversight.
I miss that too
The lack of this makes the run command almost unusable. Is there a plan to implement this soon? The issue has been open for nearly a year.
Yes, that would be good to have via az cli and avoid using the painful API call... Thanks to @arthurdaytonSIC for your post, it helped a lot.
PS - If you run your pipeline in the UI and look at the network tab in developer tools you will see that MS uses same API so it makes figuring out syntax issues waaaayyyyy easier.
I miss that feature too. Would be very helpful.
+1
Over a year now..
Did anybody figure a way out to invoke the request through az devops invoke to at least handle auth?
Plus one here too.
Need this
+1 need this badly
We have 5 children at home, we need dis
+1
Did anybody figure a way out to invoke the request through
az devops invoketo at least handle auth?
Create a file (e.g. body.json) that contains the request body with the git branch and pipeline parameters.
{
"stagesToSkip": [],
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/master"
}
}
},
"templateParameters": {
"param1": "value1",
"param2": "value2"
},
"variables": {}
}
Then do...
az devops invoke \
--http-method POST \
--area pipelines \
--resource runs \
--route-parameters project=<YOUR_PROJECT_NAME> pipelineId=<YOUR_PIPELINE_ID> \
--api-version "6.0-preview" \
--in-file body.json
Add the --debug flag if something is not working to try to find out the cause.
You can find your pipeline ID by navigating to your pipeline from DevOps and finding the definitionId in the URL.
It's not a solution, but at least it's better than running cURL commands...
@adrianmo Great timing! I just stumbled upon this, that workaround will be helpful!
Also can chime in with a "+1" just to give visibility to this.
+1, please fix.
+1, please implement
We really need this!
Hey @gauravsaralMs, noticed that this issue has been removed from planning. Considering the support for this feature to be implemented, can MS explain why this issue has now gone backwards?
+1 We need this, please implement
@ofiron01, instead of commenting with a +1, please go and click the 馃憤 icon on the original request above.
Im pretty sure there is a dupe of this issue in https://github.com/Azure/azure-devops-cli-extension/issues/1110. Good news is is that I think its getting worked on in 1110. Maybe. Hard to be sure. The comms from MS on this issue arent great.
Most helpful comment
We have 5 children at home, we need dis