Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SuperPMI Python script Azure usage #61650

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/coreclr/scripts/jitutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ def require_azure_storage_libraries(need_azure_storage_blob=True, need_azure_ide
""" Check for and import the Azure libraries.
We do this lazily, only when we decide we're actually going to need them.
Once we've done it once, we don't do it again.

For this to work for cross-module usage, after you call this function, you need to add a line like:
from jitutil import BlobClient, AzureCliCredential
naming all the types you want to use.

The full set of types this function loads:
BlobServiceClient, BlobClient, ContainerClient, AzureCliCredential
"""
global azure_storage_libraries_check, BlobServiceClient, BlobClient, ContainerClient, AzureCliCredential

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/scripts/superpmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,7 @@ def list_superpmi_collections_container_via_azure_api(path_filter=lambda unused:
"""

require_azure_storage_libraries()
from jitutil import ContainerClient, AzureCliCredential

superpmi_container_url = az_blob_storage_superpmi_container_uri

Expand Down Expand Up @@ -2356,6 +2357,7 @@ def upload_mch(coreclr_args):
"""

require_azure_storage_libraries(need_azure_identity=False)
from jitutil import BlobServiceClient

def upload_blob(file, blob_name):
blob_client = blob_service_client.get_blob_client(container=az_superpmi_container_name, blob=blob_name)
Expand Down