You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bicep version
0.32.4 and later (latest tested 0.33.93). The problem did not occur with earlier Bicep versions.
Describe the bug
Repeatedly building the same Bicep file intermittently results in syntactically different (but semantically identical) ARM templates. Even though the result is semantically identical, this breaks our workflow as we use the calculated templateHash to check whether an automatically built template is identical to a published template.
The difference is in the order of dependencies of a resource, but it does not happen with every resource. For a relatively big template, the only difference is in this fragment:
To Reproduce
I've found that this has to do with the state of the Bicep template spec cache. If the cache is empty, the resulting ARM template has a chance of containing the second snippet above, although it will often contain the first snippet. If the cache is populated, the resulting ARM template always contains the first snippet, never the second. The strange thing is that in all cases the resulting files in the cache are 100% identical.
To demonstrate the intermittent behavior when starting with a fresh cache every build:
Additional context
A workaround is to to a bicep restore --force first, and then bicep build. As the cache is populated before the build starts, the problem doesn't occur.
Unfortunately I can't supply the source template, as it contains some deploymentScripts and other sensitive data, and I haven't been able to narrow down the problem to a simpler template yet. For what it's worth, the problematic template is a languageVersion 2 template.
The text was updated successfully, but these errors were encountered:
Bicep version
0.32.4 and later (latest tested 0.33.93). The problem did not occur with earlier Bicep versions.
Describe the bug
Repeatedly building the same Bicep file intermittently results in syntactically different (but semantically identical) ARM templates. Even though the result is semantically identical, this breaks our workflow as we use the calculated
templateHash
to check whether an automatically built template is identical to a published template.The difference is in the order of dependencies of a resource, but it does not happen with every resource. For a relatively big template, the only difference is in this fragment:
...which sometimes appears in the ARM template as (note the difference in the order of dependencies):
To Reproduce
I've found that this has to do with the state of the Bicep template spec cache. If the cache is empty, the resulting ARM template has a chance of containing the second snippet above, although it will often contain the first snippet. If the cache is populated, the resulting ARM template always contains the first snippet, never the second. The strange thing is that in all cases the resulting files in the cache are 100% identical.
To demonstrate the intermittent behavior when starting with a fresh cache every build:
To demonstrate that if the cache is full when Bicep starts, the result is always the same:
Additional context
A workaround is to to a
bicep restore --force
first, and thenbicep build
. As the cache is populated before the build starts, the problem doesn't occur.Unfortunately I can't supply the source template, as it contains some deploymentScripts and other sensitive data, and I haven't been able to narrow down the problem to a simpler template yet. For what it's worth, the problematic template is a
languageVersion 2
template.The text was updated successfully, but these errors were encountered: