Closed josoklas closed 4 months ago
How does this issue impact your workflow? This seems to be an unintentional change on our end
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.
@josoklas This was actually a by design change we made to make sure we produce consistent line endings across all platforms.
Since this is a one-time change, it shouldn't affect your workflow in the future. We'll add tests to ensure Bicep produces consistent line endings going forward.
Hey @shenglol,
could it be that this is still an issue? If I run a bicep build
on a template that loads a file via loadTextContent()
locally on Windows, it shows the \r\n
in the Bicep template. Now, if I run the same on Linux (to be precise, in the pipeline), it shows only \n
.
AVM-wise this is a bit of a big problem as we have a test that tests if the main.json
file is 'latest'. However, as the command works seperately on Windows & Linux, it always fails the test in the pipline:
The issue is, for example, visible in this pipeline run for testing this template & line.
As we're loading files via loadTextContent()
that have their own encording, I would understand if some files would show divering line endings as per the system they were created on. But I do not understand why they would show up differently only when running a bicep build
command on Windows vs. Linux.
Would you happen to have any advice? :)
@AlexanderSehr Shared my findings in the Teams chat. This seems to be a by design loadTextContent
behavior, and it's not related to this issue, which is about line-ending consistency for ARM template file content.
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:
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