Skip to content

Commit 0a0e1bd

Browse files
committed
Add workflows for gigabyte-ampere-cuttlefish-installer
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
1 parent 14f5ee9 commit 0a0e1bd

File tree

1 file changed

+372
-0
lines changed

1 file changed

+372
-0
lines changed
Lines changed: 372 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,372 @@
1+
name: Workflow for Gigabyte Ampere Server Cuttlefish Installer
2+
3+
on: [push]
4+
5+
jobs:
6+
build-installer-iso-job:
7+
runs-on: ubuntu-22.04
8+
container:
9+
image: debian@sha256:9258a75a7e4323c9e5562b361effc84ee747920116d8adfc98a465a5cdc9150e # debian:bookworm-20250407 (amd64)
10+
env:
11+
DEBIAN_ISO_URL: "https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/mini.iso"
12+
CI_PROJECT_NAME: ${{ github.event.repository.name }}
13+
CI_PIPELINE_ID: ${{ github.run_id }}
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
- name: Setting up build environment
18+
run: |
19+
apt-get update
20+
apt-get upgrade -y
21+
apt-get install -y sudo
22+
apt-get install -y wget libarchive-tools
23+
apt-get install -y xorriso
24+
apt-get install -y cpio xz-utils
25+
apt-get install -y fdisk
26+
- name: Build the iso image
27+
run: |
28+
cd gigabyte-ampere-cuttlefish-installer
29+
sed -i "2i CI_PROJECT_NAME=${CI_PROJECT_NAME}" preseed/after_install_1.sh
30+
sed -i "3i CI_PIPELINE_ID=${CI_PIPELINE_ID}" preseed/after_install_1.sh
31+
wget -nv -c ${DEBIAN_ISO_URL}
32+
./addpreseed.sh
33+
xz -9e preseed-mini.iso
34+
- name: Upload artifacts
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: gigabyte-ampere-cuttlefish-installer-artifacts
38+
path: gigabyte-ampere-cuttlefish-installer/preseed-mini.iso.xz
39+
40+
test-iso-qemu-job:
41+
needs: build-installer-iso-job
42+
runs-on: ubuntu-22.04-arm
43+
container:
44+
image: debian:trixie # debian:trixie
45+
env:
46+
TEST_DISK_SIZE: "10G"
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
- name: Download artifacts
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: gigabyte-ampere-cuttlefish-installer-artifacts
54+
- name: Prepare test environment
55+
run: |
56+
apt-get update
57+
apt-get upgrade -y
58+
apt-get install -y sudo
59+
apt-get install -y debconf-utils
60+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
61+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
62+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
63+
dpkg-reconfigure --frontend noninteractive tzdata
64+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
65+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
66+
dpkg-reconfigure --frontend noninteractive pbuilder
67+
apt-get install -y util-linux util-linux-extra
68+
apt-get install -y xz-utils
69+
apt-get install -y qemu-system-arm
70+
apt-get install -y expect
71+
apt-get install -y e2tools e2fsprogs
72+
apt-get install -y guestfish
73+
apt-get install -y lvm2
74+
apt-get install -y ubuntu-dev-tools
75+
apt-get install -y sshpass
76+
apt-get install -y u-boot-qemu
77+
- name: Run test
78+
run: |
79+
cd gigabyte-ampere-cuttlefish-installer
80+
mv ../preseed-mini.iso.xz .
81+
xz -d preseed-mini.iso.xz
82+
chmod a-w preseed-mini.iso
83+
cp -f tests/installer-iso-* .
84+
echo "Run installer on qemu"
85+
./installer-iso-install.expect successful_install sheeFei2
86+
./installer-iso-extract-partitions.sh
87+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
88+
echo sheeFei2 > successful_install_compare
89+
cmp successful_install successful_install_compare
90+
echo "Test if AOSP kernel is installed"
91+
e2ls -l boot.img:/vmlinuz-*
92+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
93+
test -e vmlinuz-*
94+
echo "Test if Cuttlefish Debian packages are installed"
95+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
96+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
97+
echo "Make sure that we do not have home partitions anymore"
98+
test '!' -e home.img
99+
100+
test-iso-multidisk-qemu-empty-disk-job:
101+
needs: build-installer-iso-job
102+
runs-on: ubuntu-22.04-arm
103+
container:
104+
image: debian:trixie # debian:trixie
105+
steps:
106+
- name: Checkout repository
107+
uses: actions/checkout@v4
108+
- name: Download artifacts
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: gigabyte-ampere-cuttlefish-installer-artifacts
112+
- name: Prepare test environment
113+
run: |
114+
apt-get update
115+
apt-get upgrade -y
116+
apt-get install -y sudo
117+
apt-get install -y debconf-utils
118+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
119+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
120+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
121+
dpkg-reconfigure --frontend noninteractive tzdata
122+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
123+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
124+
dpkg-reconfigure --frontend noninteractive pbuilder
125+
apt-get install -y util-linux util-linux-extra
126+
apt-get install -y xz-utils
127+
apt-get install -y qemu-system-arm
128+
apt-get install -y expect
129+
apt-get install -y e2tools e2fsprogs
130+
apt-get install -y guestfish
131+
apt-get install -y lvm2
132+
apt-get install -y ubuntu-dev-tools
133+
apt-get install -y sshpass
134+
apt-get install -y u-boot-qemu
135+
- name: Run test
136+
run: |
137+
cd gigabyte-ampere-cuttlefish-installer
138+
mv ../preseed-mini.iso.xz .
139+
xz -d preseed-mini.iso.xz
140+
chmod a-w preseed-mini.iso
141+
cp -f tests/installer-iso-* .
142+
cp -f tests/multidisk/installer-iso-* .
143+
echo "Create disks"
144+
./tests/multidisk/installer-create-empty-disk2.sh
145+
echo "Run installer on qemu"
146+
./installer-iso-install.expect successful_install eD4uvei1
147+
./installer-iso-extract-partitions-multidisk.sh
148+
echo "Test if rootfs is larger than 8G. It should be."
149+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
150+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
151+
echo eD4uvei1 > successful_install_compare
152+
cmp successful_install successful_install_compare
153+
echo "Test if AOSP kernel is installed"
154+
e2ls -l boot.img:/vmlinuz-*
155+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
156+
test -e vmlinuz-*
157+
echo "Test if Cuttlefish Debian packages are installed"
158+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
159+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
160+
161+
test-iso-multidisk-qemu-disk2-with-data-job:
162+
needs: build-installer-iso-job
163+
runs-on: ubuntu-22.04-arm
164+
container:
165+
image: debian:trixie # debian:trixie
166+
steps:
167+
- name: Checkout repository
168+
uses: actions/checkout@v4
169+
- name: Download artifacts
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: gigabyte-ampere-cuttlefish-installer-artifacts
173+
- name: Prepare test environment
174+
run: |
175+
apt-get update
176+
apt-get upgrade -y
177+
apt-get install -y sudo
178+
apt-get install -y debconf-utils
179+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
180+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
181+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
182+
dpkg-reconfigure --frontend noninteractive tzdata
183+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
184+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
185+
dpkg-reconfigure --frontend noninteractive pbuilder
186+
apt-get install -y util-linux util-linux-extra
187+
apt-get install -y xz-utils
188+
apt-get install -y qemu-system-arm
189+
apt-get install -y expect
190+
apt-get install -y gdisk
191+
apt-get install -y e2tools fatcat mtools dosfstools e2fsprogs
192+
apt-get install -y guestfish
193+
apt-get install -y lvm2
194+
apt-get install -y ubuntu-dev-tools
195+
apt-get install -y sshpass
196+
apt-get install -y u-boot-qemu
197+
apt-get install -y udev libgudev-1.0-dev
198+
- name: Run test
199+
run: |
200+
cd gigabyte-ampere-cuttlefish-installer
201+
mv ../preseed-mini.iso.xz .
202+
xz -d preseed-mini.iso.xz
203+
chmod a-w preseed-mini.iso
204+
cp -f tests/installer-iso-* .
205+
cp -f tests/multidisk/installer-iso-* .
206+
echo "Create disks"
207+
./tests/multidisk/installer-create-preinstalled-disk2.sh
208+
echo "Run installer on qemu"
209+
./installer-iso-install.expect successful_install Daiyaik0
210+
./installer-iso-extract-partitions-multidisk.sh
211+
echo "Test if rootfs is larger than 8G. It should be."
212+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
213+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
214+
echo Daiyaik0 > successful_install_compare
215+
cmp successful_install successful_install_compare
216+
echo "Test if AOSP kernel is installed"
217+
e2ls -l boot.img:/vmlinuz-*
218+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
219+
test -e vmlinuz-*
220+
echo "Test if Cuttlefish Debian packages are installed"
221+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
222+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
223+
224+
test-iso-multidisk-qemu-disk5-with-data-job:
225+
needs: build-installer-iso-job
226+
runs-on: ubuntu-22.04-arm
227+
container:
228+
image: debian:trixie # debian:trixie
229+
steps:
230+
- name: Checkout repository
231+
uses: actions/checkout@v4
232+
- name: Download artifacts
233+
uses: actions/download-artifact@v4
234+
with:
235+
name: gigabyte-ampere-cuttlefish-installer-artifacts
236+
- name: Prepare test environment
237+
run: |
238+
apt-get update
239+
apt-get upgrade -y
240+
apt-get install -y sudo
241+
apt-get install -y debconf-utils
242+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
243+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
244+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
245+
dpkg-reconfigure --frontend noninteractive tzdata
246+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
247+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
248+
dpkg-reconfigure --frontend noninteractive pbuilder
249+
apt-get install -y util-linux util-linux-extra
250+
apt-get install -y xz-utils
251+
apt-get install -y qemu-system-arm
252+
apt-get install -y expect
253+
apt-get install -y gdisk
254+
apt-get install -y e2tools fatcat mtools dosfstools e2fsprogs
255+
apt-get install -y guestfish
256+
apt-get install -y lvm2
257+
apt-get install -y ubuntu-dev-tools
258+
apt-get install -y sshpass
259+
apt-get install -y u-boot-qemu
260+
apt-get install -y udev libgudev-1.0-dev
261+
- name: Run test
262+
run: |
263+
cd gigabyte-ampere-cuttlefish-installer
264+
mv ../preseed-mini.iso.xz .
265+
xz -d preseed-mini.iso.xz
266+
chmod a-w preseed-mini.iso
267+
cp -f tests/installer-iso-* .
268+
cp -f tests/multidisk/installer-iso-* .
269+
echo "Create disks"
270+
./tests/multidisk/installer-create-preinstalled-disk5.sh
271+
echo "Run installer on qemu"
272+
./installer-iso-install.expect successful_install AiT7eipi
273+
./installer-iso-extract-partitions-multidisk.sh
274+
echo "Test if rootfs is larger than 8G. It should be."
275+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
276+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
277+
echo AiT7eipi > successful_install_compare
278+
cmp successful_install successful_install_compare
279+
echo "Test if AOSP kernel is installed"
280+
e2ls -l boot.img:/vmlinuz-*
281+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
282+
test -e vmlinuz-*
283+
echo "Test if Cuttlefish Debian packages are installed"
284+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
285+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
286+
287+
test-iso-cf-qemu-job:
288+
needs: build-installer-iso-job
289+
runs-on: ubuntu-22.04-arm
290+
container:
291+
image: debian:trixie # debian:trixie
292+
steps:
293+
- name: Checkout repository
294+
uses: actions/checkout@v4
295+
- name: Download artifacts
296+
uses: actions/download-artifact@v4
297+
with:
298+
name: gigabyte-ampere-cuttlefish-installer-artifacts
299+
- name: Prepare test environment
300+
run: |
301+
apt-get update
302+
apt-get upgrade -y
303+
apt-get install -y sudo
304+
apt-get install -y debconf-utils
305+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
306+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
307+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
308+
dpkg-reconfigure --frontend noninteractive tzdata
309+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
310+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
311+
dpkg-reconfigure --frontend noninteractive pbuilder
312+
apt-get install -y util-linux util-linux-extra
313+
apt-get install -y xz-utils
314+
apt-get install -y qemu-system-arm
315+
apt-get install -y expect
316+
apt-get install -y e2tools e2fsprogs
317+
apt-get install -y guestfish
318+
apt-get install -y ubuntu-dev-tools
319+
apt-get install -y u-boot-qemu
320+
apt-get install -y wget curl
321+
apt-get install -y openssh-client sshpass
322+
apt-get install -y screen
323+
- name: Run test
324+
run: |
325+
cd gigabyte-ampere-cuttlefish-installer
326+
mv ../preseed-mini.iso.xz .
327+
xz -d preseed-mini.iso.xz
328+
chmod a-w preseed-mini.iso
329+
cp -f tests/installer-iso-* .
330+
echo "Run installer on qemu"
331+
./installer-iso-install.expect
332+
echo "Installation successed"
333+
echo "Download cuttlefish"
334+
./utils/download-ci-cf.sh
335+
echo "Start qemu"
336+
screen -d -m -L -Logfile console_001.log ./installer-iso-run-qemu.sh
337+
echo "Wait for system run"
338+
while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done
339+
cp -f console_001.log console_001_p1.log
340+
CONSOLELINES=$(cat console_001_p1.log | wc -l)
341+
cat console_001_p1.log
342+
grep "login:" console_001_p1.log > /dev/null
343+
echo "Deploy cuttlefish"
344+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k apt-get install -y unzip'
345+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'mkdir cf'
346+
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 cvd-host_package.tar.gz vsoc-01@localhost:/home/vsoc-01/
347+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; tar -xvf ../cvd-host_package.tar.gz'
348+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f cvd-host_package.tar.gz'
349+
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 aosp_cf_arm64*_phone-*.zip vsoc-01@localhost:/home/vsoc-01/
350+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; unzip ../aosp_cf_arm64*_phone-*.zip'
351+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f aosp_cf_arm64*_phone-*.zip'
352+
echo "We cannot run cuttlefish in qemu due to lack of kvm. Just launch_cvd for testing"
353+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; HOME=$PWD ./bin/launch_cvd -help' || true
354+
echo "Show apt-cache policy"
355+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'apt-cache policy'
356+
echo "Test for lzop"
357+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'lzop -V'
358+
echo "Test for Google NTP"
359+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p'
360+
CHECK_GOOGLE_TIME_SERVER=0
361+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p' | grep 'time1.google' && CHECK_GOOGLE_TIME_SERVER=1
362+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p' | grep '.GOOG.' && CHECK_GOOGLE_TIME_SERVER=1
363+
if [ x"${CHECK_GOOGLE_TIME_SERVER}" != x"1" ]; then echo "Google Time Servers not found!"; false; fi
364+
echo "Test for ulimit"
365+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -a'
366+
test $(sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -n') -ge 2048
367+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'update-alternatives --display iptables' | grep "link currently points to /usr/sbin/iptables-legacy"
368+
echo "Shutdown qemu."
369+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k shutdown -h 1'
370+
echo "Wait for qemu stop"
371+
while ! grep "reboot: Power down" console_001.log; do sleep 30; done
372+
tail -n +"${CONSOLELINES}" console_001.log

0 commit comments

Comments
 (0)