Skip to content

Commit aedaeed

Browse files
authored
Update ml samples pipeline to retarget azuresdkartifacts (Azure#39491)
* update the default storage account being used to share packages to the ml samples repo * rewrite the blob uri from newly uploaded distribution to reference the public web access uri
1 parent 3391b16 commit aedaeed

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

eng/pipelines/trigger-ml-sample-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
timeoutInMinutes: 90
1919
variables:
2020
- name: StorageAccountName
21-
value: 'docsupport'
21+
value: 'azuresdkartifacts'
2222
- template: /eng/pipelines/templates/variables/globals.yml
2323

2424
pool:

scripts/devops_tasks/generate_ml_sample_update.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
from azure.storage.blob import BlobServiceClient
88
from azure.identity import AzurePowerShellCredential, ChainedTokenCredential, AzureCliCredential
99

10-
UPLOAD_PATTERN = "{build_id}/{filename}"
11-
DEFAULT_CONTAINER = os.getenv("BLOB_CONTAINER", "ml-sample-submissions")
12-
CONNECTION_STRING = os.getenv("BLOB_CONNECTION_STRING", None)
10+
UPLOAD_PATTERN = "python/distributions/ml-sample/{build_id}/{filename}"
11+
BLOB_CONTAINER = "$web"
1312

1413
TEST_INSTALL_TEMPLATE = """# <az_ml_sdk_test_install>
1514
{install_command}
@@ -38,7 +37,6 @@ def replace_test_install_command(content, targeted_urls):
3837
parser = argparse.ArgumentParser(
3938
description="This python script modifies build.sh files for the azure ml samples repository. Inputs are a "
4039
+ "folder containing the azure-ml whl, the root of a cloned azureml-samples repo, and an optional build id. "
41-
+ "Retrieves the necessary connection string from BLOB_CONNECTION_STRING."
4240
)
4341

4442
parser.add_argument(
@@ -77,7 +75,7 @@ def replace_test_install_command(content, targeted_urls):
7775
credential_chain = ChainedTokenCredential(AzureCliCredential(), AzurePowerShellCredential())
7876

7977
blob_service_client = BlobServiceClient(account_url=f"https://{args.storage_account_name}.blob.core.windows.net", credential=credential_chain)
80-
container_client = blob_service_client.get_container_client(DEFAULT_CONTAINER)
78+
container_client = blob_service_client.get_container_client(BLOB_CONTAINER)
8179
to_be_installed = []
8280

8381
whls = glob.glob(target_glob)
@@ -90,7 +88,12 @@ def replace_test_install_command(content, targeted_urls):
9088

9189
with open(whl, "rb") as data:
9290
result = blob_client.upload_blob(data=data, overwrite=True)
93-
to_be_installed.append(blob_client.primary_endpoint)
91+
url = blob_client.primary_endpoint
92+
93+
# replace the original blob uri with the static website style uri
94+
# this is such that the install command can be invoked directly without needing to authenticate to the storage account
95+
url = url.replace(f"https://{args.storage_account_name}.blob.core.windows.net/%24web/", f"https://{args.storage_account_name}.z5.web.core.windows.net/")
96+
to_be_installed.append(url)
9497
else:
9598
print("Operated on non-whl file or folder {}".format(whl))
9699
exit(1)

0 commit comments

Comments
 (0)