Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync latest-candidate to 5.21-edge (5.21-edge) #647

Merged
merged 46 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
784c1e8
snapcraft: install edk2 build dependencies only when needed
mihalicyn Jun 21, 2024
aa86ac1
snapcraft: edk2: properly filter architectures
mihalicyn Jun 21, 2024
84310da
snapcraft: fix acpica-tools dependency package name
mihalicyn Jun 21, 2024
6cd9c43
snapcraft: fix snapcraft libraries linter warnings for ceph
mihalicyn Jun 27, 2024
dfd9984
snapcraft: add explicit depend on libsnappy1v5
simondeziel Jul 10, 2024
2346b0e
snapcraft: Add `nvidia-ctk` as part of the binary tool for Container …
gabrielmougard Jun 20, 2024
280bba9
snapcraft: Add cobra completions
kadinsayani Sep 5, 2024
60e2bf8
snapcraft: rework how the lxd-doc gets primed
simondeziel Sep 10, 2024
431e913
snapcraft: Set up completer for snap
kadinsayani Sep 5, 2024
dfced97
github: Align concurrency rules with lxd repo
tomponline Sep 16, 2024
18ff376
snapcraft: Remove deprecated `-d` flag from `go get`
simondeziel Sep 18, 2024
2f587d9
snapcraft: bump apparmor to v4.0.3
simondeziel Sep 18, 2024
a292485
lxd: Build lxd-user as static binary
tomponline Oct 4, 2024
0a15504
snapcraft: Use --strip-all for clarity
tomponline Oct 9, 2024
63d6c74
github: pin actions/checkout@v4
simondeziel Oct 10, 2024
e585e1d
github: pin actions/setup-go@v5
simondeziel Oct 10, 2024
f5384b3
github: pin redhat-plumbers-in-action/differential-shellcheck@v5
simondeziel Oct 10, 2024
a2f6fa0
github: pin actions/upload-artifact@v4
simondeziel Oct 10, 2024
2022fe8
chore(deps): update actions/upload-artifact action to v4.4.3
renovate[bot] Oct 14, 2024
2734983
build(deps): bump actions/checkout from 4.2.1 to 4.2.2
dependabot[bot] Oct 28, 2024
6b3a0a7
build(deps): bump actions/setup-go from 5.0.2 to 5.1.0
dependabot[bot] Oct 28, 2024
90b8130
daemon.start: use % instead of # with `sed`
simondeziel Nov 4, 2024
f7f37ee
daemon.start: handle commented \`key = value\` in lvm.conf
simondeziel Nov 4, 2024
ba9d698
daemon.start: handle /sbin/ and /bin/ paths in lvm.conf
simondeziel Nov 4, 2024
fca4829
github: don't rerun tests when PRs are merged
simondeziel Nov 11, 2024
5702570
github: only run tests (shellcheck) when files in `snapcraft/**` are …
simondeziel Nov 11, 2024
024fa96
daemon.start: simplify executable path patching
simondeziel Nov 6, 2024
84f1967
daemon.start: stop live-patching lvm.conf
simondeziel Nov 6, 2024
9e9b43e
snapcraft: prime LVM config profiles
simondeziel Nov 6, 2024
1020efc
snapcraft: patch lvm.conf at build time
simondeziel Nov 6, 2024
e554ff6
snapcraft: split lvm.conf patching based on release
simondeziel Nov 6, 2024
5342927
snapcraft: add `zfs.external` config key
simondeziel Apr 15, 2024
a111f9c
nvidia-container-toolkit: Bump to v1.17.2
tomponline Nov 18, 2024
37cef69
libnvidia-container: Bump to v1.17.2
tomponline Nov 18, 2024
02e0209
snapcraft: Add .py extension to uefivars
MusicDin Sep 19, 2024
6c4d199
lxd-stophook: Adds stop hook wrapper for the lxd command
tomponline Oct 8, 2024
a7ca1c5
lxd: Build lxd server binary into /sbin
tomponline Oct 9, 2024
2908c5b
criu: Bump to v4.0
tomponline Nov 18, 2024
1348c75
lxd: Update iw location for core22
tomponline Nov 27, 2024
7168b25
snapcraft: Adds title field
tomponline Nov 26, 2024
fbbf0e6
snapcraft: hardcode support for compopt to fix bash completion
simondeziel Nov 22, 2024
516a582
snapcraft: call `tput cols` only once during completion
simondeziel Nov 22, 2024
bd4243c
snapcraft: sort primed libs for ceph part
simondeziel Jul 10, 2024
381a8da
zfs: Bump to zfs-2.2.6
tomponline Dec 12, 2024
43662c8
python-uefivars: Bump to v1.2
tomponline Dec 12, 2024
bc2cae4
github: Use stable version of go
tomponline Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ jobs:
if: ${{ github.repository == 'canonical/lxd-pkg-snap' && github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: 'stable'

- name: Setup Launchpad SSH access
env:
Expand All @@ -36,11 +41,6 @@ jobs:
ssh-keyscan git.launchpad.net >> ~/.ssh/known_hosts
ssh-keygen -qlF git.launchpad.net | grep -xF 'git.launchpad.net RSA SHA256:UNOzlP66WpDuEo34Wgs8mewypV0UzqHLsIFoqwe8dYo'

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x

- name: Trigger Launchpad snap build
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Tests
on:
push:
pull_request:
paths:
- 'snapcraft/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

defaults:
Expand All @@ -22,20 +23,20 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# A non-shallow clone is needed for the Differential ShellCheck
fetch-depth: 0

- id: ShellCheck
name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v5
uses: redhat-plumbers-in-action/differential-shellcheck@cc6721c45a8800cc666de45493545a07a638d121 # v5.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'pull_request'

- name: Upload artifact with ShellCheck defects in SARIF format
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Differential ShellCheck SARIF
path: ${{ steps.ShellCheck.outputs.sarif }}
Expand Down
130 changes: 105 additions & 25 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version: git
grade: devel
summary: LXD - container and VM manager
license: AGPL-3.0
title: LXD
description: |-
LXD is a system container and virtual machine manager.

Expand Down Expand Up @@ -51,6 +52,7 @@ description: |-
- openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false]
- ovn.builtin: Use snap-specific OVN configuration [default=false]
- ui.enable: Enable the web interface [default=true]
- zfs.external: Use the system's ZFS tools [default=false]

For system-wide configuration of the CLI, place your configuration in
/var/snap/lxd/common/global-conf/ (config.yml and servercerts)
Expand Down Expand Up @@ -191,14 +193,19 @@ parts:
- libatomic
plugin: nil
stage-packages:
# XXX: explicitly depend on libsnappy1v5 due to https://bugs.launchpad.net/ubuntu/+source/ceph/+bug/2072656
- on amd64:
- ceph-common
- libsnappy1v5
- on arm64:
- ceph-common
- libsnappy1v5
- on ppc64el:
- ceph-common
- libsnappy1v5
- on s390x:
- ceph-common
- libsnappy1v5
organize:
usr/bin/: bin/
usr/lib/: lib/
Expand Down Expand Up @@ -247,11 +254,13 @@ parts:
- lib/*/librtmp.so*
- lib/*/libsasl2.so*
- lib/*/libsnappy.so*
- lib/*/libncurses.so*
- lib/*/libssh.so*
- lib/*/libtcmalloc.so*
- lib/*/libunwind.so*

