Unable to run Azure pipeline "A task is missing. The pipeline references a task called 'Cache'

Viewed 8277

I am setting up my fork of a Github project with the azure_pipeline.yaml configuration. This seems to work just fine for everyone else in the community but when I setup the pipeline it gives me the following exception:

A task is missing. The pipeline references a task called 'Cache'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com. (Task version 2, job 'compile_ci_build', step ''.)
A task is missing. The pipeline references a task called 'Cache'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com. (Task version 2, job 'test_ci_build', step ''.)
A task is missing. The pipeline references a task called 'Cache'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com. (Task version 2, job 'e2e_ci_build', step ''.)

Specifically,

[UPDATE]

I modified the jobs-templates.yml and commented out all steps with Cache@2 and it runs fine.

4 Answers

Was able to get this working eventually.

Apparently for my Azure account. I am not allow to use Cache@2. changing all lines with

- task: Cache@2

to

- task: CacheBeta@1

resolves all my problem.

By design, Azure DevOps does not automatically make all tasks available when you run a pipeline.

You have to add them manually as part of the pipeline.

'cache' is one such task.

I'm doing this in classic gui (non-yaml) mode as I find it easier to search for things But what you do is in your pipeline add a new task and in the task search box type 'cache'.

This will bring up the task. Click Add to include it in the pipeline.

For more information on this I would recommend reading:

https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops

I do not see you added cache task in your pipeline from your git repo.

It should look like the example here:

variables:
  YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn

steps:
- task: Cache@2
  inputs:
    key: 'yarn | "$(Agent.OS)" | yarn.lock'
    restoreKeys: |
       yarn | "$(Agent.OS)"
       yarn
    path: $(YARN_CACHE_FOLDER)
  displayName: Cache Yarn packages

- script: yarn --frozen-lockfile

Source

I was getting the same error A task is missing. The pipeline references a.. on one of azure task, PublishCucumberReport@1 . I resolved it by visiting https://marketplace.visualstudio.com/ and going to the task and then clicking on get free button, which installs it on your pipeline

Related