-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat(daemon): Add support for PEBBLE_COPY_ONCE
.
#352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. However, do we really need a 3rd party dependency for this? Given what we need to do, it's quite a large one (1500 LoC and significant API surface area). We only need to copy files, and it doesn't even need to be recursive, right? (Though that's easy with filepath.WalkDir
if we need to.) Here's an implementation of (the upcoming) fs.CopyFS
for reference: golang/go#62484 (comment) -- not many more lines of code than calling the 3rd party lib. :-) Happy to discuss voice if you disagree.
Regarding testing, I'd be happy with manual testing for this PR, until we get better integration/spared tests -- we don't have any for the rest of the pebble run
behaviour, so it's no worse. :-) That said, most of this is just file/dir copying, which is easily go test
able, right?
One other thought: we should document this in README.md somewhere. Or maybe in the help text? |
PEBBLE_INIT_FROM
.PEBBLE_COPY_ONCE
.
`PEBBLE_COPY_ONCE` allows `pebble run` to copy layers and state from another directory when seeding a new `PEBBLE` directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of minor comments, plus a request for a test (of maybeCopyPebbleDir
, not of cmd_run
).
Co-authored-by: Ben Hoyt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just requesting a couple of minor test changes, and then I'll merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me, thanks!
$PEBBLE_COPY_ONCE
environment variable allowspebble run
to copy layers and state from another directory when seeding a new$PEBBLE
directory.The rationale for this change is to allow OCI images to specify existing layers in the default
$PEBBLE
location. Then at runtime, be able to runpebble
with a different$PEBBLE
directory. This allowspebble
to be run as a non-root user or run on a read-only root filesystem.Issue #351 outlines that
pebble run
has no unit or integration tests. A test should be performed manually for now.Manual QA is as follows:
PEBBLE_COPY_ONCE=~/dir/with-existing-state PEBBLE=~/dir/with-no-state pebble run
~/dir/with-no-state/layers
.pebble run
and check that it doesn't crash.PEBBLE_COPY_ONCE
can be set to a non-existing directory withpebble run
passed--create-dirs
JU090
JUJU-5435