-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathcloud-init-image-for-cuttlefish.yaml
More file actions
145 lines (142 loc) · 7.82 KB
/
cloud-init-image-for-cuttlefish.yaml
File metadata and controls
145 lines (142 loc) · 7.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Workflow for Cloud init image for Cuttlefish
on:
pull_request:
paths:
- 'cloud-init-image-for-cuttlefish/**'
push:
branchs:
- '**'
jobs:
build-cidata-iso-job:
runs-on: ubuntu-22.04
container:
image: debian@sha256:9258a75a7e4323c9e5562b361effc84ee747920116d8adfc98a465a5cdc9150e # debian:bookworm-20250407 (amd64)
defaults:
run:
working-directory: ./cloud-init-image-for-cuttlefish
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setting up build environment
run: |
apt-get update
apt-get upgrade -y
apt-get install -y sudo
apt-get install -y ca-certificates
apt-get install -y cloud-init
apt-get install -y xorriso genisoimage
- name: Check user-data
run: |
./check_user_data.sh
- name: Create gigabyte-cidata.iso image
run: |
./gen_cidata_iso.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cloud-init-image-for-cuttlefish-artifacts
path: cloud-init-image-for-cuttlefish/gigabyte-cidata.iso
test-qemu-cloud-arm64-cidata-job:
needs: build-cidata-iso-job
runs-on: ubuntu-22.04
container:
image: debian:trixie # debian:trixie (amd64)
defaults:
run:
working-directory: ./cloud-init-image-for-cuttlefish
env:
TEST_DISK_SIZE: "10G"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cloud-init-image-for-cuttlefish-artifacts
- name: Prepare test environment
run: |
apt-get update
apt-get upgrade -y
apt-get install -y sudo
apt-get install -y debconf-utils
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
dpkg-reconfigure --frontend noninteractive tzdata
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
dpkg-reconfigure --frontend noninteractive pbuilder
apt-get install -y util-linux util-linux-extra
apt-get install -y xz-utils
apt-get install -y qemu-system-arm
apt-get install -y expect
apt-get install -y e2tools e2fsprogs
apt-get install -y guestfish
apt-get install -y lvm2
apt-get install -y ubuntu-dev-tools
apt-get install -y u-boot-qemu
apt-get install -y wget curl
apt-get install -y openssh-client sshpass
apt-get install -y screen
- name: Download Debian
run: |
./download_debian.sh
- name: Download Cuttlefish
run: |
../gigabyte-ampere-cuttlefish-installer/utils/download-ci-cf.sh
- name: Move artifacts to current working directory.
run: |
mv ../gigabyte-cidata.iso .
- name: Cloud image first boot with qemu
run: |
screen -d -m -L -Logfile console_001.log ./run_qemu.sh
while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done
cp -f console_001.log console_001_p1.log
CONSOLELINES=$(cat console_001_p1.log | wc -l)
cat console_001_p1.log
grep "login:" console_001_p1.log > /dev/null
echo "CONSOLELINES=${CONSOLELINES}" >> $GITHUB_ENV
- name: Wait for post install script finish
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'while [ ! -e /var/log/custom-startup.log ]; do sleep 30; echo "Check custom-startup.log"; done'
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 vsoc-01@localhost:/var/log/custom-startup.log ./custom-startup.log
CUSTOM_LOG_LINES=$(wc -l < ./custom-startup.log)
cat ./custom-startup.log
while ! grep "VM successful" ./custom-startup.log; do sleep 30; sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 vsoc-01@localhost:/var/log/custom-startup.log ./custom-startup.log; tail -n +${CUSTOM_LOG_LINES} ./custom-startup.log; CUSTOM_LOG_LINES=$(wc -l < ./custom-startup.log); done
- name: Deploy cuttlefish
run: |
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'
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'mkdir cf'
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 cvd-host_package.tar.gz vsoc-01@localhost:/home/vsoc-01/
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'
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f cvd-host_package.tar.gz'
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 aosp_cf_arm64*_phone-*.zip vsoc-01@localhost:/home/vsoc-01/
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; unzip ../aosp_cf_arm64*_phone-*.zip'
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f aosp_cf_arm64*_phone-*.zip'
- name: Run cuttlefish command line
run: |
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
- name: Run apt-cache policy
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'apt-cache policy'
- name: Test for lzop
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'lzop -V'
- name: Test for Google NTP server
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p'
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
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
if [ x"${CHECK_GOOGLE_TIME_SERVER}" != x"1" ]; then echo "Google Time Servers not found!"; false; fi
- name: Test for ulimit
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -a'
test $(sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -n') -ge 2048
- name: Test for iptables command
run: |
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"
- name: Shutdown qemu
run: |
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k shutdown -h 1'
while ! grep "reboot: Power down" console_001.log; do sleep 30; done
tail -n +"${CONSOLELINES}" console_001.log