Closed
Description
Environment
Node version: 12.9.1
Npm version: 6.10.2
OS and version: macOS Catalina
azure-devops-node-api version: 10.1.1
Issue Description
When attempting to trigger a build pipeline with paramaters like so:
const build = {
definition: {
id,
},
sourceBranch: 'refs/heads/my-branch',
parameters: JSON.stringify({
requiredParamA: 'paramA',
requiredParamB: 'paramB',
requiredParamC: 'paramC',
}),
};
const out = await this.buildApi.queueBuild(build, this.project);
console.log(out);
I get the following error:
{"statusCode":400,"result":{"$id":"1","customProperties":{"ValidationResults":[{"result":"error","message":"A value for the 'requiredParamA' parameter must be provided."},{"result":"error","message":"A value for the 'requiredParamB' parameter must be provided."},{"result":"error","message":"A value for the 'requiredParamC' parameter must be provided."}]},"innerException":null,"message":"Could not queue the build because there were validation errors or warnings.","typeName":"Microsoft.TeamFoundation.Build.WebApi.BuildRequestValidationFailedException, Microsoft.TeamFoundation.Build2.WebApi","typeKey":"BuildRequestValidationFailedException","errorCode":0,"eventId":3000}}
It seems that the parameters in the Build interface are maybe variables?
For now I am using this which seems to work:
const build = {
resources: {
repositories: {
self: {
refName: `refs/heads/${refName}`,
},
},
},
templateParameters,
};
const url = `${this.orgUrl}/${this.project}/_apis/pipelines/${definitionId}/runs`;
const reqOpts = {
acceptHeader: 'application/json;api-version=5.1-preview.1',
};
return this.buildApi.rest.create(url, build, reqOpts);
Expected behaviour
A build pipeline should be queued.
Actual behaviour
Validation errors on the request
Steps to reproduce
See above
Logs
See above