-
Notifications
You must be signed in to change notification settings - Fork 3.4k
If Bicep returns a non-0 exit code (e.g. there are any build errors), not propagating output #28259
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAzure Deploymentsaz deployment/bicep/stack/deployment-scripts/ts/group exportaz deployment/bicep/stack/deployment-scripts/ts/group exportService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.act-codegen-extensibility-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure Deploymentsaz deployment/bicep/stack/deployment-scripts/ts/group exportaz deployment/bicep/stack/deployment-scripts/ts/group exportService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.act-codegen-extensibility-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.
Describe the bug
@anthony-c-martin of the Bicep team asked me to raise this issue here:
Azure/bicep#11960 (comment)
This issue being experienced is that when
az bicep lintfails (returns a non-0 exit code) no output is produced.Related command
Consider the following command that lints a Bicep module and outputs to a
bicep.sariffile:az bicep lint --file ./infra/main.bicep --diagnostics-format sarif > bicep.sarifThis works well when it comes to lints that exit with 0 (only warnings). Output is produced, this is as desired. However if the linting fails / exits with non-0 then output is not produced. This is a problem as users are not advised as to the problem.
Errors
Haha - it's actually the lack of errors that is the issue!
Issue script & Debug output
Running in the context of GitHub Actions:
With a
bicepconfig.jsonthat looks like this:{ // See https://aka.ms/bicep/config for more information on Bicep configuration options // Press CTRL+SPACE/CMD+SPACE at any location to see Intellisense suggestions "analyzers": { "core": { "rules": { "no-unused-vars": { "level": "error" } } } } }And in the
main.bicepfile an unused variable:This produces no output. See here: https://github.com/johnnyreilly/blog.johnnyreilly.com/actions/runs/7684802835/job/20941714974?pr=817
Expected behavior
By contrast compare with https://github.com/johnnyreilly/blog.johnnyreilly.com/actions/runs/7684722135/job/20941552998 where there was a 0 return code as we dialled the lint rule down from an
errorto awarning:Regardless of whether exiting with 0 or non-0,
az bicep lintshould produce output.Environment Summary
{ "azure-cli": "2.56.0", "azure-cli-core": "2.56.0", "azure-cli-telemetry": "1.1.0", "extensions": {} }Additional context
Read more from the thread here: Azure/bicep#11960 - there's a bunch of things in there