Nov 13 2023
11:10 AM
- last edited on
Mar 05 2024
05:00 PM
by
TechCommunityAP
Nov 13 2023
11:10 AM
- last edited on
Mar 05 2024
05:00 PM
by
TechCommunityAP
Below is my code:
trigger:
- main
pool: default
jobs:
- job: CacheHelloFile
displayName: 'Cache hello.txt'
steps:
- task: Cache@2
displayName: 'Restore Cache'
inputs:
key: 'hello-file | "$(Agent.OS)"'
path: $(Agent.BuildDirectory)/hello-cache
cacheHitVar: 'CacheRestored'
- script: |
if [ "$(CacheRestored)" != "true" ]; then
mkdir $(Agent.BuildDirectory)/hello-cache
echo "Hello, World!" > $(Agent.BuildDirectory)/hello-cache/hello.txt
fi
displayName: 'Create hello.txt'
- task: Cache@2
displayName: 'Cache hello.txt'
inputs:
key: 'hello-file | "$(Agent.OS)"'
path: $(Agent.BuildDirectory)/hello-cache
If I am running the above code twice, then on the second run, I am getting cache hit but it is not automatically skipping the task of creating "hello-cache" folder and "hello.txt" file and also after the cache hit why is it showing "expected size to be downloaded: 0.0MB" if there is some content present in the cache?
And where does the cache stored in the self hosted agent(linux) ?
I have attached the log image as well.
Nov 13 2023 04:42 PM