[Extension] Add azmirror cloud endpoint for installing extensions in air gapped clouds and support config of index url#15128
Conversation
|
Extension |
| ext_endpoint = cli_ctx.cloud.endpoints.extension_storage_account_resource_id if cli_ctx and \ | ||
| cli_ctx.cloud.endpoints.has_endpoint_set('extension_storage_account_resource_id') else None | ||
| config_index_url = cli_ctx.config.get('extension', 'index_url', None) if cli_ctx else None |
There was a problem hiding this comment.
Maybe we can put these 2 URLs in one place?
There was a problem hiding this comment.
Also, isn't the whl location hard-coded in the index?
{
"downloadUrl": "https://azurecliprod.blob.core.windows.net/cli-extensions/account-0.2.0-py2.py3-none-any.whl",
"filename": "account-0.2.0-py2.py3-none-any.whl",
"metadata": {
"azext.isExperimental": true,
There was a problem hiding this comment.
The index will be teleported into different storage accounts in air gapped clouds, we do not have permission to modify the whl downloadUrl based on the destination storage accounts after it gets copied in air gapped clouds. So we need to modify the downloadUrl here in azure-cli when we need to download it in an air gapped cloud.
There was a problem hiding this comment.
Do we really need to put one URL in cloud config, one in az config?
There was a problem hiding this comment.
The one in cloud config is now a general support for downloading extensions and other tools/files needed in air gapped clouds. It's always a storage account endpoint and controlled by Microsoft.
The one in az config is to support customers that want to use their own customized index.json, which may have their own private extensions and some allowed public extensions. You can use any url of the index file, such as the raw content url on a github branch.
|
put this to backlog now given environment setup is under process. When process done, will merge the PR. |
| synapse_analytics_resource_id=None, | ||
| attestation_resource_id=None): | ||
| attestation_resource_id=None, | ||
| extension_storage_account_resource_id=None): |
| url = cli_ctx.config.get('extension', 'index_url', None) | ||
| if url: | ||
| return url | ||
| ext_endpoint = cli_ctx.cloud.endpoints.extension_storage_account_resource_id if cli_ctx and \ |
Description
To support installing extensions in air-gapped clouds, we have set up a pipeline to sync the extension index, wheel packages and extension command tree to a public storage account called
azmirror. A Teleport process will be set up to sync everything inazmirrorto different storage accounts inside air-gapped clouds.In order to use those files in each air-gapped cloud with Azure CLI, this PR adds an
azmirror_storage_account_resource_idendpoint whose value may look likehttps://azmirroragc.blob.core.windows.net.CLI will get extension related files from the endpoint if it is set in the current cloud, otherwise it will use the current default values (for public cloud and sovereign clouds).
This PR also adds config option
extension.index_urlto support customized extension index url. For example, to use theindex.jsonon github:az config set extension.index_url=https://raw.githubusercontent.com/Azure/azure-cli-extensions/master/src/index.jsonTesting Guide
History Notes
[Extension] Support config of extension index url
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.