Skip to content

Commit 31fd6c8

Browse files
authored
Merge pull request #7 from doanac/incus-to-docker
ci: Move from Incus to Docker for image building
2 parents 52574b5 + 62bed5f commit 31fd6c8

File tree

1 file changed

+7
-40
lines changed

1 file changed

+7
-40
lines changed

.github/workflows/debos.yml

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ defaults:
2424
working-directory: debos-recipes
2525

2626
env:
27-
INCUS_IMAGE: images:debian/trixie/arm64
28-
INCUS_NAME: debos
29-
FILESERVER_DIR: /srv/gh-runners/quic-yocto/builds
3027
FILESERVER_URL: https://quic-yocto-fileserver-1029608027416.us-central1.run.app
3128

3229
# cancel in progress builds for this workflow triggered by the same ref
@@ -37,6 +34,11 @@ concurrency:
3734
jobs:
3835
build-debos:
3936
runs-on: [self-hosted, arm64, debbuilder]
37+
container:
38+
image: debian:trixie
39+
volumes:
40+
- /srv/gh-runners/quic-yocto/builds:/builds
41+
options: --privileged
4042
steps:
4143
- uses: actions/checkout@v4
4244
with:
@@ -47,48 +49,14 @@ jobs:
4749
- name: Update OS packages
4850
run: |
4951
set -x
50-
sudo apt update
51-
sudo apt -y upgrade
52-
sudo apt -y full-upgrade
53-
54-
# this is the default in our self-hosted runners
55-
- name: Make sure Incus is setup
56-
run: |
57-
set -x
58-
sudo apt -y install incus
59-
sudo incus admin init --auto
60-
61-
# create a fresh container build environment to decouple the build
62-
# operating system from the github runner one; install debos
63-
- name: Setup build environment
64-
run: |
65-
set -x
66-
# privileged container as debos will use mounts
67-
sudo incus init "${INCUS_IMAGE}" "${INCUS_NAME}" \
68-
-c security.privileged=true -c security.nesting=true
69-
sudo incus start "${INCUS_NAME}"
70-
# wait for network to be up (prior to running apt)
71-
sudo incus exec "${INCUS_NAME}" \
72-
/usr/lib/systemd/systemd-networkd-wait-online
73-
74-
# commands are piped to be run inside the container
75-
sudo incus exec "${INCUS_NAME}" -- sh -e -x <<EOF
7652
apt update
7753
apt -y upgrade
7854
apt -y full-upgrade
7955
apt -y install debos
80-
EOF
8156
8257
- name: Build debos recipe
8358
run: |
8459
set -x
85-
# mount current directory under /build
86-
sudo incus config device add "${INCUS_NAME}" build-dir \
87-
disk "source=${PWD}" path=/build shift=true
88-
89-
# commands are piped to be run inside the container
90-
sudo incus exec "${INCUS_NAME}" -- sh -e -x <<EOF
91-
cd /build
9260
# start by building the root filesystem
9361
debos qualcomm-linux-debian-rootfs.yaml
9462
# debos tries KVM and UML as backends, and falls back to
@@ -101,19 +69,18 @@ jobs:
10169
qualcomm-linux-debian-image.yaml
10270
debos -b qemu --scratchsize 4GiB -t imagetype:sdcard \
10371
qualcomm-linux-debian-image.yaml
104-
EOF
10572
10673
- name: Upload artifacts to fileserver
10774
run: |
10875
set -x
10976
# curl will be used to talk to fileserver; should be installed by
11077
# default
111-
sudo apt -y install curl
78+
apt -y install curl
11279
# github runs are only unique per repository and may also be re-run;
11380
# create an unique id with repository, run id, and run attempt
11481
id="${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
11582
# create a directory for the current run
116-
dir="${FILESERVER_DIR}/${id}"
83+
dir="/build/${id}"
11784
mkdir -vp "${dir}"
11885
# copy output files
11986
cp -v disk-ufs.img.gz "${dir}"

0 commit comments

Comments
 (0)