Skip to content

Commit 9846e2f

Browse files
authored
Backport: ci: use Incus instead of LXD (#803) (#818)
Backport #803 It seems that AmazonLinux:2 container image is not available anymore from https://images.lxd.canonical.com/. AmazonLinux:2 is still available from https://images.linuxcontainers.org, but it can't be added without interactive operation for LXD. It seems that it is easy to use Incus as a workaround. Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
1 parent 5503140 commit 9846e2f

File tree

4 files changed

+75
-67
lines changed

4 files changed

+75
-67
lines changed

.github/workflows/apt.yml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,19 @@ jobs:
138138
include:
139139
- label: Debian bullseye amd64
140140
rake-job: debian-bullseye
141-
test-lxc-image: images:debian/11
141+
container-image: images:debian/11
142142
- label: Debian bookworm amd64
143143
rake-job: debian-bookworm
144-
test-lxc-image: images:debian/12
144+
container-image: images:debian/12
145145
- label: Ubuntu Focal amd64
146146
rake-job: ubuntu-focal
147-
test-lxc-image: ubuntu:20.04
147+
container-image: images:ubuntu/20.04
148148
- label: Ubuntu Jammy amd64
149149
rake-job: ubuntu-jammy
150-
test-lxc-image: ubuntu:22.04
150+
container-image: images:ubuntu/22.04
151151
- label: Ubuntu Noble amd64
152152
rake-job: ubuntu-noble
153-
test-lxc-image: ubuntu:24.04
153+
container-image: images:ubuntu/24.04
154154
exclude:
155155
- label: Debian bookworm amd64
156156
test-file: update-from-v4.sh
@@ -176,24 +176,17 @@ jobs:
176176
- uses: actions/download-artifact@v4
177177
with:
178178
name: packages-apt-source-${{ matrix.rake-job }}
179-
- uses: canonical/setup-lxd@v0.1.2
180-
- name: Run diagnostic
179+
- name: Setup Incus
181180
run: |
182-
uname -a
183-
echo "::group::snap info lxd"
184-
snap info lxd
185-
echo "::endgroup::"
186-
echo "::group::snap services lxd"
187-
snap services lxd
188-
echo "::endgroup::"
189-
echo "::group::snap logs lxd"
190-
sudo snap logs lxd
191-
echo "::endgroup::"
192-
echo "::group::lxc remote list"
193-
lxc remote list
194-
echo "::endgroup::"
195-
echo "::group::lxc list images:"
196-
lxc image list images:
197-
echo "::endgroup::"
198-
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.test-lxc-image }}
199-
run: fluent-package/apt/systemd-test/test.sh ${{ matrix.test-lxc-image }} ${{ matrix.test-file }}
181+
sudo apt update
182+
sudo apt install -y -V incus
183+
- name: Allow egress network traffic flows for Incus
184+
# https://linuxcontainers.org/incus/docs/main/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-incus-and-docker
185+
run: |
186+
sudo iptables -I DOCKER-USER -i incusbr0 -j ACCEPT
187+
sudo iptables -I DOCKER-USER -o incusbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
188+
- name: Setup Incus
189+
run: |
190+
sudo incus admin init --auto
191+
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.container-image }}
192+
run: fluent-package/apt/systemd-test/test.sh ${{ matrix.container-image }} ${{ matrix.test-file }}

.github/workflows/yum.yml

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ jobs:
109109
include:
110110
- label: AmazonLinux 2 x86_64
111111
rake-job: amazonlinux-2
112-
test-lxc-image: images:amazonlinux/2
112+
container-image: images:amazonlinux/2
113113
- label: AmazonLinux 2023 x86_64
114114
rake-job: amazonlinux-2023
115-
test-lxc-image: images:amazonlinux/2023
115+
container-image: images:amazonlinux/2023
116116
exclude:
117117
- label: AmazonLinux 2023 x86_64
118118
test-file: update-from-v4.sh
@@ -125,27 +125,31 @@ jobs:
125125
- uses: actions/download-artifact@v4
126126
with:
127127
name: packages-${{ matrix.rake-job }}
128-
- uses: canonical/setup-lxd@v0.1.2
129-
- name: Run diagnostic
128+
- name: Install Incus
130129
run: |
131-
uname -a
132-
echo "::group::snap info lxd"
133-
snap info lxd
134-
echo "::endgroup::"
135-
echo "::group::snap services lxd"
136-
snap services lxd
137-
echo "::endgroup::"
138-
echo "::group::snap logs lxd"
139-
sudo snap logs lxd
140-
echo "::endgroup::"
141-
echo "::group::lxc remote list"
142-
lxc remote list
143-
echo "::endgroup::"
144-
echo "::group::lxc list images:"
145-
lxc image list images:
146-
echo "::endgroup::"
147-
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.test-lxc-image }}
148-
run: fluent-package/yum/systemd-test/test.sh ${{ matrix.test-lxc-image }} ${{ matrix.test-file }}
130+
sudo curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
131+
cat <<SOURCES | sudo tee /etc/apt/sources.list.d/zabbly-incus-stable.sources
132+
Enabled: yes
133+
Types: deb
134+
URIs: https://pkgs.zabbly.com/incus/stable
135+
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
136+
Components: main
137+
Architectures: $(dpkg --print-architecture)
138+
Signed-By: /etc/apt/keyrings/zabbly.asc
139+
SOURCES
140+
141+
sudo apt-get update
142+
sudo apt-get install -y -V incus
143+
- name: Allow egress network traffic flows for Incus
144+
# https://linuxcontainers.org/incus/docs/main/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-incus-and-docker
145+
run: |
146+
sudo iptables -I DOCKER-USER -i incusbr0 -j ACCEPT
147+
sudo iptables -I DOCKER-USER -o incusbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
148+
- name: Setup Incus
149+
run: |
150+
sudo incus admin init --auto
151+
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.container-image }}
152+
run: fluent-package/yum/systemd-test/test.sh ${{ matrix.container-image }} ${{ matrix.test-file }}
149153

