LXD is a modern, secure and powerful system container and virtual machine manager.
This is the snap packaging repository that is used to build the LXD snap. The LXD repository is available here.
Local builds require the LXD snap to be installed as snapcraft creates a container to use as build environment. Here's how to do a local build for the native architecture:
snapcraft packTo build the snap for multiple architectures, Launchpad builders can be used.
They are available for various architectures (amd64, armhf, arm64, ppc64el, riscv64 and s390x) and you can ask for multiple to be built in parallel. Here's how to build for both amd64 and arm64:
snapcraft remote-build --launchpad-accept-public-upload --build-for amd64,arm64The .github/actions/lp-snap-build composite action sets up SSH access to Launchpad and clones the snap packaging repository in preparation for pushing a build trigger commit.
It also installs the lxd-snapcraft helper tool, which can read and update version and source-commit fields in snapcraft.yaml.
| Input | Required | Description |
|---|---|---|
ssh-key |
yes | Private ed25519 SSH key for Launchpad access and commit signing |
| Variable | Description |
|---|---|
SSH_AUTH_SOCK |
Path to the SSH agent socket |
REPO |
URL of the Launchpad snap packaging repository |
BRANCH |
Branch to clone from the Launchpad repository |
PACKAGE |
Name of the snap package (used for the clone directory ~/${PACKAGE}-pkg-snap-lp) |
jobs:
snap:
runs-on: ubuntu-24.04
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
PACKAGE: "lxd"
REPO: "git+ssh://lxdbot@git.launchpad.net/~lxd-snap/lxd"
BRANCH: ${{ github.ref_name }}
steps:
- uses: actions/checkout@...
with:
persist-credentials: false
# XXX: from this point onwards in this **specific job**, the private SSH key is
# available through the SSH_AUTH_SOCK environment variable.
- uses: canonical/lxd-pkg-snap/.github/actions/lp-snap-build@latest-edge # zizmor: ignore[unpinned-uses]
with:
ssh-key: ${{ secrets.LAUNCHPAD_LXD_BOT_KEY }} # zizmor: ignore[secrets-outside-env]
- name: Trigger Launchpad snap build
run: |
localRev="$(git rev-parse HEAD)"
export PATH="/home/runner/go/bin:$PATH"
ver=($(lxd-snapcraft -package "${PACKAGE}" -get-version -file ~/"${PACKAGE}-pkg-snap-lp/snapcraft.yaml"))
rsync -a --exclude .git --delete . ~/"${PACKAGE}-pkg-snap-lp"/
cd ~/"${PACKAGE}-pkg-snap-lp"
lxd-snapcraft -package "${PACKAGE}" -set-version "${ver[0]}" -set-source-commit "${ver[1]}"
git add --all
git commit --quiet -s --allow-empty -m "Automatic upstream build (${BRANCH})" -m "Upstream commit: ${localRev}"
echo "::group::git commit details"
git show
echo "::endgroup::"
git push --quiet
# Unload the SSH key from the agent now that the push is done, to
# prevent accidental usage in any subsequent steps within this job.
ssh-add -D