-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add a qemu/arm64 VM to GH workflows #515
Open
rchincha
wants to merge
1
commit into
project-stacker:main
Choose a base branch
from
rchincha:qemu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: QEMU environment | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build-linux-arm64: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install VM dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-system-arm qemu-efi-aarch64 qemu-utils cloud-image-utils wget | ||
- name: Provision VM | ||
run: | | ||
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img | ||
|
||
qemu-img create -f qcow2 -F qcow2 \ | ||
-b jammy-server-cloudimg-arm64.img \ | ||
jammy-snapshot.qcow2 200G | ||
|
||
cat >"user-data" << EOF | ||
#cloud-config | ||
password: passw0rd | ||
chpasswd: { expire: False } | ||
ssh_pwauth: True | ||
EOF | ||
cloud-localds user-data.img user-data | ||
|
||
cp /usr/share/AAVMF/AAVMF_CODE.fd . | ||
cp /usr/share/AAVMF/AAVMF_VARS.fd . | ||
|
||
qemu-system-aarch64 \ | ||
-m 2048 \ | ||
-cpu max -smp 4 \ | ||
-machine virt,gic-version=max \ | ||
-display none \ | ||
-drive if=pflash,format=raw,readonly=on,file=AAVMF_CODE.fd \ | ||
-drive if=pflash,format=raw,file=AAVMF_VARS.fd \ | ||
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0,cache=unsafe \ | ||
-device virtio-blk-device,drive=hd0 \ | ||
-drive file=user-data.img,format=raw,media=cdrom,if=none,id=cd0 \ | ||
-device virtio-blk-device,drive=cd0 \ | ||
-netdev type=user,id=net0,hostfwd=tcp::22225-:22 \ | ||
-device virtio-net-device,netdev=net0 \ | ||
-daemonize | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y sshpass | ||
- name: Check ssh connectivity | ||
run: | | ||
set +e | ||
while true; do | ||
echo Trying to connect | ||
sshpass -p passw0rd ssh -v -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22225 ubuntu@localhost whoami | ||
if [ $? -eq 0 ]; then | ||
break | ||
fi | ||
ps -axf | grep qemu | ||
netstat -tnlp | ||
sudo dmesg | ||
echo "intel" | ||
cat /sys/module/kvm_intel/parameters/nested | ||
echo "amd" | ||
cat /sys/module/kvm_amd/parameters/nested | ||
sleep 10 | ||
done | ||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if we can use the githubToken thing to save the state of the image after we do all of the steps to prep for running the VM?
Wasn't sure if that's only used in that run-on-arch-action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specific to that action iinm