Skip to content

Commit

Permalink
ci: add qemu installer
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Jul 20, 2023
1 parent 507c9e3 commit d7859c4
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,54 @@ jobs:
privilege-level: ${{fromJson(inputs.privilege-level)}}
build-id: ${{fromJson(inputs.build-id)}}
arch: ["aarch64"]
name: "golang ${{ matrix.go-version }} privilege ${{ matrix.privilege-level }}"
name: "${{ matrix.arch }}/golang ${{ matrix.go-version }} privilege ${{ matrix.privilege-level }}"
steps:
- uses: actions/checkout@v3
- uses: benjlevesque/short-sha@v2.1
id: short-sha
- name: qemu-${{ matrix.arch }}
run: |
sudo apt-get update
sudo apt-get -y install qemu-system-arm qemu-efi-aarch64 qemu-utils cloud-image-utils sshpass
curl -Lo cloud.img https://cloud-images.ubuntu.com/releases/lunar/release/ubuntu-23.04-server-cloudimg-arm64.img
# cloud-config
cat > metadata.yaml <<EOF
instance-id: qemu-arm64
local-hostname: qemu-arm64
EOF
#cloud-config
cat > user-data.yaml <<EOF
users:
- name: ubuntu
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh_pwauth: True ## This line enables ssh password authentication
chpasswd:
list: |
ubuntu:ubuntu ## Overriding default username, password
EOF
cloud-localds seed.img user-data.yaml metadata.yaml
qemu-system-${{ matrix.arch }} \
-daemonize \
-display none \
-M virt -cpu max \
-bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
-m 2G \
-device virtio-net-pci,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-drive if=virtio,format=qcow2,file=cloud.img \
-drive if=virtio,format=raw,file=seed.img
# wait until ready
echo "Waiting for ssh to be ready ..."
while true; do
x=$(ssh-keyscan -v -p 2222 localhost) || true
echo "$x"
if [ "$x"x != "x" ]; then
break
fi
sleep 5
done
sshpass -p ubuntu ssh -o "StrictHostKeyChecking no" -p 2222 ubuntu@localhost "uname -rsa"
- uses: uraimo/run-on-arch-action@v2
name: Build for ${{ matrix.arch }}
id: runcmd
Expand Down

0 comments on commit d7859c4

Please sign in to comment.