Skip to content

Commit 0b8ea91

Browse files
committed
ci: Changes to build in AWS
Signed-off-by: Andy Doan <[email protected]>
1 parent a150fee commit 0b8ea91

File tree

1 file changed

+27
-63
lines changed

1 file changed

+27
-63
lines changed
Lines changed: 27 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build debos recipe
1+
name: Build debos recipe in AWS
22

33
on:
44
# run on pull requests to the main branch
@@ -24,19 +24,25 @@ 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
30-
FILESERVER_URL: https://quic-yocto-fileserver-1029608027416.us-central1.run.app
27+
BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
28+
FILESERVER_DIR: /efs/qli/metaqcom/gh-runners/quic-yocto/builds
29+
FILESERVER_URL: "https://artifactory-qdc-global.qualcomm.com/artifactory/pdlm-qcomlinux-generic-lv-fed/QualcommLinuxPrd/qualcomm-linux/meta-qcom/${BUILD_ID}"
3130

3231
# cancel in progress builds for this workflow triggered by the same ref
3332
concurrency:
3433
group: ${{ github.workflow }}-${{ github.ref }}
3534
cancel-in-progress: true
3635

3736
jobs:
38-
build-debos:
39-
runs-on: [self-hosted, arm64, debbuilder]
37+
build-debos-aws:
38+
runs-on:
39+
- codebuild-QualcommLinux-Qcom-Deb-${{ github.run_id }}-${{ github.run_attempt }}
40+
- buildspec-override:true # This tells our self-hosted runner to upload artifacts
41+
container:
42+
image: debian:trixie
43+
volumes:
44+
- ${FILESERVER_DIR}:${FILESERVER_DIR}
45+
- ${GITHUB_WORKSPACE}:/build
4046
steps:
4147
- uses: actions/checkout@v4
4248
with:
@@ -46,75 +52,33 @@ jobs:
4652
# avoid an automated update while we're building
4753
- name: Update OS packages
4854
run: |
49-
set -x
55+
set -ex
5056
sudo apt update
5157
sudo apt -y upgrade
5258
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-
# these commands are run inside the container
75-
cat <<EOF
76-
apt update
77-
apt -y upgrade
78-
apt -y full-upgrade
79-
apt -y install debos
80-
EOF
81-
) | sudo incus exec "${INCUS_NAME}" -- sh
59+
sudo apt -y install debos
8260

8361
- name: Build debos recipe
8462
run: |
85-
set -x
86-
# mount current directory under /build
87-
sudo incus config device add "${INCUS_NAME}" build-dir \
88-
disk "source=${PWD}" path=/build shift=true
89-
(
90-
# these commands are run inside the container
91-
cat <<EOF
92-
cd /build
93-
# debos tries KVM and UML as backends, and falls back to building
94-
# directly on the host, but that requires loop devices; use
95-
# qemu backend explicitly even if it's slower
96-
# qemu backend also requires to set scratchsize, otherwise
97-
# the whole build is done from memory and the out of memory
98-
# killer gets triggered
99-
debos -b qemu --scratchsize 4GiB qualcomm-linux-debian.yaml
100-
EOF
101-
) | sudo incus exec "${INCUS_NAME}" -- sh
63+
set -ex
64+
cd /build
65+
# debos tries KVM and UML as backends, and falls back to building
66+
# directly on the host, but that requires loop devices; use
67+
# qemu backend explicitly even if it's slower
68+
# qemu backend also requires to set scratchsize, otherwise
69+
# the whole build is done from memory and the out of memory
70+
# killer gets triggered
71+
debos -b qemu --scratchsize 4GiB qualcomm-linux-debian.yaml
10272

103-
- name: Upload artifacts to fileserver
73+
- name: Stage image for publishing
10474
run: |
105-
set -x
106-
# curl will be used to talk to fileserver; should be installed by
107-
# default
108-
sudo apt -y install curl
75+
set -ex
10976
# github runs are only unique per repository and may also be re-run;
11077
# create an unique id with repository, run id, and run attempt
11178
id="${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
11279
# create a directory for the current run
11380
dir="${FILESERVER_DIR}/${id}"
11481
mkdir -vp "${dir}"
115-
# copy output files
82+
# Files placed under ${dir} will be published internally
11683
cp -v disk.img "${dir}"
117-
# instruct fileserver to publish this directory
118-
url="${FILESERVER_URL}/${id}/"
119-
curl -X POST -H 'Accept: text/event-stream' "${url}"
12084

0 commit comments

Comments
 (0)