I need to queue a VSTS build from the REST API Documented at https://docs.microsoft.com/en-us/rest/api/vsts/build/builds/queue?view=vsts-rest-4.1
This answer helped me queue a basic build.
I have been successful using a Personal Access Token (PAT) to authenticate and this json payload
{
definition: {
id: 19,
}
}
I need to pass variables into the build as well. These are some of the things I have tried that are not working
Not working 1
{
definition: {
id: 19,
variables: {
"my.var.one": { allowOverride: true, isSecret: false, value: "stringvalue" },
"my.var.two": { allowOverride: true, isSecret: false, value: "numberValue" }
}
}
}
Not working 2
{
definition: {
id: 19,
variables: {
"my.var.one": { value: "stringvalue" },
"my.var.two": { value: "numberValue" }
}
}
}
Not working 3
{
definition: {
id: 19,
variables: {
"my.var.one": "stringvalue",
"my.var.two": "numberValue"
}
}
}
It was suggested this question might have the answer since VSTS and TFS are similar. Unfortunately changing to the parameters variable and using the string representation of the object gives the same result. Removing the dots from the parameter names did not make a difference. Trying with the API Version 3.1 also got the same result.
Not working 4
{
definition: {
id: 19,
parameters: '{
"myVarOne": "stringValue",
"myVarTwo": "numberValue"
}'
}
}
What is the correct way to format variables in the payload (or other location) to pass them to the build you are trying to queue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…