Forum Discussion
Christoffer1740
Feb 06, 2024Copper Contributor
Post-job: Cache fails
In the pic above Iam trying to cache my yaml.lock file to reduce runtime and Iam using the azure devops docs to do that. The first Cache step seems to work fine and there is "a cache ...
Kidd_Ip
Mar 03, 2025MVP
Please referring this:
- Check Cache Configuration: Ensure that the cache configuration in your YAML file is correct. Verify that the key and path values are set correctly.
- Verify Agent Setup: Since you're using a self-hosted agent, make sure that GNU Tar and 7-zip are correctly installed and accessible. You can try running a simple tar command to check if it's working as expected.
- Increase Timeout: If the post-job step is timing out, consider increasing the timeout value for the Cache task. You can do this by adding a timeoutInMinutes property to the task configuration.
- Check Logs: Review the detailed logs for the Cache task to identify any specific error messages or codes. This can provide insights into what might be going wrong.
- Update Agent: Ensure that your self-hosted agent is up to date. Sometimes, updating the agent can resolve issues related to task execution.
- Use CacheV2: If you're not already using it, consider switching to the CacheV2 task, which might have improvements and bug fixes over the original Cache task.
Configure Cache task by YAML:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
path: '$(Pipeline.Workspace)/.yarn'
cacheHitVar: 'YarnCacheHit'
timeoutInMinutes: 20