From 5e8fcda24a9463a988ccdb94ae081f62c0959c1b Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Mon, 23 Nov 2020 14:43:12 -0800 Subject: [PATCH] Build docker image cache fixes. (#5902) Fix Python 3.5 compatibility issue in tools/ci_build/get_docker_image.py. Fix line endings in tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml. --- tools/ci_build/get_docker_image.py | 13 +++---- ...lean-build-docker-image-cache-pipeline.yml | 38 +++++++++---------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tools/ci_build/get_docker_image.py b/tools/ci_build/get_docker_image.py index 923881dfd7..9522f8b50e 100755 --- a/tools/ci_build/get_docker_image.py +++ b/tools/ci_build/get_docker_image.py @@ -77,13 +77,12 @@ def update_hash_with_directory(dir_file_info: FileInfo, hash_obj): hash_obj.update(file_info_str(dir_file_info).encode()) files, dirs = [], [] - with os.scandir(dir_file_info.path) as dir_it: - for dir_entry in dir_it: - file_info = FileInfo(dir_entry.path, dir_entry.stat().st_mode) - if dir_entry.is_dir(): - dirs.append(file_info) - elif dir_entry.is_file(): - files.append(file_info) + for dir_entry in os.scandir(dir_file_info.path): + file_info = FileInfo(dir_entry.path, dir_entry.stat().st_mode) + if dir_entry.is_dir(): + dirs.append(file_info) + elif dir_entry.is_file(): + files.append(file_info) def file_info_key(file_info: FileInfo): return file_info.path diff --git a/tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml b/tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml index e65394c7c6..86659c84c1 100644 --- a/tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml @@ -1,19 +1,19 @@ -jobs: -- job: Clean_Build_Docker_Image_Cache - - pool: - vmImage: 'ubuntu-18.04' - - timeoutInMinutes: 10 - - steps: - - task: AzureCLI@2 - inputs: - azureSubscription: 'AIInfraBuild' - scriptType: 'bash' - scriptLocation: 'inlineScript' - inlineScript: | - tools/ci_build/clean_docker_image_cache.py \ - --container-registry $(buildcache-container-registry) \ - --log-storage-account $(buildcache-log-storage-account) \ - --log-storage-container $(buildcache-log-storage-account-container) +jobs: +- job: Clean_Build_Docker_Image_Cache + + pool: + vmImage: 'ubuntu-18.04' + + timeoutInMinutes: 10 + + steps: + - task: AzureCLI@2 + inputs: + azureSubscription: 'AIInfraBuild' + scriptType: 'bash' + scriptLocation: 'inlineScript' + inlineScript: | + tools/ci_build/clean_docker_image_cache.py \ + --container-registry $(buildcache-container-registry) \ + --log-storage-account $(buildcache-log-storage-account) \ + --log-storage-container $(buildcache-log-storage-account-container)