criu:
source: https://github.com/checkpoint-restore/criu
source-commit: f8b14286b092853a4485813e1efd564109df9123 # v3.19
source-commit: c2b48ff423aa663b3534a5ba96907366e4c1b408 # v4.0
source-depth: 1
source-type: git
plugin: nil
Expand All @@ -278,7 +287,10 @@ parts:
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && [ "$(uname -m)" != "armv7l" ] && exit 0
set -ex

make USERCFLAGS=-Wno-error=format-truncation criu
git config user.email "[email protected]"
git config user.name "LXD snap builder"
Comment on lines +290 to +291
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded as we don't do any cherry-picking or such, but also harmless.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, yeah was trying to sync as much as possible.


make criu
mkdir -p "${CRAFT_PART_INSTALL}/criu/"
cp criu/criu "${CRAFT_PART_INSTALL}/criu/"
organize:
Expand Down Expand Up @@ -552,6 +564,25 @@ parts:
sbin/: bin/
usr/lib/: lib/
usr/sbin/: bin/
override-build: |-
# Patch lvm.conf
# lvm.conf changes for lvm2 from 22.04/core22
sed -i \
-e "s%\(# \)\?obtain_device_list_from_udev = 1%obtain_device_list_from_udev = 0%" \
-e "s%\(# \)\?cache_file_prefix = \"\"%cache_file_prefix = \"lxd\"%" \
"${CRAFT_PART_INSTALL}/etc/lvm/lvm.conf"

