ADR: Azure provider registry aliasing #12110
Replies: 8 comments 17 replies
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
I have some questions and comments:
|
Beta Was this translation helpful? Give feedback.
-
I don't think that the version number should be part of the declaration. At least by default, the version number should be configured in the bicepconfig.json. When building a large template out of bicep modules, I think this version would have to be the same across all the nested dependencies.
|
Beta Was this translation helpful? Give feedback.
-
This feels similar in goals to aliases. A shorter syntax definitely feels beneficial, but can we achieve this by extending aliases rather than introducing a new concept for path resolution? |
Beta Was this translation helpful? Give feedback.
-
IIRC, with modules you have |
Beta Was this translation helpful? Give feedback.
-
We had talked about versioning the registry cache. I believe we had decided to use this or something similar? br/modules.v2 |
Beta Was this translation helpful? Give feedback.
-
For modules, we consider filesystem to be the "default", with br & ts requiring specific opt-in. For providers, is there any benefit to considering filesystem default, or could we consider |
Beta Was this translation helpful? Give feedback.
-
ADR-1210: Azure provider registry aliasing
Protocol: Comments / Approval
Please add an emoji as a means to provide your approval/objection to this proposed change.
👍 (Approves)
👎 (Objects)
If you start a thread in a comment below, please use the ✅ (
:white_check_mark:
) emoji to signal you accept the resolution/answer and mark the thread resolved.Context
With the introduction of dynamic type loading PR_#11458, a provider specification (for example
import '[email protected]' as az
has a corresponding oci artifact addressmcr.microsoft.com/bicep/providers/az:1.0.0
, the address for the az provider is hardcoded and the fqdn for the registry can ony be changed using a experimental environment variable __EXPERIMENTAL_BICEP_REGISTRY_FQDN PR_#11547.Proposed Changes
We propose to add support for aliasing in a similar way aliasing is handled for Bicep modules for the az provider declaration syntax as following:
Case 1: Explicit declaration of the registry path
Example 1
In this case the user is using an explicit address from which to fetch the provider artifact, the compiler will use the current security context to authenticate the ACR client to fetch the types artifact.
The artifact will be stored under the path:
~/br/contosoregistry.azurecr.io/bicep$providers$az/1.0.0$/
Case 2: Default bicep registry
In the current implementation the syntax for declaring a provider is
import '[email protected]' as az
, we propose changing the statement syntax to align with Example 1 (above).Example 2:
When a registry prefix is unspecified and
experimentalFeaturesEnabled.dynamicTypeLoading == true
, the compiler will resolve the specification to the MCR registry address, that is,mcr.microsoft.com/bicep/providers/
and append to that prefix the value (azure:1.0.0
) resulting in a fully qualified address for the type artifacthttps://mcr.microsoft.com/bicep/providers/az:1.0.0
.The artifact will be stored under the path:
~/br/mcr.microsoft.com/bicep$providers$az/1.0.0$/
The resolution happens by deduction from the default bicepconfig.json. There are various options to accomplish this discussed below.
Recommended Option
Uses the pattern established for modules. In the below
bicepconfig.json
adds a new sectionproviderAliases
that defines bicep registry alias calledpublic
and aprovidersPath
with the prefix for provider artifacts in the registry.See Apendix for other options considered and a discussion on their drawbacks/benefits
Case 3: Using an alias
Example 3:
In this case the user is gesturing the intent that they want to fetch the package from a private registry
contosoregistry.azurecr.io
whose alias ismyPrivateRegistry
. The compiler will resolve the alias by inspection of thebicepconfig.json
and store the artifact under the path:~/br/contoso.azurecr.io/bicep$providers$az/1.0.0$/
Out of Scope:
SpecificationString
is enforcing SemVer format)Apendix
Options for how to specify the
bicepconfig.json
Option 2: Converging both "moduleAliases" and "providerAliases" into "aliases"
Drawbacks:
Advantages:
Option 3: Aliasing the full path of the provider (including) the provider name
import br:[email protected]
Disatvantages:
Advantages:
Beta Was this translation helpful? Give feedback.
All reactions