150154
v2test:
151155
name: Test ${{ matrix.label }} ${{ matrix.test-file }} (CGroup V2)
@@ -168,15 +172,26 @@ jobs:
168172
include:
169173
- label: RockyLinux 8 x86_64
170174
rake-job: rockylinux-8
171-
test-lxc-image: images:rockylinux/8
175+
container-image: images:rockylinux/8
172176
- label: AlmaLinux 9 x86_64
173177
rake-job: almalinux-9
174-
test-lxc-image: images:almalinux/9
178+
container-image: images:almalinux/9
175179
steps:
176180
- uses: actions/checkout@v4
177181
- uses: actions/download-artifact@v4
178182
with:
179183
name: packages-${{ matrix.rake-job }}
180-
- uses: canonical/setup-lxd@v0.1.2
181-
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.test-lxc-image }}
182-
run: fluent-package/yum/systemd-test/test.sh ${{ matrix.test-lxc-image }} ${{ matrix.test-file }}
184+
- name: Install Incus
185+
run: |
186+
sudo apt-get update
187+
sudo apt-get install -y -V incus
188+
- name: Allow egress network traffic flows for Incus
189+
# https://linuxcontainers.org/incus/docs/main/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-incus-and-docker
190+
run: |
191+
sudo iptables -I DOCKER-USER -i incusbr0 -j ACCEPT
192+
sudo iptables -I DOCKER-USER -o incusbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
193+
- name: Setup Incus
194+
run: |
195+
sudo incus admin init --auto
196+
- name: Run Test ${{ matrix.test-file }} on ${{ matrix.container-image }}
197+
run: fluent-package/yum/systemd-test/test.sh ${{ matrix.container-image }} ${{ matrix.test-file }}

fluent-package/apt/systemd-test/test.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ dir="/host/fluent-package/apt/systemd-test"
1515
set -eux
1616

1717
echo "::group::Run test: launch $image"
18-
lxc launch $image target --debug
18+
sudo incus launch $image target --debug
1919
sleep 5
2020
echo "::endgroup::"
2121
echo "::group::Run test: configure $image"
22-
lxc config device add target host disk source=$PWD path=/host
23-
lxc list
22+
sudo incus config device add target host disk source=$PWD path=/host
23+
sudo incus list
2424
echo "::endgroup::"
2525
echo "::group::Run test: setup $image"
26-
lxc exec target -- $dir/setup.sh
26+
sudo incus exec target -- $dir/setup.sh
2727
echo "::endgroup::"
28-
echo "::group::Run test: $test_file $apt_repo_type on $image"
29-
lxc exec target -- $dir/$test_file $apt_repo_type
28+
echo "::group::Run test: $test_file $other_args on $image"
29+
sudo incus exec target -- $dir/$test_file $other_args
3030
echo "::endgroup::"
3131
echo "::group::Run test: cleanup $image"
32-
lxc stop target
33-
lxc delete target
32+
sudo incus stop target
33+
sudo incus delete target
3434
echo "::endgroup::"
3535
echo -e "\nAll Success!\n"

fluent-package/yum/systemd-test/test.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ dir="/host/fluent-package/yum/systemd-test"
1414
set -eux
1515

1616
echo "::group::Run test: launch $image"
17-
lxc launch $image target --debug
17+
sudo incus launch $image target --debug
1818
sleep 5
1919
echo "::endgroup::"
2020
echo "::group::Run test: configure $image"
21-
lxc config device add target host disk source=$PWD path=/host
22-
lxc list
21+
sudo incus config device add target host disk source=$PWD path=/host
22+
sudo incus list
2323
echo "::endgroup::"
24-
echo "::group::Run test: $test_file $yum_repo_type on $image"
25-
lxc exec target -- $dir/$test_file $yum_repo_type
24+
echo "::group::Run test: $test_file $other_args on $image"
25+
sudo incus exec target -- $dir/$test_file $other_args
2626
echo "::endgroup::"
2727
echo "::group::Run test: cleanup $image"
28-
lxc stop target
29-
lxc delete target
28+
sudo incus stop target
29+
sudo incus delete target
3030
echo "::endgroup::"
3131
echo -e "\nAll Success!\n"

0 commit comments

Comments
 (0)