Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.17k stars 730 forks source link

bicep build produces arm templates with LF line endings on Windows #14383

Open josoklas opened 2 weeks ago

josoklas commented 2 weeks ago

Bicep version This reproduces starting with bicep CLI version 0.25.3. The previous version 0.24.24 outputs CRLF endings.

Describe the bug On Windows, starting with bicep 0.25.3 the arm templates output by "bicep build" have LF line endings. Previously the behavior was to use CRLF on Windows. Ideally this would be configurable.

To Reproduce Create a file test.bicep with the following content:

targetScope = 'subscription'

resource ResourceGroup 'Microsoft.Resources/resourceGroups@2018-05-01' = {
  name: 'testrg'
  location: 'eastus'
}

Run bicep build test.bicep with both versions 0.24.24 and 0.25.3.

The test.json produced by 0.24.24 will have CRLF line endings. The test.json produced by 0.25.3 will have LF line endings.

Additional context

stephaniezyen commented 1 week ago

How does this issue impact your workflow? This seems to be an unintentional change on our end

josoklas commented 1 week ago

Thanks for taking a look!

This impacts our workflow because we check in ARM templates into our git repo and perform a bicep build as part of CI. We then check if there are any changes to the bicep output by utilizing "git status". So, not having control over the line endings results in errant diffs.

It also is a bit weird if we try to normalize the line endings in our repo because these are explicitly generated with LF.