Forum Discussion

Christoffer1740's avatar
Christoffer1740
Copper Contributor
Feb 06, 2024

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 miss" and then it runs yarn install.

But the Error comes in the Post-job: 

Its taking 10 minutes and then timing out i think.

--Note--

Iam using a self hosted agent here and i added GNU Tar and 7-zip and restarted the agent.

--End Note--

I dont know if the above had something to do with my problem. But it didnt work before or after.

 

Can anyone help out here?

  • 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
    

     

Resources