Cache: Unable to find pipeline caching scopes

See original GitHub issue

Question, Bug, or Feature?
Type: Bug

Enter Task Name: CacheV2

Environment

  • Server - Azure Pipelines
  • Agent - Private: Windows Server 2016/1607, Agent 2.160.1

Issue Description

Receive an error “Unable to find pipeline caching scopes” when using Cache task.

azure-pipelines.yml:

...
stages:
- stage: Test
  jobs:
  - deployment: test
    pool: default
    environment: Test
    variables:
      NPM_CONFIG_CACHE: $(Pipeline.Workspace)/.npm
    strategy:
      runOnce:
        deploy:
          steps:
          ...
          - task: Cache@2
            displayName: Cache NPM
            inputs:
              key: 'npm | $(Agent.OS) | package-lock.json'
              path: $(NPM_CONFIG_CACHE)
          ...

Error logs

2019-12-02T21:45:53.7630220Z ##[debug]Evaluating condition for step: 'Cache NPM'
2019-12-02T21:45:53.7630992Z ##[debug]Evaluating: SucceededNode()
2019-12-02T21:45:53.7631158Z ##[debug]Evaluating SucceededNode:
2019-12-02T21:45:53.7631419Z ##[debug]=> True
2019-12-02T21:45:53.7631659Z ##[debug]Result: True
2019-12-02T21:45:53.7631868Z ##[section]Starting: Cache NPM
2019-12-02T21:45:53.7778695Z ==============================================================================
2019-12-02T21:45:53.7778813Z Task         : Cache
2019-12-02T21:45:53.7778891Z Description  : Cache files between runs
2019-12-02T21:45:53.7778956Z Version      : 2.0.0
2019-12-02T21:45:53.7779031Z Author       : Microsoft Corporation
2019-12-02T21:45:53.7779098Z Help         : https://aka.ms/pipeline-caching-docs
2019-12-02T21:45:53.7779198Z ==============================================================================
2019-12-02T21:45:54.2686344Z Resolving key:
2019-12-02T21:45:54.2911166Z  - npm               [string]
2019-12-02T21:45:54.2911326Z  - Windows_NT        [string]
2019-12-02T21:45:54.3596092Z  - package-lock.json [file] --> 893737D82F56FFDA8A2051D6B31DBEAB33C876C5D9B31C506D8D716EB77537E6
2019-12-02T21:45:54.3649403Z Resolved to: npm|Windows_NT|3vo3/xQdDCzX1Gctv/MAub1nI4omrNHa2GRQxcPB1xE=
2019-12-02T21:45:54.3689378Z ##[debug]Processed: ##vso[task.settaskvariable variable=RESTORE_STEP_RAN;issecret=False;]true
2019-12-02T21:45:54.6912021Z ##[debug]Dedup parallelism: 192
2019-12-02T21:45:54.9065002Z Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session f86a0648-92a5-4856-9459-ddf876237258
2019-12-02T21:45:54.9404675Z Information, Getting a pipeline cache artifact with one of the following fingerprints:
2019-12-02T21:45:54.9404875Z Information, Fingerprint: `npm|Windows_NT|3vo3/xQdDCzX1Gctv/MAub1nI4omrNHa2GRQxcPB1xE=`
2019-12-02T21:45:57.5599778Z Information, ApplicationInsightsTelemetrySender correlated 2 events with X-TFS-Session f86a0648-92a5-4856-9459-ddf876237258
2019-12-02T21:45:57.5658821Z ##[error]Unable to find pipeline caching scopes.
2019-12-02T21:45:57.5659251Z ##[debug]Processed: ##vso[task.logissue type=error;]Unable to find pipeline caching scopes.
2019-12-02T21:45:57.5659930Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2019-12-02T21:45:57.5688850Z ##[debug]   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.PipelineCache.WebApi.PipelineCacheClient.GetPipelineCacheArtifactAsync(Fingerprint[] fingerprints, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.PipelineCache.WebApi.PipelineCacheClient.<>c__DisplayClass9_0.<<GetPipelineCacheArtifactAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreClientTelemetry.MeasureActionAsync[TResult](BlobStoreTelemetryRecord record, Func`1 actionAsync)
   at Microsoft.VisualStudio.Services.PipelineCache.WebApi.PipelineCacheClient.GetPipelineCacheArtifactAsync(Fingerprint[] fingerprints, CancellationToken cancellationToken, PipelineCacheTelemetryRecord cacheRecordOptional)
   at Agent.Plugins.PipelineCache.PipelineCacheServer.DownloadAsync(AgentTaskPluginExecutionContext context, Fingerprint[] fingerprints, String path, String cacheHitVariable, CancellationToken cancellationToken)
   at Agent.Plugins.PipelineCache.RestorePipelineCacheV0.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, Fingerprint fingerprint, Func`1 restoreKeysGenerator, String path, CancellationToken token)
   at Agent.Plugins.PipelineCache.PipelineCacheTaskPluginBase.RunAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
   at Agent.PluginHost.Program.Main(String[] args)
2019-12-02T21:45:57.5821100Z ##[section]Finishing: Cache NPM

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
VOVELEEcommented, Jan 20, 2020

It does not work in Releases, no.

Thanks. Are there any plans this task to be supported in Releases? It will be very useful for scheduled deployment jobs which always rely on the same dependencies. (e.g. PowerShell modules)

4reactions
fadnavistanmaycommented, Mar 11, 2020

As of now, there are no plans to make it available for Releases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AzureDevOps - Cache Task in Release Pipeline
I'm trying to use the Cache task ...
Read more >
Azure Pipelines cache task now fails with path that has trailing ...
Create and upload a new cache from this path, the cache task can work fine. Restore cache into this path, the cache task...
Read more >
Pipeline caching - Azure - Microsoft Learn
To ensure isolation between caches from different pipelines and different branches, every cache belongs to a logical container called a scope.
Read more >
Azure: Pipeline caching. In late 2019, Azure DevOps finally…
Gotcha #4. Caching has restricted scopes at a project, pipeline and branch level. Example: Let's say you added caching for Pipeline A on ......
Read more >
Caching in GitLab CI/CD
Change the value for cache: key in your .gitlab-ci.yml file. The next time the pipeline runs, the cache is stored in a different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found