I want to configure the 'Cache' task in Azure Pipelines to only restore the cache and not the save the cache and vice versa? Is there any workaround for this scenario?
I read the documentation regarding caching but didn't find any solution
I want to configure the 'Cache' task in Azure Pipelines to only restore the cache and not the save the cache and vice versa? Is there any workaround for this scenario?
I read the documentation regarding caching but didn't find any solution
Copyright © 2021 Jogjafile Inc.
The cache task is already doing this way.
It evaluates the
key
to identifier for the cache you want to restore or save,when the key is same
, there's acachehit
, it will restore the cache, and at the endPost-job: Cache" step
, it reports:Cache with fingerprint xxxx already exists
, and will skip saving.When
key is changed
, it will evaluaterestoreKeys
in cache task, when it's met, it'sa partial cache hit
, it will also restore the cache content, but at endPost-job: Cache" step
, theCache with fingerprint
value is differnet, it will still save the content.You can remove
restorekeys
in cache task, so that it will only evaluate for key value to determine restore or not.If both
key
andrestorekeys
value is NOT met, it'scache miss
, it will NOT restore the cache content, and save content at lastPost-job: Cache" step
.More details please check doc Pipeline caching.