Wishlist: Make cache key elements explicit
See original GitHub issueType: Feature Task Name: CacheBeta@1
Environment
Azure Pipelines - but this is a feature wishlist item, not a bug, Hosted agent
Issue Description
The current method of specifying a cache key has several issues.
First, it’s very easy to generate invalid YAML with it, just by wanting to put literal strings first:
key: "v1" | some-file.txt
This is invalid because parsers see the double quote and assume that they value will be entirely quoted. There is a disgusting workaround, of course:
key: '"v1" | some-file.txt'
But this is a real eyesore!
The other issue is that we have to guess whether the task will interpret any given element as a path or not.
I propose a more explicit system for specifying the key where each key element is an array element:
key:
- literal: v1
- path: some-file.txt
- literal: some-file-name
This is entirely unambiguous and doesn’t require any odd double-quoting. As a bonus, this makes it trivial to introduce new types of key elements in the future if that is ever needed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
You will pry Emacs from my cold, dead hands, which will be curled into some unnatural Ctrl-Alt-Shift-$Letter shape.
We do not have a good way to implement this in YAML without introducing further syntactic complexity.