# Generic lvm.conf changes
sed -i \
-e "s%\(# \)\?udev_sync = 1%udev_sync = 0%" \
-e "s%\(# \)\?udev_rules = 1%udev_rules = 0%" \
-e "s%\(# \)\?use_lvmetad = 1%use_lvmetad = 0%" \
-e "s%\(# \)\?monitoring = 1%monitoring = 0%" \
-e "/# .*_\?executable =/s/# //" \
-e "s%\(/usr\)\?/s\?bin/%/snap/lxd/current/bin/%" \
"${CRAFT_PART_INSTALL}/etc/lvm/lvm.conf"

craftctl default
prime:
- bin/cache_*
- bin/dmeventd
Expand All @@ -567,6 +598,7 @@ parts:
- -bin/lvmetad
- -bin/lvmpolld
- etc/lvm/lvm.conf
- etc/lvm/profile/*
- lib/*/device-mapper/*
- lib/*/libaio.so*
- lib/*/libdevmapper*
Expand Down Expand Up @@ -634,12 +666,12 @@ parts:

nvidia-container:
source: https://github.com/NVIDIA/libnvidia-container
source-commit: 63d366ee3b4183513c310ac557bf31b05b83328f # v1.17.1
source-commit: 63d366ee3b4183513c310ac557bf31b05b83328f # v1.17.2
source-depth: 1
source-type: git
plugin: make
build-environment:
- GIT_TAG: "1.17.1" # Enables source-depth: 1, should match git tag without "v" prefix.
- GIT_TAG: "1.17.2" # Enables source-depth: 1, should match git tag without "v" prefix.
build-packages:
- bmake
- curl
Expand Down Expand Up @@ -676,6 +708,32 @@ parts:
- bin/nvidia-container-cli*
- lib/libnvidia-container*.so*

nvidia-container-toolkit:
source: https://github.com/NVIDIA/nvidia-container-toolkit
source-depth: 1
source-commit: fa66e4cd562804509055e44a88f666673e6d27c0 # v1.17.2
source-type: git
build-snaps:
- go
plugin: make
override-prime: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
craftctl default
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
set -ex

make binaries
mkdir -p "${CRAFT_PART_INSTALL}/bin/"
cp nvidia-ctk "${CRAFT_PART_INSTALL}/bin/"
organize:
usr/bin/: bin/
prime:
- bin/nvidia-ctk

nvme:
plugin: nil
stage-packages:
Expand Down Expand Up @@ -1194,7 +1252,7 @@ parts:

zfs-2-2:
source: https://github.com/openzfs/zfs
source-commit: 2566592045780e7be7afc899c2496b1ae3af4f4d # zfs-2.2.4
source-commit: baa50314567afd986a00838f0fa65fdacbd12daf # zfs-2.2.6
source-depth: 1
source-type: git
plugin: autotools
Expand Down Expand Up @@ -1241,7 +1299,7 @@ parts:

apparmor:
source: https://gitlab.com/apparmor/apparmor.git
source-commit: 84a6bc1b6dcdfeabb1ed3597f01e314f3bcee5c1 # v4.0.2
source-commit: b4dfdf50f50ed1d64161424d036a2453645f0cfe # v4.0.3
source-depth: 1
source-type: git
plugin: autotools
Expand Down Expand Up @@ -1393,7 +1451,7 @@ parts:
- qemu-ovmf-secureboot
- nftables
source: https://github.com/awslabs/python-uefivars
source-commit: 9679002a4392d8e7831d2dbda3fab41ccc5c6b8c # v1.0.0
source-commit: ec1eab1717c65ea36ca7160c96fe0e10e071fb66 # v1.2
source-depth: 1
source-type: git
plugin: python
Expand All @@ -1408,6 +1466,7 @@ parts:
craftctl default
organize:
lib/python3.10/site-packages/: lib/python3/dist-packages/
bin/uefivars: bin/uefivars.py
prime:
- bin/uefivars.py
- lib/python3/dist-packages/google_crc32c*
Expand Down Expand Up @@ -1464,7 +1523,7 @@ parts:
ln -s "$(pwd)" "${GOPATH}/src/github.com/canonical/lxd"

# Download the dependencies
go get -d -v ./...
go get -v ./...
override-build: |
set -ex

Expand All @@ -1481,10 +1540,19 @@ parts:

# Build the binaries
go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxc" github.com/canonical/lxd/lxc
go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd

# Build LXD server binary into ${CRAFT_PART_INSTALL}/sbin/lxd so that it does not conflict with the
# lxd-stophook wrapper script which is stored in ${CRAFT_PART_INSTALL}/bin/lxd.
# This way when a container stops it will call "/snap/lxd/current/bin/lxd callhook" which is handled by the
# lxd-stophook script, which in turn will execute "/snap/lxd/current/bin/lxd-user callhook" to notify LXD.
go build -trimpath -o "${CRAFT_PART_INSTALL}/sbin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd

# Build static binaries
CGO_ENABLED=0 go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/canonical/lxd/lxd-agent
go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-user" github.com/canonical/lxd/lxd-user
CGO_ENABLED=0 go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-user" -tags netgo github.com/canonical/lxd/lxd-user

# Some python dependencies are not available for riscv64 or just require a build from source.
# Not worth the effort for now.
if [ "$(uname -m)" != "riscv64" ]; then
# Build the static website
make doc
Expand All @@ -1495,21 +1563,31 @@ parts:
rm doc/_build/.buildinfo
rm -rf doc/_build/_sphinx_design_static/

# Stage the static website
mkdir -p "${CRAFT_STAGE}/share/lxd-documentation"
cp -a doc/_build/. "${CRAFT_STAGE}/share/lxd-documentation/"
# Copy the static website
mkdir -p "${CRAFT_PART_INSTALL}/share/lxd-documentation"
cp -a doc/_build/. "${CRAFT_PART_INSTALL}/share/lxd-documentation/"
fi

# Setup bash completion
mkdir -p "${CRAFT_PART_INSTALL}/etc/bash_completion.d/"
cp scripts/bash/lxd-client "${CRAFT_PART_INSTALL}/etc/bash_completion.d/snap.lxd.lxc"
# Snapd requires the unaliased command `lxd.lxc` to be supplied as the first command for completion to be detected
set_cmds='s/^\s*complete.*__start_lxc /&lxd.lxc /'
# When executed by snapd, the COLUMNS shell value is unset, so use $(tput cols) instead
set_cols='s/# $COLUMNS.*/COLUMN="$(tput cols)" \# store the current shell width./'
# When executed by snapd, the `compopt` support detection doesn't work so fake that it is always `builtin`
set_compopt='s|$(type -t compopt)|"builtin"|'
# Modify requestComp variable to use lxc based on context ($SNAP/bin/lxc in Snap environment)
set_request_comp='s|requestComp="${words\[0\]} __complete ${args\[\*\]}"|requestComp="/snap/lxd/current/bin/lxc __complete ${args[*]}"|'
# Generate completions script
"${CRAFT_PART_INSTALL}/bin/lxc" completion bash | sed -e "${set_cmds}" -e "${set_cols}" -e "${set_compopt}" -e "${set_request_comp}" > "${CRAFT_PART_INSTALL}/etc/bash_completion.d/snap.lxd.lxc"
organize:
usr/bin/: bin/
usr/lib/: lib/
usr/share/misc/: share/misc/
var/lib/usbutils/usb.ids: share/misc/
usr/sbin/: bin/
sbin/: bin/
sbin/iw: bin/ # core22 installs iw in sbin (not needed for core24 which installs to usr/sbin)
sbin/sgdisk: bin/
prime:
- bin/dnsmasq
- bin/getfattr
Expand All @@ -1525,13 +1603,14 @@ parts:

