Skip to content

CI: add vz #1511

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

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,28 @@ jobs:
retry_on: error
max_attempts: 3
command: ./hack/test-upgrade.sh ${{ matrix.oldver }} ${{ github.sha }}

vz:
name: "vz"
runs-on: macos-13
timeout-minutes: 120
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Make
run: make
- name: Install
run: make install
- name: Install test dependencies
run: brew install qemu bash coreutils
- name: Cache ~/Library/Caches/lima/download
uses: actions/cache@v3
with:
path: ~/Library/Caches/lima/download
key: ${{ runner.os }}-vz
- name: Test
run: ./hack/test-example.sh examples/experimental/vz.yaml
19 changes: 15 additions & 4 deletions hack/test-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ NAME="$(basename -s .yaml "$FILE")"
INFO "Validating \"$FILE\""
limactl validate "$FILE"

# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
LIMACTL_CREATE_SET='.cpus = 1 | .memory="1GiB"'
# TODO: add "limactl create" command
LIMACTL_CREATE_AND_START=(limactl start --tty=false --set="${LIMACTL_CREATE_SET}")

declare -A CHECKS=(
["systemd"]="1"
["systemd-strict"]="1"
Expand Down Expand Up @@ -60,6 +65,12 @@ case "$NAME" in
CHECKS["snapshot-online"]=""
CHECKS["user-v2"]=1
;;
"vz")
CHECKS["systemd-strict"]=
CHECKS["port-forwards"]=""
CHECKS["snapshot-online"]=""
CHECKS["snapshot-offline"]=""
;;
esac

if limactl ls -q | grep -q "$NAME"; then
Expand All @@ -83,8 +94,8 @@ function diagnose() {
NAME="$1"
set -x +e
tail "$HOME/.lima/${NAME}"/*.log
limactl shell "$NAME" systemctl status
limactl shell "$NAME" systemctl
limactl shell "$NAME" systemctl --no-pager status
limactl shell "$NAME" systemctl --no-pager
limactl shell "$NAME" sudo cat /var/log/cloud-init-output.log
set +x -e
}
Expand All @@ -102,7 +113,7 @@ if [[ -n ${CHECKS["disk"]} ]]; then
fi

set -x
if ! limactl start --tty=false "$FILE"; then
if ! "${LIMACTL_CREATE_AND_START[@]}" "$FILE"; then
ERROR "Failed to start \"$NAME\""
diagnose "$NAME"
exit 1
Expand Down Expand Up @@ -317,7 +328,7 @@ fi
if [[ -n ${CHECKS["user-v2"]} ]]; then
INFO "Testing user-v2 network"
secondvm="$NAME-1"
limactl start "$FILE" --name "$secondvm" --tty=false
"${LIMACTL_CREATE_AND_START[@]}" "$FILE" --name "$secondvm"
guestNewip="$(limactl shell "$secondvm" ip -4 -j addr show dev eth0 | jq -r '.[0].addr_info[0].local')"
INFO "IP of $secondvm is $guestNewip"
set -x
Expand Down