I have the repositories in my Azure Container Registry
I would like to reference the latest module by the Major Version (v1) in an external bicep file. So in this case the module with version v1.0.25799 should be used.
main.bicep:
...
module appService 'br:myregistry.azurecr.io/bicep/myappmodule:v1' = {
name: 'appService'
params: {
...
}
}
...
Is there a way to get the latest repository Version?
I tried without success:
Bottom line why this isn't possible at the moment: https://github.com/Azure/bicep/issues/4186#issuecomment-907600100
There some interesting complexities if we supported version ranges rather than single versions:
- Every module restore that uses a version range would require an additional LIST call to enumerate tags in an ACR repository before downloading the module content.
- Local caching benefits would be reduced a bit as well because we always have to query to check if there's a newer version that falls within the requested range.
- bicep build becomes non-deterministic. Running it once and then another time could produce two different results if new module was published. NPM and NuGet solve this problem via lock files that get committed side by side with the source.
- Not all versions/tags follow the x.y.z format.
- The compiled JSON that gets published to the registry contains all the dependencies as they were resolved during bicep publish. Even if you rev'd one of the dependencies, nothing will change until the module is re-published.
(Response on my idea request in GitHub: https://github.com/Azure/bicep/discussions/7043#discussioncomment-2978469)