-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting id of mount #12
Comments
Varying the Though, on second thought, might be handleable w/o the needing to actually vary the |
@AkihiroSuda , after the recent refactor, do you this suppose this something that could more easily added? I'd be willing to take a stab at it, but my typescript chops are a bit rusty, Just wanted to first ask if this was on someone else's rode-map already. My use case is that I'm using this action for persisting bulkit's internal mount cache for CI jobs that build and push to a image registry. Those images in turn are use by developers via |
If we want to share the same - name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"var-cache-apt": "/var/cache/apt",
"var-lib-apt": "/var/lib/apt"
}
cache-id: cach1
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
Potentially #21 can be reworked for this. |
@aminya , admittedly that would probably work for fine my own use case. And if did end up using multiple cache mounts mounts, I suppose I could go back to what I did before like with However, given the motivation of the refactor, it might be worth thinking extending the json so folks could pass in arbitrary fields, even as buildkit itself evolves, or as complexity of the end users cache mounts increases. E.g. - name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"var-cache-apt": {"id": "foo", "target": "/var/cache/apt", "readonly": "", "sharing": "", "mode": ""},
"alternatively": "--mount=type=cache,id=foo,target='/foo space bar/spam',mode=,uid=1000",
"var-lib-apt": "/var/lib/apt"
}
cache-id: cach1
skip-extraction: ${{ steps.cache.outputs.cache-hit }} Admittedly, I don't know of the full ramifications that also tweaking the Some would make less sense to expose such as |
The beauty of the current JSON approach I took is that it is extensible and type-safe. So we can make the cache map object more complex to support any arbitrary value, and default to the target path if it is only a string. type TargetPath = string
type CacheOptions = TargetPath | {
target: TargetPath
id?: string
readonly?: boolean
// etc
}
type CacheMap = Record<string, CacheOptions> What are the known cache options that could be used as the properties? Could you send the documentation on these properties? Alternatively, instead of making the options type-safe, we can accept arbitrary properties, and expect the user to use valid props. |
I made a pull request (#12) to support any arbitrary options for |
When using docker --mount=type=cache, there is an optional argument of
id
. This can be used to cache the same directory under a different volume to prevent collisions. I'm not sure that it makes a ton of sense to use in this context, but when I was following a guide they provided an id for the mount. However, this action does not accept an id. This was confusing because it led to this action not working (as its injection/extraction steps dont set the id, so it wont match during the real run). I'm not sure how important it is to add, but could be nice for consistency and preventing confusionThe text was updated successfully, but these errors were encountered: