Expose parameters in clean build Docker image cache build. (#5941)

Expose some parameters in the clean build Docker image cache build. In particular, whether to do a dry-run and the lifetime of unused cache images.
This commit is contained in:
Edward Chen 2020-11-25 14:15:54 -08:00 committed by GitHub
parent 31a6be3d67
commit 7546d251e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View file

@ -43,7 +43,7 @@ def parse_args():
"--log-storage-account", required=True,
help="The storage account name.")
parser.add_argument(
"--log-storage-container", required=True,
"--log-storage-account-container", required=True,
help="The storage account container name.")
parser.add_argument(
"--log-storage-path-pattern", default="*.json",
@ -179,7 +179,7 @@ def main():
with tempfile.TemporaryDirectory() as tmp_dir:
log_paths = download_logs(
args.log_storage_account,
args.log_storage_container,
args.log_storage_account_container,
args.log_storage_path_pattern,
tmp_dir,
args.az_path)

View file

@ -1,3 +1,17 @@
parameters:
- name: DryRun
type: boolean
default: false
displayName: "Whether to do a dry-run and not actually clean up the cache."
- name: CacheLifetimeDays
type: number
default: 7
displayName: "The lifetime of an unused image in the cache, in days."
variables:
${{ if eq(parameters.DryRun, true) }}:
DryRunArgument: "--dry-run"
jobs:
- job: Clean_Build_Docker_Image_Cache
@ -14,6 +28,8 @@ jobs:
scriptLocation: 'inlineScript'
inlineScript: |
tools/ci_build/clean_docker_image_cache.py \
${{ variables.DryRunArgument }} \
--container-registry $(buildcache-container-registry) \
--log-storage-account $(buildcache-log-storage-account) \
--log-storage-container $(buildcache-log-storage-account-container)
--log-storage-account-container $(buildcache-log-storage-account-container) \
--cache-lifetime-days ${{ parameters.CacheLifetimeDays }}