Skip to content

Commit

Permalink
use env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
peixuanzuo committed Oct 20, 2022
1 parent fd08d3a commit c3e82c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions orttraining/tools/ci_test/download_azure_blob_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ def _check_file_sha256_digest(path, expected_digest):
def main():
parser = argparse.ArgumentParser(description="Downloads an Azure blob archive.")
parser.add_argument("--azure_blob_url", required=True, help="The Azure blob URL.")
parser.add_argument("--azure_blob_sas_token", type=str, default="", help="The Azure blob SAS Token")
parser.add_argument("--target_dir", required=True, help="The destination directory.")
parser.add_argument("--archive_sha256_digest", help="The SHA256 digest of the archive. Verified if provided.")
args = parser.parse_args()

with tempfile.TemporaryDirectory() as temp_dir, get_azcopy() as azcopy_path:
archive_path = os.path.join(temp_dir, "archive.zip")
print("Downloading archive from '{}'...".format(args.azure_blob_url))

azure_blob_url = args.azure_blob_url
if args.azure_blob_sas_token != "":
azure_blob_url = azure_blob_url + "?" + args.azure_blob_sas_token
azure_blob_sas_token = os.getenv("AZURE_BLOB_SAS_TOKEN", None)
if azure_blob_sas_token and azure_blob_sas_token != "":
azure_blob_url = azure_blob_url + "?" + azure_blob_sas_token

_download(azcopy_path, azure_blob_url, archive_path)
if args.archive_sha256_digest:
_check_file_sha256_digest(archive_path, args.archive_sha256_digest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
# update these if the E2E test data changes
- script: |-
export AZURE_BLOB_SAS_TOKEN="$(onnxruntimetestdata-storage-training-container-sas-token)"
python orttraining/tools/ci_test/download_azure_blob_archive.py \
--azure_blob_url https://onnxruntimetestdata.blob.core.windows.net/training/onnxruntime_training_data.zip \
--azure_blob_sas_token "$(onnxruntimetestdata-storage-training-container-sas-token)" \
--target_dir training_e2e_test_data \
--archive_sha256_digest B01C169B6550D1A0A6F1B4E2F34AE2A8714B52DBB70AC04DA85D371F691BDFF9
displayName: 'Download onnxruntime_training_data.zip data'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ jobs:
- task: CmdLine@2
inputs:
script: |-
export AZURE_BLOB_SAS_TOKEN="$(onnxruntimetestdata-storage-training-container-sas-token)"
python orttraining/tools/ci_test/download_azure_blob_archive.py \
--azure_blob_url https://onnxruntimetestdata.blob.core.windows.net/training/onnxruntime_training_data.zip \
--azure_blob_sas_token "$(onnxruntimetestdata-storage-training-container-sas-token)" \
--target_dir training_e2e_test_data \
--archive_sha256_digest B01C169B6550D1A0A6F1B4E2F34AE2A8714B52DBB70AC04DA85D371F691BDFF9
condition: and(succeededOrFailed(), eq(variables.onnxruntimeBuildSucceeded, 'true')) # ensure all tests are run when the build successed
Expand Down

0 comments on commit c3e82c1

Please sign in to comment.