Open jf781 opened 4 years ago
Hi @jf781 The issue that stops the pipeline run is with an endpoint not being authorized to be used in the pipeline. You said that the yaml that gives the error with the CLI command works and runs perfectly when done GUI? Wanted to confirm are you able to run that created pipeline using GUI?
Hi @mitsha-microsoft, that is correct, the pipeline works fine when I create it via the GUI but fails in the CLI.
Is there anything I can do to address the authorization error?
@jf781 Yes you can authorize the pipeline using the az devops invoke
command from the CLI (or grant the authorization to the Service Endpoint from the GUI itself). To authorize the resource using the az devops invoke
command, you can follow this syntax
az devops invoke --area pipelinepermissions --resource pipelinePermissions --route-parameters project=<Project-Name> resourceType=endpoint resourceId=<Service-Endpoint-ID> --in-file params.json --http-method PATCH --api-version "5.1-preview1"
{
"pipelines": [
{
"id": "<Build-Id>",
"authorized": "true"
}
]
}
@mitsha-microsoft Thanks for sending that over.
One thing that I didn't think would matter (but did) is that I was using a single .azcli script to create the AzDo Project and then create the pipelines. I noticed when I ran the the
az pipeline create
command in a terminal after the project was created it worked like it was supposed to.
I messed around with adding a "sleep" command to the script after the project was created but before the pipelines were created but it didn't make a difference. In the end, I added the commands to create the pipelines in another .azcli script and called it from the script that created the project.
Not entirely why the authorizations would come into play with the pipelines being created a second script but it did.
Let me know if you have any questions.
Describe the bug When creating a new pipeline via AZ CLI I get an error that it could not queue the build because there were validation errors or warnings. This happens with a known working yaml file or when I let it create the starter file
To Reproduce Azure Cli Version: 2.1.0
Azure-Devops extension version: azure-devops 0.17.0
Steps to reproduce the behavior: Logged into Azure Devops in Az CLI and run the commands below
Expected behavior I would expect it to the build the pipeline pipeline and start to run it.
Debug logs urllib3.connectionpool : https://dev.azure.com:443 "POST /orgname/projectname/_apis/build/Builds HTTP/1.1" 400 583 azext_devops.devops_sdk.client : Response content: b'{"$id":"1","customProperties":{"ValidationResults":[{"result":"error","message":"An error occurred while loading the YAML build pipeline. Repository self references endpoint 71766954-6580-43ce-aef7-xxxxxxxxxxxx which does not exist or is not authorized for use"}]},"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}' msrest.exceptions : Could not queue the build because there were validation errors or warnings. handling vsts service error
Additional context If I use the same YAML file and build the project through the GUI it creates and runs correctly. Additionally, I omitted the parameter '--yaml-path' and tried to create the "Sample Pipeline" (option 1) and it received the same error so I don't think it is a YAML issue.
The pipeline is also created without error if I add the "--skip-run" parameter but it fails when running with the error below.