diff --git a/README.md b/README.md index dd7228d..e77b2f0 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,10 @@ To build the base vm image: - Download images into /var/lib/libvirt/images - Windows 10 (multi-edition ISO), English (United States): [Win10_22H2_English_x64v1.iso](https://www.microsoft.com/en-us/software-download/windows10ISO) (sha256 = a6f470ca6d331eb353b815c043e327a347f594f37ff525f17764738fe812852e) -- Run the build script: `windows10/build-image.sh` +- Run the build script: `windows10/build-image.sh ` - FIXME: if Windows fails to autologon (stuck at lock screen): `virsh reboot servo-windows10.new` -- Update the profile config in `monitor/monitor.toml` to point to the new zvol snapshot, e.g. `base_image_snapshot = "build-image-2025-01-01T11:30Z"` +- Update the profile config in `monitor/monitor.toml` to point to the new zvol snapshot, e.g. `base_image_snapshot = ""` +- Restart the monitor: `systemctl restart monitor` To clone and start a new runner: @@ -130,8 +131,9 @@ Runners created from this image preinstall all dependencies (including those spe To build the base vm image: -- Run the build script: `ubuntu2204/build-image.sh` -- Update the profile config in `monitor/monitor.toml` to point to the new zvol snapshot, e.g. `base_image_snapshot = "build-image-2025-01-01T11:30Z"` +- Run the build script: `ubuntu2204/build-image.sh ` +- Update the profile config in `monitor/monitor.toml` to point to the new zvol snapshot, e.g. `base_image_snapshot = ""` +- Restart the monitor: `systemctl restart monitor` To clone and start a new runner: diff --git a/ubuntu2204/build-image.sh b/ubuntu2204/build-image.sh index 731f656..db3b089 100755 --- a/ubuntu2204/build-image.sh +++ b/ubuntu2204/build-image.sh @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -# usage: ubuntu2204/build-image.sh +# usage: ubuntu2204/build-image.sh image_dir=${0:a:h} script_dir=${0:a:h}/.. . "$script_dir/common.sh" @@ -9,6 +9,7 @@ cache_dir=$script_dir/cache . "$script_dir/inject.sh" undo_commands=$(mktemp) image_name=servo-ubuntu2204 +snapshot_name=$1; shift >&2 echo '[*] Caching downloads' download "$cache_dir" https://cloud-images.ubuntu.com/jammy/20241217/jammy-server-cloudimg-amd64.img 0d8345a343c2547e55ac815342e6cb4a593aa5556872651eb47e6856a2bb0cdd @@ -21,6 +22,7 @@ zfs list -Ho name "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" || zfs create -V 90G >&2 echo '[*] Creating libvirt guest (or recreating it with new config)' if virsh domstate -- "$image_name"; then + virsh destroy -- "$image_name" || : # FIXME make this idempotent in a less noisy way? virsh undefine -- "$image_name" fi virsh define -- "$image_dir/guest.xml" @@ -74,8 +76,7 @@ fi >&2 echo '[*] Checking that Servo was built correctly' ./mount-runner.sh "$image_name" sh -c 'ls init/built_servo_once_successfully' -snapshot=$(date -u +\%FT\%RZ) ->&2 echo "[*] Taking zvol snapshot: $SERVO_CI_ZFS_CLONE_PREFIX/$image_name@build-image-$snapshot" -zfs snapshot "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name@build-image-$snapshot" +>&2 echo "[*] Taking zvol snapshot: $SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" +zfs snapshot "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" >&2 echo '[*] Done!' diff --git a/windows10/build-image.sh b/windows10/build-image.sh index f44fe6a..2a6ab25 100755 --- a/windows10/build-image.sh +++ b/windows10/build-image.sh @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -# usage: windows10/build-image.sh +# usage: windows10/build-image.sh image_dir=${0:a:h} script_dir=${0:a:h}/.. . "$script_dir/common.sh" @@ -9,6 +9,7 @@ cache_dir=$script_dir/cache . "$script_dir/inject.sh" undo_commands=$(mktemp) image_name=servo-windows10 +snapshot_name=$1; shift >&2 echo '[*] Caching downloads' download "$cache_dir" https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.240-1/virtio-win-0.1.240.iso ebd48258668f7f78e026ed276c28a9d19d83e020ffa080ad69910dc86bbcbcc6 @@ -18,6 +19,7 @@ zfs list -Ho name "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" || zfs create -V 90G >&2 echo '[*] Creating libvirt guest (or recreating it with new config)' if virsh domstate -- "$image_name"; then + virsh destroy -- "$image_name" || : # FIXME make this idempotent in a less noisy way? virsh undefine -- "$image_name" fi virsh define -- "$image_dir/guest.xml" @@ -71,8 +73,7 @@ fi >&2 echo '[*] Checking that Servo was built correctly' ./mount-runner.sh "$image_name" sh -c 'ls -l init/built_servo_once_successfully' -snapshot=$(date -u +\%FT\%RZ) ->&2 echo "[*] Taking zvol snapshot: $SERVO_CI_ZFS_CLONE_PREFIX/$image_name@build-image-$snapshot" -zfs snapshot "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name@build-image-$snapshot" +>&2 echo "[*] Taking zvol snapshot: $SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" +zfs snapshot "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" >&2 echo '[*] Done!'