onnxruntime/tools/ci_build/github/azure-pipelines/clean-build-docker-image-cache-pipeline.yml

52 lines
1.4 KiB
YAML

parameters:
- name: DryRun
type: boolean
default: false
displayName: "Do a dry-run and do not remove any images"
- name: CacheHistoryDays
type: number
default: 4
displayName: "The length of the cache history in days"
- name: CacheMinAccessCount
type: number
default: 5
displayName: "The minimum access count over the cache history"
variables:
${{ if eq(parameters.DryRun, true) }}:
DryRunArgument: "--dry-run"
jobs:
- job: Clean_Build_Docker_Image_Cache
pool:
vmImage: 'ubuntu-20.04'
timeoutInMinutes: 30
steps:
- checkout: self
submodules: false
fetchDepth: 1
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
addToPath: true
architecture: 'x64'
displayName: "Use Python 3.9"
- task: AzureCLI@2
inputs:
azureSubscription: 'AIInfraBuild'
scriptType: 'bash'
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-account-container $(buildcache-log-storage-account-container) \
--cache-history-days ${{ parameters.CacheHistoryDays }} \
--cache-min-access-count ${{ parameters.CacheMinAccessCount }}
displayName: "Clean image cache"