- etc/bash_completion.d/snap.lxd.lxc

- share/lxd-documentation*
- share/misc/pci.ids
- share/misc/usb.ids

- bin/lxc
- bin/lxd
- bin/lxd-agent
- bin/lxd-user
- sbin/lxd

lxd-ui:
source: https://github.com/canonical/lxd-ui
Expand Down Expand Up @@ -1595,6 +1674,7 @@ parts:
- criu
- lxd
- shmounts
- nvidia-container-toolkit
plugin: nil
override-prime: |
set -x
Expand All @@ -1606,10 +1686,12 @@ parts:
rm -rf "${CRAFT_PRIME}/usr/share/"

# Strip binaries (excluding shell scripts and LXCFS)
# The "${CRAFT_PRIME}/bin/lxd" file is ignored as that is the lxd-stophook wrapper script.
find "${CRAFT_PRIME}"/bin -type f \
-not -path "${CRAFT_PRIME}/bin/ceph" \
-not -path "${CRAFT_PRIME}/bin/editor" \
-not -path "${CRAFT_PRIME}/bin/lxc-checkconfig" \
-not -path "${CRAFT_PRIME}/bin/lxd" \
-not -path "${CRAFT_PRIME}/bin/nvidia-container-cli" \
-not -path "${CRAFT_PRIME}/bin/remote-viewer" \
-not -path "${CRAFT_PRIME}/bin/snap-query" \
Expand All @@ -1618,7 +1700,11 @@ parts:
-not -path "${CRAFT_PRIME}/bin/xfs_admin" \
-not -path "${CRAFT_PRIME}/bin/uefivars.py" \
-not -path "${CRAFT_PRIME}/bin/lxcfs" \
-exec strip -s {} +
-not -path "${CRAFT_PRIME}/bin/gpu-2404-custom-wrapper" \
-exec strip --strip-all {} +

# This is the actual LXD binary.
strip --strip-all "${CRAFT_PRIME}/sbin/lxd"

# Strip binaries not under bin/ due to being dynamically
# added to the path with `snap set lxd`, like `criu.enable=true`
Expand All @@ -1639,13 +1725,6 @@ parts:
-not -path "${CRAFT_PRIME}/lib/liblxcfs.so" \
-exec strip -s {} +

if [ "$(uname -m)" != "riscv64" ]; then
# Prime the documentation only if the arch is not riscv64.
# Some python dependencies are not available for riscv64 or just require a build from source.
# Not worth the effort for now.
cp -r "${CRAFT_STAGE}/share/lxd-documentation" "${CRAFT_PRIME}/share/"
fi

# Delete empty directories
find "${CRAFT_PRIME}/" -type d -empty -print -delete

Expand All @@ -1668,6 +1747,7 @@ parts:
organize:
commands/snap-query: bin/
hooks/: snap/hooks/
wrappers/lxd-stophook: bin/lxd
wrappers/editor: bin/
wrappers/remote-viewer: bin/
wrappers/sshfs: bin/
Expand Down
Loading