Right now there’s two ways to use snapcraft:
- Run snapcraft to build natively on the host machine - some features only work if the host is Ubuntu (based).
- Use cleanbuild which creates a temporary LXD container - the only supported workflow is equivalent to running “snapcraft” in a clean environment where everything except for the resulting .snap is discarded afterwards.
I’m introducing a third option:
- Allow executing all snapcraft commands in a persistent LXD container that is automatically created and mounts the project folder instead of using a one-off tarball.
- The host isn’t altered in any way and it doesn’t matter if it’s Ubuntu or something else.
- Iterative development becomes feasible even if the container is on another machine in the cloud.
- The use of containers is opaque, the workflow is the same as native.
For starters the new mode is hidden behind an environment variable - eventually there will be a prompt to ask the user if a container should be used for everything.
SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft