Reputation: 1439
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:
Upvotes: 0
Views: 1639
Reputation: 1439
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)
Upvotes: 1
Reputation: 4610
Tested in my enviorment and found that you can not use like below format to get that latest images from container registry. You have to use the full image name with tag to use thelatest/spefic image.
- br:myregistry.azurecr.io/bicep/myappmodule:v1.*
- br:myregistry.azurecr.io/bicep/myappmodule:v1*
- br:myregistry.azurecr.io/bicep/myappmodule:v1:latest
- br:myregistry.azurecr.io/bicep/myappmodule:latest
Pushed two images to ACR with simillar name ie you are using and for example trying to create a container instance from that images(resides in container registry)
Getting an error since the image is trying to pull to create a container instance doesn't exist with that name.
Tried with the full name as it is in container registry it works fine.
would suggest you please use below format as it is pushed to conatainer registry.
Upvotes: 1