Use today's cache only (#14120)

### Description
Add date value of today into the cache key.

### Motivation and Context
Microsoft-host agent has only 10GB for build.
To limit cache size, pipeline only use cache generated today.
This commit is contained in:
Yi Zhang 2023-01-04 17:48:52 +08:00 committed by GitHub
parent bdeba4e31c
commit f864b54393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,7 @@ jobs:
variables:
skipComponentGovernanceDetection: true
CCACHE_DIR: $(Pipeline.Workspace)/ccache
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
pool: Linux-CPU-2019
steps:
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
@ -42,12 +43,12 @@ jobs:
- task: Cache@2
inputs:
key: '"ccache" | "$(Build.SourceBranch)" | "$(Build.SourceVersion)"'
key: '"$(TODAY)" | "$(Build.SourceBranch)" | "$(Build.SourceVersion)"'
path: $(CCACHE_DIR)
cacheHitVar: CACHE_RESTORED
restoreKeys: |
"ccache" | "$(Build.SourceBranch)"
"ccache"
"$(TODAY)" | "$(Build.SourceBranch)"
"$(TODAY)" |
displayName: Cach Task
- script: |