$PEBBLE_COPY_ONCE environment variable allows pebble 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 run pebble with a different $PEBBLE directory. This allows pebble 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:
Create a directory, with a layers subdirectory and valid testing layers (e.g. ~/dir/with-existing-state)
Create another empty directory. (e.g. ~/dir/with-no-state)
PEBBLE_COPY_ONCE=~/dir/with-existing-state PEBBLE=~/dir/with-no-state pebble run
Check all the layers are loaded.
Check all the layers are copied.
Modify a layer in ~/dir/with-no-state/layers.
Restart pebble run and check that it doesn't crash.
Check that the modifications are preserved after the restart (PEBBLE_COPY_ONCE is only for an empty directory).
Check PEBBLE_COPY_ONCE can be set to a non-existing directory with pebble run passed --create-dirs
$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