diff --git a/.github/workflows/build-and-s3-upload.yml b/.github/workflows/build-and-s3-upload.yml index f47cd0e..95281a4 100644 --- a/.github/workflows/build-and-s3-upload.yml +++ b/.github/workflows/build-and-s3-upload.yml @@ -24,7 +24,7 @@ jobs: - name: Install build dependencies run: | sudo apt-get update -q - sudo apt-get install -y podman podman-compose bmap-tools pigz + sudo apt-get install -y podman podman-compose bmap-tools pigz qemu-utils - name: Make image generator executable run: chmod +x .release/generate_images.sh diff --git a/.github/workflows/ci-build13.yml b/.github/workflows/ci-build13.yml index 6e72031..938b961 100644 --- a/.github/workflows/ci-build13.yml +++ b/.github/workflows/ci-build13.yml @@ -27,7 +27,7 @@ jobs: - name: Install build dependencies run: | sudo apt-get update -q - sudo apt-get install -y podman podman-compose bmap-tools pigz + sudo apt-get install -y podman podman-compose bmap-tools pigz qemu-utils - name: Make ci_build.sh executable (if needed) run: chmod +x .release/generate_images.sh @@ -37,6 +37,22 @@ jobs: .release/generate_images.sh --tag ci shell: bash + - name: Upload hypervisor image artifact + uses: actions/upload-artifact@v7 + with: + name: hypervisor-image + path: release-files/*virtual-cluster*.qcow2 + if-no-files-found: error + retention-days: 1 + + - name: Upload VM image artifact + uses: actions/upload-artifact@v7 + with: + name: vm-image + path: release-files/*guest*.qcow2 + if-no-files-found: error + retention-days: 1 + - name: Collect FAI logs on failure if: failure() run: | @@ -45,7 +61,7 @@ jobs: - name: Upload FAI logs if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: fai-logs-${{ github.run_id }} path: fai-logs.tar.gz @@ -53,3 +69,11 @@ jobs: - name: Check exit code run: echo "Script exited successfully!" + test-virtual-cluster: + needs: CI-build + uses: paullgk/virtual-cluster/.github/workflows/debian-setup.yml@main + with: + hypervisor_image_url: /tmp/images/hypervisor.qcow2 + hypervisor_image_filename: seapath-ci-generic-virtual-cluster.rootfs.raw.qcow2 + vm_image_url: /tmp/images/vm.qcow2 + vm_image_filename: seapath-ci-guest.qcow2 diff --git a/.release/generate_images.sh b/.release/generate_images.sh index becec12..aea377b 100755 --- a/.release/generate_images.sh +++ b/.release/generate_images.sh @@ -84,27 +84,34 @@ QCOW="seapath-${VERSION}-guest.qcow2" STANDALONE="seapath-${VERSION}-generic-standalone.rootfs" CLUSTER="seapath-${VERSION}-generic-cluster.rootfs" OBSERVER="seapath-${VERSION}-generic-observer.rootfs" +VIRTUAL_HYPERVISOR="seapath-${VERSION}-generic-virtual-cluster.rootfs" build_role() { local role="$1" local base="$2" shift 2 ./generate_seapath_image.sh "$role" "$@" - mv -f seapath.raw.gz "${base}.raw.gz" - mv -f seapath.raw.bmap "${base}.raw.bmap" + + if [ "$role" == "virtual-hypervisor" ]; then + mv -f seapath.raw.qcow2 "${base}.raw.qcow2" + else + mv -f seapath.raw.gz "${base}.raw.gz" + mv -f seapath.raw.bmap "${base}.raw.bmap" + fi } mkdir -p release-files/ -./build_iso.sh -mv -f seapath.iso release-files/"$ISO" +# ./build_iso.sh +# mv -f seapath.iso release-files/"$ISO" ./build_qcow2.sh mv -f seapath-vm.qcow2 release-files/"$QCOW" -build_role standalone release-files/"$STANDALONE" -c -build_role cluster release-files/"$CLUSTER" -c --ceph-disk -build_role observer release-files/"$OBSERVER" -c +# build_role standalone release-files/"$STANDALONE" -c +# build_role cluster release-files/"$CLUSTER" -c --ceph-disk +# build_role observer release-files/"$OBSERVER" -c +build_role virtual-hypervisor release-files/"$VIRTUAL_HYPERVISOR" -c --ceph-disk if $PUBLISH; then gh release upload "$TAG" \ @@ -116,5 +123,6 @@ if $PUBLISH; then release-files/"${CLUSTER}.raw.bmap" \ release-files/"${OBSERVER}.raw.gz" \ release-files/"${OBSERVER}.raw.bmap" \ + release-files/"$VIRTUAL_HYPERVISOR" \ --clobber fi diff --git a/generate_seapath_image.sh b/generate_seapath_image.sh index 86b347d..67ebdf1 100755 --- a/generate_seapath_image.sh +++ b/generate_seapath_image.sh @@ -19,6 +19,7 @@ print_usage() { echo " standalone Generate a standalone hypervisor image" echo " cluster Generate a hypervisor image for cluster deployment" echo " observer Generate a cluster observer node image" + echo " virtual-hypervisor Generate a qcow2 virtual hypervisor image " echo "" echo "Options:" echo " -h, --help Display this help message" @@ -141,10 +142,10 @@ while true; do fi ;; --ceph-disk) - if [ "$ROLE" == "cluster" ]; then + if [ "$ROLE" == "cluster" ] || [ "$ROLE" == "virtual-hypervisor" ]; then CEPH_DISK=true else - echo "Warning: --ceph-disk option is only applicable for 'cluster' role. Ignoring." >&2 + echo "Warning: --ceph-disk option is only applicable for 'cluster' and 'virtual-hypervisor' roles. Ignoring." >&2 fi shift ;; @@ -174,17 +175,17 @@ while true; do esac done -if [[ "$ROLE" != "standalone" && "$ROLE" != "cluster" && "$ROLE" != "observer" ]]; then +if [[ "$ROLE" != "standalone" && "$ROLE" != "cluster" && "$ROLE" != "observer" && "$ROLE" != "virtual-hypervisor" ]]; then echo "Error: Invalid role specified: $ROLE" >&2 exit 1 fi IFS=',' CLASSES=(FAIBASE DEBIAN GRUB_EFI SEAPATH_COMMON) -if [ "$ROLE" == "standalone" ] || [ "$ROLE" == "cluster" ]; then +if [ "$ROLE" == "standalone" ] || [ "$ROLE" == "cluster" ] || [ "$ROLE" == "virtual-hypervisor" ]; then CLASSES+=("SEAPATH_HOST") fi -if [ "$ROLE" == "cluster" ] || [ "$ROLE" == "observer" ]; then +if [ "$ROLE" == "cluster" ] || [ "$ROLE" == "observer" ] || [ "$ROLE" == "virtual-hypervisor" ]; then CLASSES+=("SEAPATH_CLUSTER") fi if [ "$COCKPIT" = true ]; then @@ -323,16 +324,24 @@ sudo chown -R "$(id -u):$(id -g)" "$output_dir/"* # Clean the build directory sudo rm -rf "$ext_dir" -if command -v bmaptool >/dev/null ; then +if [ "$ROLE" == "virtual-hypervisor" ]; then + qemu-img convert \ + -f raw -O qcow2 \ + -S 4k \ + -o preallocation=off,lazy_refcounts=on,compat=1.1 \ + "$output_dir/${OUTPUT}" "$output_dir/${OUTPUT}.qcow2" - bmaptool create -o "$output_dir/${OUTPUT}.bmap" "$output_dir/${OUTPUT}" +else + if command -v bmaptool >/dev/null ; then + + bmaptool create -o "$output_dir/${OUTPUT}.bmap" "$output_dir/${OUTPUT}" - if command -v pigz >/dev/null ; then - pigz "$output_dir/${OUTPUT}" - else - gzip "$output_dir/${OUTPUT}" + if command -v pigz >/dev/null ; then + pigz "$output_dir/${OUTPUT}" + else + gzip "$output_dir/${OUTPUT}" + fi + generate_seapath_metadata fi - generate_seapath_metadata fi - echo "SEAPATH image generation completed."