There are two methods for building snaps on Canonical-hosted servers, and both are available to every snap publisher:
Build from GitHub
This is a build service integrated into every publisher’s Developer Account on snapcraft.io. It works by linking a snap’s GitHub repository with our Launchpad build service. See Build from GitHub for further details.
snapcraft remote-buildcommand offloads the snap build process to the Launchpad build farm, pushing the potentially multi-architecture snap back to your machine. See below for further details.
With remote build, you can build snaps for hardware you don’t have access to and free up your local machine for other tasks.
Supported build architectures are: amd64, arm64, armhf, i386, ppc64el and s390x.
Prospective snaps need to be open source, as the code will be publicly available, and you’ll need a Launchpad account.
Build architectures can be defined within a snap’s snapcraft.yaml using the architectures keyword. To target all architectures, for example, use the following:
architectures: - build-on: s390x - build-on: ppc64el - build-on: arm64 - build-on: armhf - build-on: amd64 - build-on: i386
If architectures is not defined within snapcraft.yaml, target architectures can be specified at build-time with the
$ snapcraft remote-build --build-on=amd64,arm64
If no architecture is specified, remote build will default to
amd64. For more details on how snaps handle build and run architectures, see Architectures.
Using remote build
To instantiate a remote build, use the
remote-build argument with snapcraft:
$ snapcraft remote-build
You are first asked to confirm that you’re happy for your local project to be transferred to a remote build server and become publicly available:
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Skip the above by passing
--launchpad-accept-public-uploadto snapcraft as an extra argument.
Next, you’re asked for your Launchpad username before being presented with an authorisation URL. Copy the URL into a web browser to allow Snapcraft to access your Launchpad account.
The URL prompt only occurs the first time you use remote build from an new machine. Access can be enabled until you disable it, for one hour, for one day, or for one week. Alternatively, you can use the same link to disable access completely.
Skip the username prompt by passing
--launchpad-user <username>to snapcraft as an extra argument.
The remote build process will now start.
Example remote-build output
The following is typical output for a successful single architecture remote build:
Sending build data to Launchpad... (https://<username>:<token>@git.launchpad.net/<username>/+git/snapcraft-hello-22ef03/) If interrupted, resume with: 'snapcraft remote-build --recover' Building snap package for amd64. This may take some time to finish. Build status as of 2019-11-29 11:44:50.017631: arch=amd64 state=Needs building Build status as of 2019-11-29 11:45:20.215169: arch=amd64 state=Currently building Build status as of 2019-11-29 11:45:50.472400: arch=amd64 state=Currently building Build status as of 2019-11-29 11:46:20.968422: arch=amd64 state=Currently building Build status as of 2019-11-29 11:46:51.206255: arch=amd64 state=Uploading build Build status as of 2019-11-29 11:47:21.871779: arch=amd64 state=Uploading build Build status as of 2019-11-29 11:47:52.197560: arch=amd64 state=Successfully built Snapped hello_2.10_amd64.snap Build log available at 'hello_amd64.1.txt' Build complete.
Snapcraft waits for the build to complete before retrieving the resultant snaps, and build logs, and placing them all in your local build directory. Build time depends on the target architecture, the package size, and the availability of builder back-ends.
If your build is interrupted for any reason, it can be resumed with the
$ snapcraft remote-build --recover
Monitor a build
Command output from remote build will show build progress for each architecture. You can retrieve the same output from another terminal session within the build directory using the
$ snapcraft remote-build --status
To see build progress outside of your command line session, open the following URL in a web browser: https://launchpad.net/~/+snaps.
From the snap packages web page, select the build data for the job you want to monitor. The specific name for a job is part of the output from the remote-build command, such as
Selecting the build page for a build allows you to monitor the build progress for each architecture, and access the completed build log for each.
The Launchpad build page, and the remote build, is removed after a build terminates, regardless of whether the build was successful or not.
Last updated 1 year, 1 month ago.