Azure / Azure/azure-devops-cli-extension
[Bug] az pipeline create hides validation errors in debug logs
- Dominant language
- Python
- Stars
- 682
- Forks
- 278
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 3
Description
**Describe the bug**
If you create a pipeline whose YAML or JSON fails validation, you'll only see this:
```sh
ERROR: Could not queue the build because there were validation errors or warnings.
```
Instead of this (for example)
```sh
DEBUG: azext_devops.devops_sdk.client : Response content: b'{"$id":"1","customProperties":{"ValidationResults":[{"result":"error","message":"An error occurred while loading the YAML build pipeline. File $pipeline_file not found in repository https://dev.azure.com/$project_id/$repo/_git/$repo branch refs/heads/master version $version."}]},"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}'
```
Which is problematic because the pipeline still creates itself:
```
$: AZURE_DEVOPS_EXT_PAT=$PAT az pipelines create --name "Kubernetes Cluster - Demo" --description "Test that AKS builds for me" --branch master --org https://dev.azure.com/$project --project "TSC AKS Demo" --service-connection "Development" --yaml-path $path_to_errant_yaml --repository "AKS Demo" --repository-type tfsgit
ERROR: Pipeline with name Kubernetes Cluster - Demo already exists.
```
**To Reproduce**
Azure Cli Version:
```
$: az version
{
"azure-cli": "2.8.0",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.8.0",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {
"azure-devops": "0.18.0"
}
}
```
Steps to reproduce the behavior:
1. Run `az pipeline create` with your PAT as an environment variable. Ensure that `--yaml-path` points to a YAML file that will cause validation errors.
2. Wait for command to complete.
3. Repeat step [1].
4. Delete the pipeline: `az pipeline delete [args]`
5. Repeat step [1] but add `--debug --verbose` to the end of the command.
**Expected behavior**
I should either be able to re-attempt creating the pipeline or should see the actual error the first time.
Contributor guide
Assessment
This issue has not been assessed yet.