The SNAPCRAFT_BUILD_ENVIRONMENT environment variable

Synopsis

Handle the chosen build provider.

Description

To determine the build environment, SNAPCRAFT_BUILD_ENVIRONMENT is retrieved from the environment and used to determine the build provider. An environment can be forced by use of force_provider during initialization. The default environment is multipass unless the snapcraft is run inside docker for which the preferred environment will be to use the host.

Valid values are:

  • host: the host will drive the build.
  • managed-host: the host will drive the build, but work best for discardable build providers.
  • multipass: a vm driven by multipass will be created to drive the build.

Note

Previously the value lxd is supported but was dropped in Snapcraft 3.0, as a workaround you can create an LXD container manually and set the SNAPCRAFT_BUILD_ENVIRONMENT environment variable to host in the container.

Also refer: Bug #1809481 “Feature Request: Re-implement the LXD build environment” : Bugs : Snapcraft

Relevant snapcraft source

Last updated 1 year, 9 months ago. Help improve this document in the forum.