From 0eddd97d9ed629110db5ebe19a5d087b29063500 Mon Sep 17 00:00:00 2001 From: Yi He Date: Thu, 21 Nov 2024 14:01:51 +0800 Subject: [PATCH] ci: add centos-stream-9 support --- .github/workflows/greenboot-ci.yaml | 23 +++++++++++++++++++++++ tests/greenboot-bootc-anaconda-iso.sh | 6 +++++- tests/greenboot-bootc-qcow2.sh | 12 ++++++++---- tests/greenboot-bootc.yaml | 22 ++++++++++++++++++++++ 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/.github/workflows/greenboot-ci.yaml b/.github/workflows/greenboot-ci.yaml index de1ef89..ef5f233 100644 --- a/.github/workflows/greenboot-ci.yaml +++ b/.github/workflows/greenboot-ci.yaml @@ -83,3 +83,26 @@ jobs: secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }}" variables: "ARCH=x86_64" timeout: 90 + + Centos-stream-9-bootc: + needs: check-pull-request + if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} + continue-on-error: true + runs-on: ubuntu-latest + + steps: + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v3.1.2 + with: + compose: CentOS-Stream-9 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.check-pull-request.outputs.repo_url }} + git_ref: ${{ needs.check-pull-request.outputs.ref }} + # update_pull_request_status: true + # pull_request_status_name: "Centos-stream-9-bootc" + tmt_context: "arch=x86_64;distro=cs-9" + tmt_plan_regex: bootc + tf_scope: private + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }}" + variables: "ARCH=x86_64" + timeout: 90 diff --git a/tests/greenboot-bootc-anaconda-iso.sh b/tests/greenboot-bootc-anaconda-iso.sh index 1093165..28dd6b2 100755 --- a/tests/greenboot-bootc-anaconda-iso.sh +++ b/tests/greenboot-bootc-anaconda-iso.sh @@ -36,21 +36,25 @@ case "${ID}-${VERSION_ID}" in OS_VARIANT="fedora-unknown" BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:41" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi" ;; "fedora-42") OS_VARIANT="fedora-unknown" BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:42" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi" ;; "centos-9") OS_VARIANT="centos-stream9" BASE_IMAGE_URL="quay.io/centos-bootc/centos-bootc:stream9" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" ;; "rhel-9.6") OS_VARIANT="rhel9-unknown" BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.6" BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.6" + BOOT_ARGS="uefi" ;; *) echo "unsupported distro: ${ID}-${VERSION_ID}" @@ -283,7 +287,7 @@ sudo virt-install --name="${TEST_UUID}-uefi"\ --os-type linux \ --os-variant ${OS_VARIANT} \ --cdrom "/var/lib/libvirt/images/install.iso" \ - --boot uefi \ + --boot ${BOOT_ARGS} \ --nographics \ --noautoconsole \ --wait=-1 \ diff --git a/tests/greenboot-bootc-qcow2.sh b/tests/greenboot-bootc-qcow2.sh index cdbf745..0cc1721 100755 --- a/tests/greenboot-bootc-qcow2.sh +++ b/tests/greenboot-bootc-qcow2.sh @@ -36,21 +36,25 @@ case "${ID}-${VERSION_ID}" in OS_VARIANT="fedora-unknown" BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:41" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi" ;; "fedora-42") OS_VARIANT="fedora-unknown" BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:42" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi" ;; "centos-9") OS_VARIANT="centos-stream9" BASE_IMAGE_URL="quay.io/centos-bootc/centos-bootc:stream9" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" + BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" ;; "rhel-9.6") OS_VARIANT="rhel9-unknown" BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.6" BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.6" + BOOT_ARGS="uefi" ;; *) echo "unsupported distro: ${ID}-${VERSION_ID}" @@ -172,7 +176,7 @@ cp rpmbuild/RPMS/x86_64/*.rpm tests/ && popd ## Build bootc container with greenboot installed ## ########################################################### -greenprint "Building rhel-edge-bootc container" +greenprint "Building bootc container with greenboot installed" podman login quay.io -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} podman login registry.stage.redhat.io -u ${STAGE_REDHAT_IO_USERNAME} -p ${STAGE_REDHAT_IO_TOKEN} tee Containerfile > /dev/null << EOF @@ -189,7 +193,7 @@ RUN dnf install -y \ RUN rm -f /tmp/greenboot-*.rpm EOF podman build --retry=5 --retry-delay=10s -t quay.io/${QUAY_USERNAME}/greenboot-bootc:${TEST_UUID} -f Containerfile . -greenprint "Pushing greenboot-bootc container to quay.io" +greenprint "Pushing bootc container to quay.io" podman push quay.io/${QUAY_USERNAME}/greenboot-bootc:${TEST_UUID} ########################################################### @@ -237,7 +241,7 @@ podman run \ ## Provision vm with qcow2/iso artifacts ## ########################################################### -greenprint "Installing vm with bootc qcow2 image" +greenprint "Installing vm with bootc qcow2/iso image" mv $(pwd)/output/qcow2/disk.qcow2 /var/lib/libvirt/images/${TEST_UUID}-disk.qcow2 LIBVIRT_IMAGE_PATH_UEFI=/var/lib/libvirt/images/${TEST_UUID}-disk.qcow2 sudo restorecon -Rv /var/lib/libvirt/images/ @@ -248,7 +252,7 @@ sudo virt-install --name="${TEST_UUID}-uefi"\ --network network=integration,mac=34:49:22:B0:83:30 \ --os-type linux \ --os-variant ${OS_VARIANT} \ - --boot uefi \ + --boot ${BOOT_ARGS} \ --nographics \ --noautoconsole \ --wait=-1 \ diff --git a/tests/greenboot-bootc.yaml b/tests/greenboot-bootc.yaml index a15bbb4..53a6a56 100644 --- a/tests/greenboot-bootc.yaml +++ b/tests/greenboot-bootc.yaml @@ -57,6 +57,28 @@ - name: failed count + 1 set_fact: failed_counter: "{{ failed_counter | int + 1 }}" + when: ansible_facts['distribution'] == 'Fedora' + + # case: check greenboot* services + - name: a list of greenboot* service should be enabled + block: + - name: a list of greenboot* service should be enabled + command: systemctl is-enabled greenboot-grub2-set-counter greenboot-grub2-set-success greenboot-healthcheck greenboot-rpm-ostree-grub2-check-fallback greenboot-status greenboot-task-runner redboot-auto-reboot redboot-task-runner + register: result_greenboot_service + + - assert: + that: + - result_greenboot_service.stdout == 'enabled\nenabled\nenabled\nenabled\nenabled\nenabled\nenabled\nenabled' + fail_msg: "Some of greenboot* services are not enabled" + success_msg: "All greenboot* services are enabled" + always: + - set_fact: + total_counter: "{{ total_counter | int + 1 }}" + rescue: + - name: failed count + 1 + set_fact: + failed_counter: "{{ failed_counter | int + 1 }}" + when: ansible_facts['distribution'] != 'Fedora' # case: check greenboot fall back log - name: fallback log should be found here