Azure-pipelines-tasks: Cache: Unable to find pipeline caching scopes

Created on 2 Dec 2019  路  8Comments  路  Source: microsoft/azure-pipelines-tasks

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
ArtifactsCore PipelineCaching bug

Most helpful comment

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)

All 8 comments

Hmm odd! @jabberwik Did this start happening all of a sudden or did some change trigger this?

I have not gotten this task to work at any point, even on previous versions while it was in preview. To be fair, I haven't tried it in a great diversity of pipeline configurations either. I couldn't find this error message in the code anywhere, so I'm not sure how far upstream this is getting thrown?

I am experiencing similar issues on ubuntu-latest as well.

Btw the same task works as a charm but when I don't use stages and environments. @johnterickson , @fadnavistanmay have you tested the task in such scenario?

It does not work in Releases, no.

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)

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

I'm hitting the exact same error as the OP. I'm using a similar (YAML-only) pipeline with a - deployment: job and an environment:. Similarly to @VOVELEE I'm only experiencing this since I've changed the job to a deployment job and used an environment. One peculiar thing though is: I'm having this stage in a template which is used by multiple pipelines and one works while another one doesn't (I've not tested more than two of the pipelines).

@johnterickson @fadnavistanmay are you talking about Classic Release Pipelines or Deployment Jobs in multi-stage YAML Pipelines? According to the docs it should work for the latter:

Caching is currently supported in CI and deployment jobs, but not classic release jobs.

Was this page helpful?
0 / 5 - 0 ratings