question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation unclear on how to specify multiple `restore-keys`

See original GitHub issue

Documentation at https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows states that restore-keys is “An ordered list of alternative keys to use for finding the cache if no cache hit occurred for key.”. However, if I supply an ordered list for restore-keys in a job, I get an error:

      - name: Cache CVE database for OWASP dependency-check
        uses: actions/cache@v3
        with:
          path: dependency-check-data
          key: "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
          restore-keys:
            - "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
            - "${{ runner.os }}-dependency-check-data-"

Invalid workflow file: .github/workflows/maven.yml#L37 The workflow is not valid. .github/workflows/maven.yml (Line: 37, Col: 13): A sequence was not expected

If this is not how an ordered list should be specified, a more detailed explanation in the documentation would be useful.

The example that does specify multiple restore-keys does it as a multi-line string, but when I try this the entire string appears to be treated as a single key?

      - name: Cache CVE database for OWASP dependency-check
        uses: actions/cache@v3
        with:
          path: dependency-check-data
          key: "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
          restore-keys: |
            ${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}
            ${{ runner.os }}-dependency-check-data-

Debug output on post-step:

##[debug]Evaluating: format('{0}-dependency-check-data-{1}
##[debug]{2}-dependency-check-data-
##[debug]', runner.os, hashFiles('**/nvdcve-1.1-modified.meta'), runner.os)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '{0}-dependency-check-data-{1}
##[debug]{2}-dependency-check-data-
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating runner:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'os'
##[debug]..=> 'Linux'
##[debug]..Evaluating hashFiles:
##[debug]....Evaluating String:
##[debug]....=> '**/nvdcve-1.1-modified.meta'
##[debug]Search root directory: '/home/runner/work/********/********'
##[debug]Search pattern: '**/nvdcve-1.1-modified.meta'
##[debug]Starting process:
##[debug]  File name: '/home/runner/runners/2.289.2/externals/node16/bin/node'
##[debug]  Arguments: '"/home/runner/runners/2.289.2/bin/hashFiles"'
##[debug]  Working directory: '/home/runner/work/********/********'
##[debug]  Require exit code zero: 'False'
##[debug]  Encoding web name:  ; code page: ''
##[debug]  Force kill process on cancellation: 'False'
##[debug]  Redirected STDIN: 'False'
##[debug]  Persist current code page: 'False'
##[debug]  Keep redirected STDIN open: 'False'
##[debug]  High priority process: 'False'
##[debug]Updated oom_score_adj to 500 for PID: 2010.
##[debug]Process started with process id 2010, waiting for process exit.
##[debug]Match Pattern: **/nvdcve-1.1-modified.meta
##[debug]::debug::followSymbolicLinks 'false'
##[debug]::debug::followSymbolicLinks 'false'
##[debug]::debug::implicitDescendants 'true'
##[debug]::debug::omitBrokenSymbolicLinks 'true'
##[debug]::debug::Search path '/home/runner/work/********/********'
##[debug]/home/runner/work/********/********/dependency-check-data/nvdcache/nvdcve-1.1-modified.meta
##[debug]Found 1 files to hash.
##[debug]Hash result: 'a65b3939924c996fc1daedc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213'
##[debug]undefined
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Finished process 2010 with exit code 0, and elapsed time 00:00:00.2069719.
##[debug]..=> 'a9394c996fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213'
##[debug]..Evaluating Index:
##[debug]....Evaluating runner:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'os'
##[debug]..=> 'Linux'
##[debug]=> 'Linux-dependency-check-data-a65b5739924c996fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b4ff37333213
##[debug]Linux-dependency-check-data-
##[debug]'
##[debug]Result: 'Linux-dependency-check-data-a65b573939924c9fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213
##[debug]Linux-dependency-check-data-
##[debug]'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vsvipulcommented, Apr 8, 2022

Fixed the docs. @fransf-wtax Thank you for opening. Thanks to @lucascosti for working on it.

0reactions
lucascosticommented, Apr 8, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Caching dependencies to speed up workflows - GitHub Docs
restore-keys allows you to specify a list of alternate restore keys to use when there is a cache miss on key . You...
Read more >
To use GitHub action cache what do I set as the value for the ...
I'm allowing the build to run on ubuntu-latest and I use npm to do my installs and run build. Can anyone tell me,...
Read more >
Upspin Security
The basic idea is to choose a random number as an encryption key K, ... A user may “restore” keys to multiple devices...
Read more >
Odoo development Documentation - Read the Docs
Odoo development Documentation, Release master. In short, you set normal Many2one field (vehicle_id in the example) in a one model (doesn't ...
Read more >
IBM Spectrum Protect: Server Messages and Error Codes
IBM Spectrum Protect™ is an enterprise-wide storage management application for the network. It provides automated storage management services to multi-vendor.
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