From 7226fa98bc533bd466f226d2920ea32b0511895a Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Wed, 1 May 2024 10:10:00 +0800 Subject: [PATCH] test: add fedora bootc image test Signed-off-by: Xiaofeng Wang --- .github/workflows/anaconda.yml | 84 +++++++++++- .github/workflows/bib-image.yml | 128 ++++++++++++++++++ .github/workflows/os-replace.yml | 76 +++++++++++ anaconda.sh | 68 +++++----- bib-image.sh | 11 +- .../conf.d/99-azure-unmanaged-devices.conf | 4 + files/copr-coreos-continuous.template | 10 ++ os-replace.sh | 20 +++ playbooks/check-system.yaml | 31 ++++- playbooks/deploy-azure.yaml | 23 ++++ playbooks/deploy-beaker.yaml | 4 + playbooks/deploy-gcp.yaml | 12 +- playbooks/deploy-libvirt.yaml | 24 ++++ playbooks/deploy-openstack.yaml | 2 + playbooks/install.yaml | 6 +- tmt/plans/anaconda.fmf | 19 +++ tools/shared_lib.sh | 8 +- tools/upload_gcp.yml | 71 ++++++++++ tools/upload_openstack.yml | 45 ++++++ 19 files changed, 600 insertions(+), 46 deletions(-) create mode 100644 files/azure/etc/NetworkManager/conf.d/99-azure-unmanaged-devices.conf create mode 100644 files/copr-coreos-continuous.template create mode 100644 tools/upload_gcp.yml create mode 100644 tools/upload_openstack.yml diff --git a/.github/workflows/anaconda.yml b/.github/workflows/anaconda.yml index 257b1fa..7db71b1 100644 --- a/.github/workflows/anaconda.yml +++ b/.github/workflows/anaconda.yml @@ -18,7 +18,11 @@ jobs: endsWith(github.event.comment.body, '/test-cs9') || endsWith(github.event.comment.body, '/test-cs9-anaconda') || endsWith(github.event.comment.body, '/test-cs9-dev') || - endsWith(github.event.comment.body, '/test-cs9-dev-anaconda')) }} + endsWith(github.event.comment.body, '/test-cs9-dev-anaconda')) || + endsWith(github.event.comment.body, '/test-fedora-40') || + endsWith(github.event.comment.body, '/test-fedora-40-anaconda') || + endsWith(github.event.comment.body, '/test-fedora-41') || + endsWith(github.event.comment.body, '/test-fedora-41-anaconda')) }} runs-on: ubuntu-latest steps: - name: Query author repository permissions @@ -208,6 +212,84 @@ jobs: secrets: "TIER1_IMAGE_URL=${{ secrets.CS9_DEV_TIER1_IMAGE_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};CERT_URL=${{ secrets.CERT_URL }}" variables: "FIRMWARE=${{ matrix.firmware }};PARTITION=${{ matrix.partition }}" + fedora-40-anaconda: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-fedora-40') || + endsWith(github.event.comment.body, '/test-fedora-40-anaconda')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + partition: [standard, lvm, btrfs] + firmware: [bios, uefi] + exclude: + - firmware: bios + arch: aarch64 + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-40-${{ matrix.arch }}-anaconda-${{ matrix.firmware }}-${{ matrix.partition }}" + tmt_plan_regex: "${{ matrix.firmware }}-${{ matrix.partition }}" + tf_scope: private + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};CERT_URL=${{ secrets.CERT_URL }}" + variables: "FIRMWARE=${{ matrix.firmware }};PARTITION=${{ matrix.partition }};TIER1_IMAGE_URL=${{ vars.FEDORA_40_TIER1_IMAGE_URL }}" + + fedora-41-anaconda: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-fedora-41') || + endsWith(github.event.comment.body, '/test-fedora-41-anaconda')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + partition: [standard, lvm, btrfs] + firmware: [bios, uefi] + exclude: + - firmware: bios + arch: aarch64 + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-41-${{ matrix.arch }}-anaconda-${{ matrix.firmware }}-${{ matrix.partition }}" + tmt_plan_regex: "${{ matrix.firmware }}-${{ matrix.partition }}" + tf_scope: private + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};CERT_URL=${{ secrets.CERT_URL }}" + variables: "FIRMWARE=${{ matrix.firmware }};PARTITION=${{ matrix.partition }};TIER1_IMAGE_URL=${{ vars.FEDORA_41_TIER1_IMAGE_URL }}" + rhel9y-snapshot-anaconda: needs: pr-info if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && diff --git a/.github/workflows/bib-image.yml b/.github/workflows/bib-image.yml index ddd368c..9bd60c4 100644 --- a/.github/workflows/bib-image.yml +++ b/.github/workflows/bib-image.yml @@ -354,6 +354,134 @@ jobs: secrets: "TIER1_IMAGE_URL=${{ secrets.CS9_DEV_TIER1_IMAGE_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};GOVC_URL=${{ secrets.GOVC_URL }};GOVC_USERNAME=${{ secrets.GOVC_USERNAME }};GOVC_PASSWORD=${{ secrets.GOVC_PASSWORD }}" variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};IMAGE_TYPE=${{ matrix.image_type }};AWS_REGION=${{ secrets.AWS_REGION }};GOVC_INSECURE=1;FIRMWARE=${{ matrix.firmware }}" + f40-bib-image: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-f40') || + endsWith(github.event.comment.body, '/test-f40-bib-image')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + image_type: [ami, qcow2, vmdk, raw, anaconda-iso, to-disk] + firmware: [image] + exclude: + - arch: aarch64 + image_type: vmdk + - image_type: anaconda-iso + firmware: image + include: + - image_type: ami + platform: aws + - image_type: qcow2 + platform: libvirt + - image_type: vmdk + platform: vsphere + - image_type: raw + platform: libvirt + - image_type: to-disk + platform: libvirt + - image_type: anaconda-iso + platform: libvirt + arch: x86_64 + firmware: bios + - image_type: anaconda-iso + platform: libvirt + arch: x86_64 + firmware: uefi + - image_type: anaconda-iso + platform: libvirt + arch: aarch64 + firmware: uefi + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-40-${{ matrix.arch }}-bib-${{ matrix.image_type }}-${{ matrix.firmware }}" + tmt_plan_regex: "${{ matrix.image_type }}" + tf_scope: private + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};GOVC_URL=${{ secrets.GOVC_URL }};GOVC_USERNAME=${{ secrets.GOVC_USERNAME }};GOVC_PASSWORD=${{ secrets.GOVC_PASSWORD }}" + variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};IMAGE_TYPE=${{ matrix.image_type }};AWS_REGION=${{ secrets.AWS_REGION }};GOVC_INSECURE=1;FIRMWARE=${{ matrix.firmware }};TIER1_IMAGE_URL=${{ vars.FEDORA_40_TIER1_IMAGE_URL }}" + + f41-bib-image: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-f41') || + endsWith(github.event.comment.body, '/test-f41-bib-image')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + image_type: [ami, qcow2, vmdk, raw, anaconda-iso, to-disk] + firmware: [image] + exclude: + - arch: aarch64 + image_type: vmdk + - image_type: anaconda-iso + firmware: image + include: + - image_type: ami + platform: aws + - image_type: qcow2 + platform: libvirt + - image_type: vmdk + platform: vsphere + - image_type: raw + platform: libvirt + - image_type: to-disk + platform: libvirt + - image_type: anaconda-iso + platform: libvirt + arch: x86_64 + firmware: bios + - image_type: anaconda-iso + platform: libvirt + arch: x86_64 + firmware: uefi + - image_type: anaconda-iso + platform: libvirt + arch: aarch64 + firmware: uefi + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-41-${{ matrix.arch }}-bib-${{ matrix.image_type }}-${{ matrix.firmware }}" + tmt_plan_regex: "${{ matrix.image_type }}" + tf_scope: private + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};GOVC_URL=${{ secrets.GOVC_URL }};GOVC_USERNAME=${{ secrets.GOVC_USERNAME }};GOVC_PASSWORD=${{ secrets.GOVC_PASSWORD }}" + variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};IMAGE_TYPE=${{ matrix.image_type }};AWS_REGION=${{ secrets.AWS_REGION }};GOVC_INSECURE=1;FIRMWARE=${{ matrix.firmware }};TIER1_IMAGE_URL=${{ vars.FEDORA_41_TIER1_IMAGE_URL }}" + rhel9y-snapshot-bib-image: needs: pr-info if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && diff --git a/.github/workflows/os-replace.yml b/.github/workflows/os-replace.yml index 922840d..c7e1094 100644 --- a/.github/workflows/os-replace.yml +++ b/.github/workflows/os-replace.yml @@ -216,6 +216,82 @@ jobs: secrets: "TIER1_IMAGE_URL=${{ secrets.CS9_DEV_TIER1_IMAGE_URL }};OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }}" + fedora-40-replace: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-f40') || + endsWith(github.event.comment.body, '/test-f40-replace')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + platform: [openstack, gcp, aws, azure, libvirt, beaker, bare] + exclude: + - arch: aarch64 + platform: openstack + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-40-${{ matrix.arch }}-replace-${{ matrix.platform }}" + tmt_plan_regex: "${{ matrix.platform }}" + tf_scope: private + secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" + variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }};TIER1_IMAGE_URL=${{ vars.FEDORA_40_TIER1_IMAGE_URL }}" + + fedora-41-replace: + needs: pr-info + if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && + (endsWith(github.event.comment.body, '/test-f41') || + endsWith(github.event.comment.body, '/test-f41-replace')) }} + continue-on-error: true + strategy: + matrix: + arch: [x86_64, aarch64] + platform: [openstack, gcp, aws, azure, libvirt, beaker, bare] + exclude: + - arch: aarch64 + platform: openstack + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@v1 + with: + compose: Fedora-40 + api_key: ${{ secrets.TF_API_KEY }} + git_url: ${{ needs.pr-info.outputs.repo_url }} + git_ref: ${{ needs.pr-info.outputs.ref }} + arch: ${{ matrix.arch }} + tmt_context: "arch=${{ matrix.arch }}" + update_pull_request_status: true + pull_request_status_name: "bootc-fedora-41-${{ matrix.arch }}-replace-${{ matrix.platform }}" + tmt_plan_regex: "${{ matrix.platform }}" + tf_scope: private + secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" + variables: "PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }};TIER1_IMAGE_URL=${{ vars.FEDORA_41_TIER1_IMAGE_URL }}" + rhel9y-snapshot-replace: needs: pr-info if: ${{ needs.pr-info.outputs.allowed_user == 'true' && github.event.issue.pull_request && diff --git a/anaconda.sh b/anaconda.sh index fbd1c14..47e3544 100755 --- a/anaconda.sh +++ b/anaconda.sh @@ -97,12 +97,18 @@ case "$REDHAT_ID" in CUT_DIRS=6 ;; "fedora") + TEST_OS="${REDHAT_ID}-${REDHAT_VERSION_ID}" ADD_REPO="" ADD_RHC="" - BOOT_LOCATION="https://odcs.fedoraproject.org/composes/production/${CURRENT_COMPOSE_ID}/compose/BaseOS/${ARCH}/os/" - OS_VARIANT="fedora-rawhide" - BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" - CUT_DIRS=7 + if [[ "$REDHAT_VERSION_ID" == "40" ]]; then + BOOT_LOCATION="https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Everything/${ARCH}/os/" + OS_VARIANT="fedora-unknown" + else + BOOT_LOCATION="https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/${ARCH}/os/" + OS_VARIANT="fedora-rawhide" + fi + BOOT_ARGS="uefi" + CUT_DIRS=8 ;; *) redprint "Variable TIER1_IMAGE_URL is not supported" @@ -180,30 +186,21 @@ zerombr clearpart --all --initlabel --disklabel=gpt STOPHERE -if [[ "$PARTITION" == "lvm" ]]; then - if [[ "$FIRMWARE" == "bios" ]]; then - greenprint "BIOS LVM partition setup" - tee -a "$KS_FILE" > /dev/null << EOF -part biosboot --size=1 --fstype=biosboot -part /boot --size=1000 --fstype=ext4 --label=boot -part pv.01 --grow -volgroup bootc pv.01 -logvol / --vgname=bootc --fstype=xfs --size=10000 --name=root -EOF - else - greenprint "UEFI LVM partition setup" - tee -a "$KS_FILE" > /dev/null << EOF -part /boot/efi --size=100 --fstype=efi -part /boot --size=1000 --fstype=ext4 --label=boot -part pv.01 --grow -volgroup bootc pv.01 -logvol / --vgname=bootc --fstype=xfs --size=10000 --name=root -EOF - fi -else - greenprint "Standard partition setup" - echo "autopart --nohome --noswap --type=plain --fstype=xfs" >> "$KS_FILE" -fi +case "$PARTITION" in + "standard") + echo "autopart --nohome --type=plain --fstype=xfs" >> "$KS_FILE" + ;; + "lvm") + echo "autopart --nohome --type=lvm --fstype=xfs" >> "$KS_FILE" + ;; + "btrfs") + echo "autopart --nohome --type=btrfs" >> "$KS_FILE" + ;; + *) + redprint "Variable PARTITION has to be defined" + exit 1 + ;; +esac greenprint "Configure console log file" VIRT_LOG="/tmp/${TEST_OS}-${FIRMWARE}-${PARTITION}-console.log" @@ -258,10 +255,15 @@ EOF --wait \ --noreboot else - greenprint "Download boot.iso" - curl -O "${BOOT_LOCATION}images/boot.iso" - sudo mv boot.iso /var/lib/libvirt/images - LOCAL_BOOT_LOCATION="/var/lib/libvirt/images/boot.iso" + if [[ "$REDHAT_ID" == "fedora" ]] && [[ "$ARCH" == "aarch64" ]]; then + greenprint "Let's use URL as bootlocation" + LOCAL_BOOT_LOCATION="$BOOT_LOCATION" + else + greenprint "Download boot.iso" + curl -O "${BOOT_LOCATION}images/boot.iso" + sudo mv boot.iso /var/lib/libvirt/images + LOCAL_BOOT_LOCATION="/var/lib/libvirt/images/boot.iso" + fi if [[ "$FIRMWARE" == "bios" ]]; then greenprint "Install $TEST_OS via anaconda on $FIRMWARE VM" @@ -409,7 +411,7 @@ if [[ "$ARCH" == "x86_64" ]] && [[ "$FIRMWARE" == "uefi" ]] && [[ "$PARTITION" = sudo rm -rf "${HTTPD_PATH}/httpboot" sudo rm -f "${HTTPD_PATH}/ks.cfg" else - sudo rm -f "$LOCAL_BOOT_LOCATION" + sudo rm -f "/var/lib/libvirt/images/boot.iso" fi greenprint "🎉 All tests passed." diff --git a/bib-image.sh b/bib-image.sh index 9a7ffd6..d8ee576 100755 --- a/bib-image.sh +++ b/bib-image.sh @@ -89,10 +89,12 @@ EOF BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" ;; "fedora") + TEST_OS="${REDHAT_ID}-${REDHAT_VERSION_ID}" TEST_IMAGE_URL="quay.io/bootc-test/${TEST_IMAGE_NAME}:${QUAY_REPO_TAG}" SSH_USER="fedora" ADD_REPO="" ADD_RHC="" + GUEST_ID_DC70="fedora64Guest" BOOT_ARGS="uefi" ;; *) @@ -198,6 +200,13 @@ case "$IMAGE_TYPE" in --local \ "$LOCAL_IMAGE_URL" else + greenprint "Configure rootfs randomly" + ROOTFS_LIST=( \ + "ext4" \ + "xfs" \ + ) + RND_LINE=$((RANDOM % 2)) + ROOTFS="${ROOTFS_LIST[$RND_LINE]}" sudo podman run \ --rm \ -it \ @@ -214,7 +223,7 @@ case "$IMAGE_TYPE" in --aws-ami-name "$AMI_NAME" \ --aws-bucket "$AWS_BUCKET_NAME" \ --aws-region "$AWS_REGION" \ - --rootfs xfs \ + --rootfs "$ROOTFS" \ "$TEST_IMAGE_URL" fi diff --git a/files/azure/etc/NetworkManager/conf.d/99-azure-unmanaged-devices.conf b/files/azure/etc/NetworkManager/conf.d/99-azure-unmanaged-devices.conf new file mode 100644 index 0000000..1788493 --- /dev/null +++ b/files/azure/etc/NetworkManager/conf.d/99-azure-unmanaged-devices.conf @@ -0,0 +1,4 @@ +# Ignore SR-IOV interface on Azure, since it's transparently bonded +# to the synthetic interface +[keyfile] +unmanaged-devices=driver:mlx4_core;driver:mlx5_core diff --git a/files/copr-coreos-continuous.template b/files/copr-coreos-continuous.template new file mode 100644 index 0000000..6cf4ed0 --- /dev/null +++ b/files/copr-coreos-continuous.template @@ -0,0 +1,10 @@ +[copr-coreos-continuous] +name=Copr repo for continuous owned by @CoreOS +baseurl=https://download.copr.fedorainfracloud.org/results/@CoreOS/continuous/REPLACE_DISTRO-$basearch/ +type=rpm-md +skip_if_unavailable=True +gpgcheck=1 +gpgkey=https://download.copr.fedorainfracloud.org/results/@CoreOS/continuous/pubkey.gpg +repo_gpgcheck=0 +enabled=1 +enabled_metadata=1 diff --git a/os-replace.sh b/os-replace.sh index 9dddc57..6529ac9 100755 --- a/os-replace.sh +++ b/os-replace.sh @@ -70,9 +70,15 @@ EOF fi ;; "fedora") + TEST_OS="${REDHAT_ID}-${REDHAT_VERSION_ID}" SSH_USER="fedora" ADD_REPO="" ADD_RHC="" + if [[ "$REDHAT_VERSION_ID" == "40" ]]; then + sed "s/REPLACE_DISTRO/fedora-40/" files/copr-coreos-continuous.template | tee "${LAYERED_DIR}"/copr-coreos-continuous.repo > /dev/null + else + sed "s/REPLACE_DISTRO/fedora-rawhide/" files/copr-coreos-continuous.template | tee "${LAYERED_DIR}"/copr-coreos-continuous.repo > /dev/null + fi ;; *) redprint "Variable TIER1_IMAGE_URL is not supported" @@ -136,6 +142,20 @@ $USER_CONFIG $REPLACE_CLOUD_USER EOF +greenprint "Add bootupd workaround for Fedora aarch64 shim" +if [[ "$REDHAT_ID" == "fedora" ]]; then + tee -a "$INSTALL_CONTAINERFILE" > /dev/null << EOF +COPY copr-coreos-continuous.repo /etc/yum.repos.d/ +RUN dnf -y upgrade bootupd +EOF +fi + +# workaround issue https://issues.redhat.com/browse/RHEL-5880 +if [[ "$PLATFORM" == "azure" ]]; then + cp -r files/azure/etc "$LAYERED_DIR" + echo "COPY etc /etc/" >> "$INSTALL_CONTAINERFILE" +fi + greenprint "Check $TEST_OS installation Containerfile" cat "$INSTALL_CONTAINERFILE" diff --git a/playbooks/check-system.yaml b/playbooks/check-system.yaml index 7c4a8e2..1b99743 100644 --- a/playbooks/check-system.yaml +++ b/playbooks/check-system.yaml @@ -105,12 +105,19 @@ failed_counter: "{{ failed_counter | int + 1 }}" - name: set mount point device name - command: findmnt -r -o SOURCE -n /sysroot + command: findmnt -r -v -o SOURCE -n /sysroot register: result_sysroot_source - set_fact: device_name: "{{ result_sysroot_source.stdout }}" + - name: get filesystem type + shell: df --output=fstype -v /sysroot | grep -v Type + register: result_fstype + + - set_fact: + fstype: "{{ result_fstype.stdout }}" + - name: get ostree osname shell: rpm-ostree status --json | jq -r '.deployments[0].osname' register: result_osname @@ -167,6 +174,26 @@ failed_counter: "{{ failed_counter | int + 1 }}" vars: var_mount_path: "{{ device_name }}[/ostree/deploy/{{ osname }}/var]" + when: fstype != "btrfs" + + # btrfs defines subvolume /root in fedora + - name: /var mount point checking - btrfs + block: + - assert: + that: + - result_var_mount_point.stdout == var_mount_path + fail_msg: "/var does not mount on {{ var_mount_path }}" + success_msg: "/var mounts on {{ var_mount_path }}" + always: + - set_fact: + total_counter: "{{ total_counter | int + 1 }}" + rescue: + - name: failed count + 1 + set_fact: + failed_counter: "{{ failed_counter | int + 1 }}" + vars: + var_mount_path: "{{ device_name }}[/root/ostree/deploy/{{ osname }}/var]" + when: fstype == "btrfs" # case: check /var mount status - name: check /var mount status @@ -257,7 +284,7 @@ when: composefs == "true" - name: check VERSION_ID in /etc/os-release - shell: cat /etc/os-release | grep -oP '(?<=^VERSION_ID=").*(?=")' + shell: awk -F '=' '/^VERSION_ID/ {print $2}' /etc/os-release | tr -d '"' register: result_os_release_version_id - name: redhat.version-id == VERSION_ID diff --git a/playbooks/deploy-azure.yaml b/playbooks/deploy-azure.yaml index cd5ae34..1ec4129 100644 --- a/playbooks/deploy-azure.yaml +++ b/playbooks/deploy-azure.yaml @@ -14,6 +14,13 @@ vm_size: x86_64: Standard_D2ads_v5 aarch64: Standard_D2pds_v5 + fedora_community_gallery_image_name: + fedora-40: + x86_64: Fedora-Cloud-40-x64 + aarch64: Fedora-Cloud-40-Arm64 + fedora-41: + x86_64: Fedora-Cloud-41-x64 + aarch64: Fedora-Cloud-41-Arm64 bib: "false" tasks: @@ -138,9 +145,24 @@ --query "[?tags.project=='bootc' && tags.test_os=='{{ test_os }}' && tags.arch=='{{ arch }}'] | [0].id" \ --output tsv register: image_id_result + when: "'fedora' not in test_os" - set_fact: image_id: "{{ image_id_result.stdout }}" + when: "'fedora' not in test_os" + + - name: Get Fedora image ID + shell: | + az sig image-version list-community \ + --public-gallery-name fedora-5e266ba4-2250-406d-adad-5d73860d958f \ + --gallery-image-definition {{ fedora_community_gallery_image_name[test_os][arch] }} \ + --location {{ location }} | jq -r '.[-1].uniqueId' + register: image_id_result + when: "'fedora' in test_os" + + - set_fact: + image_id: "{{ image_id_result.stdout }}" + when: "'fedora' in test_os" - name: Create storage account for boot diagnose shell: | @@ -181,6 +203,7 @@ --eviction-policy Delete \ --size {{ vm_size[arch] }} \ --image {{ image_id }} \ + --accept-term \ --boot-diagnostics-storage {{ sa_name }} \ --user-data "{{ playbook_dir }}/azure-user-data" \ --generate-ssh-keys \ diff --git a/playbooks/deploy-beaker.yaml b/playbooks/deploy-beaker.yaml index 3b1c74d..158ceec 100644 --- a/playbooks/deploy-beaker.yaml +++ b/playbooks/deploy-beaker.yaml @@ -12,11 +12,15 @@ rhel-9-4: RedHatEnterpriseLinux9 rhel-9-5: RedHatEnterpriseLinux9 centos-stream-9: CentOSStream9 + fedora-40: Fedora40 + fedora-41: Fedorarawhide beaker_compose: # avoid rhel-9.4.0-updates-2024xxxx.xx rhel-9-4: rhel-9.4.0-20 rhel-9-5: rhel-9.5.0-20 centos-stream-9: CentOS-Stream-9 + fedora-40: Fedora-40 + fedora-41: Fedora-Rawhide tasks: - name: "get latest {{ beaker_family[test_os] }} distro" diff --git a/playbooks/deploy-gcp.yaml b/playbooks/deploy-gcp.yaml index a2d0196..2594dcc 100644 --- a/playbooks/deploy-gcp.yaml +++ b/playbooks/deploy-gcp.yaml @@ -5,6 +5,7 @@ vars: test_os: "" arch: "{{ lookup('env', 'ARCH') | default('x86_64', true) }}" + ssh_user: "cloud-user" flavor: x86_64: "n2-standard-2" aarch64: "t2a-standard-1" @@ -24,25 +25,24 @@ --key-file={{ lookup('env', 'GCP_SERVICE_ACCOUNT_FILE') }}" - name: Create gcp key file - shell: sed "s/ssh-rsa/cloud-user:ssh-rsa/" "{{ ssh_key_pub }}" > "{{ ssh_key_pub }}.gcp_key" - when: "'centos' in test_os or 'rhel' in test_os" + shell: sed "s/ssh-rsa/{{ ssh_user }}:ssh-rsa/" "{{ ssh_key_pub }}" > "{{ ssh_key_pub }}.gcp_key" - set_fact: image_args: "--image-family=centos-stream-9 --image-project=centos-cloud" when: "'centos' in test_os" - - name: Get RHEL GCP image name + - name: Get GCP image name shell: | /usr/bin/gcloud compute images list \ --project={{ lookup('env', 'GCP_PROJECT') }} \ --filter="labels.project=bootc AND labels.test_os={{ test_os }} AND labels.arch={{ arch }}" \ --format json | jq -r '.[0].name' register: result_image_name - when: "'rhel' in test_os" + when: "'rhel' in test_os or 'fedora' in test_os" - set_fact: image_args: "--image={{ result_image_name.stdout }}" - when: "'rhel' in test_os" + when: "'rhel' in test_os or 'fedora' in test_os" - name: Create gcp instance command: @@ -50,7 +50,7 @@ --zone=us-central1-a \ --machine-type={{ flavor[arch] }} \ --boot-disk-auto-delete \ - --boot-disk-size=80GB \ + --boot-disk-size=20GB \ --metadata-from-file=ssh-keys={{ ssh_key_pub }}.gcp_key \ --metadata=block-project-ssh-keys=TRUE \ --provisioning-model=SPOT \ diff --git a/playbooks/deploy-libvirt.yaml b/playbooks/deploy-libvirt.yaml index 87e67e7..878c269 100644 --- a/playbooks/deploy-libvirt.yaml +++ b/playbooks/deploy-libvirt.yaml @@ -18,6 +18,7 @@ centos-stream-9: centos-stream9 rhel-9-5: rhel9-unknown rhel-9-4: rhel9-unknown + fedora-40: fedora-unknown tasks: - set_fact: @@ -56,6 +57,19 @@ - "'rhel' in test_os" - bib == "false" + - name: Get Fedora-Cloud-Base-Generic image filename + block: + - name: Get CentOS-Stream-GenericCloud image filename + shell: curl -s https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/{{ arch }}/images/ | grep -ioE '>Fedora-Cloud-Base-Generic.*.qcow2' | tr -d '><' + register: out + + - set_fact: + download_image_name: "{{ out.stdout }}" + rhel_guest_image_fname: "{{ instance_name }}.qcow2" + when: + - test_os == "fedora-40" + - bib == "false" + - name: Download CentOS-Stream-GenericCloud image get_url: url: "https://composes.stream.centos.org/production/latest-CentOS-Stream/compose/BaseOS/x86_64/images/{{ download_image_name }}" @@ -76,6 +90,16 @@ - "'rhel' in test_os" - bib == "false" + - name: Download Fedora-Cloud-Base-Generic + get_url: + url: "https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/{{ arch }}/images/{{ download_image_name }}" + dest: "{{ image_path }}/{{ rhel_guest_image_fname }}" + validate_certs: false + become: true + when: + - test_os == "fedora-40" + - bib == "false" + - set_fact: rhel_guest_image_fname: "disk.qcow2" when: bib == "true" diff --git a/playbooks/deploy-openstack.yaml b/playbooks/deploy-openstack.yaml index 8abe09e..d21dbcc 100644 --- a/playbooks/deploy-openstack.yaml +++ b/playbooks/deploy-openstack.yaml @@ -13,6 +13,8 @@ rhel-9-5: RHEL-9.5.0-x86_64-nightly-latest rhel-9-4: RHEL-9.4.0-x86_64-nightly-latest centos-stream-9: CentOS-Stream-9-latest + fedora-40: bootc-fedora-40 + fedora-41: bootc-fedora-41 bib: "false" tasks: diff --git a/playbooks/install.yaml b/playbooks/install.yaml index 2b22ad6..5eaa5c3 100644 --- a/playbooks/install.yaml +++ b/playbooks/install.yaml @@ -80,7 +80,8 @@ {{ test_image_url }} \ bootc install to-existing-root" become: true - when: "'0.1.7' not in result_bootc_version.stdout" + when: + - "'0.1.7' not in result_bootc_version.stdout" - name: Install image with boot-0.1.7 command: @@ -94,7 +95,8 @@ {{ test_image_url }} \ bootc install to-filesystem --replace=alongside /target" become: true - when: "'0.1.7' in result_bootc_version.stdout" + when: + - "'0.1.7' in result_bootc_version.stdout" # 20 minutes reboot timeout is for aws ec2 bare instance test - name: Reboot to deploy new system diff --git a/tmt/plans/anaconda.fmf b/tmt/plans/anaconda.fmf index d0fd6fa..d186934 100644 --- a/tmt/plans/anaconda.fmf +++ b/tmt/plans/anaconda.fmf @@ -48,6 +48,15 @@ execute: - when: arch != x86_64 and arch != aarch64 enabled: false +/anaconda-uefi-btrfs: + summary: Run anaconda test locally (nested) + environment+: + FIRMWARE: uefi + PARTITION: btrfs + adjust+: + - when: arch != x86_64 and arch != aarch64 + enabled: false + /anaconda-bios-lvm: summary: Run anaconda test locally (nested) environment+: @@ -66,3 +75,13 @@ execute: adjust+: - when: arch != x86_64 enabled: false + +/anaconda-bios-btrfs: + summary: Run anaconda test locally (nested) + tag: stable + environment+: + FIRMWARE: bios + PARTITION: btrfs + adjust+: + - when: arch != x86_64 + enabled: false diff --git a/tools/shared_lib.sh b/tools/shared_lib.sh index 35335fb..728b6fe 100755 --- a/tools/shared_lib.sh +++ b/tools/shared_lib.sh @@ -49,7 +49,13 @@ function retry { function image_inspect { # shellcheck disable=SC2034 # downstream only for bib - if [[ ${TIER1_IMAGE_URL} =~ bootc-image-builder ]]; then + if [[ ${TIER1_IMAGE_URL} =~ fedora-bootc:40 ]]; then + REDHAT_ID="fedora" + REDHAT_VERSION_ID="40" + elif [[ ${TIER1_IMAGE_URL} =~ fedora-bootc:41 ]]; then + REDHAT_ID="fedora" + REDHAT_VERSION_ID="41" + elif [[ ${TIER1_IMAGE_URL} =~ bootc-image-builder ]]; then VERSION=$(skopeo inspect --tls-verify=false --creds "$QUAY_USERNAME":"$QUAY_PASSWORD" docker://"${TIER1_IMAGE_URL}" | jq -r '.Labels.version') REDHAT_ID=$(skopeo inspect --tls-verify=false docker://"${RHEL_REGISTRY_URL}/rhel9-rhel_bootc:rhel-${VERSION}" | jq -r '.Labels."redhat.id"') REDHAT_VERSION_ID=$(skopeo inspect --tls-verify=false "docker://${RHEL_REGISTRY_URL}/rhel9-rhel_bootc:rhel-${VERSION}" | jq -r '.Labels."redhat.version-id"') diff --git a/tools/upload_gcp.yml b/tools/upload_gcp.yml new file mode 100644 index 0000000..24560c8 --- /dev/null +++ b/tools/upload_gcp.yml @@ -0,0 +1,71 @@ +--- +# How to run this playbook +# GCP_SERVICE_ACCOUNT_FILE=gcp-sa.json GCP_PROJECT=project ARCH=x86_64 TEST_OS=fedora-40 ansible-playbook -v tools/upload_gcp_image.yml + +- hosts: localhost + gather_facts: no + become: no + vars: + gcp_storage_bucket_name: "bootc-image" + gcp_service_account_file: "{{ lookup('env', 'GCP_SERVICE_ACCOUNT_FILE') }}" + gcp_project: "{{ lookup('env', 'GCP_PROJECT') }}" + arch: "{{ lookup('env', 'ARCH') }}" + test_os: "{{ lookup('env', 'TEST_OS') }}" + image_url: + fedora-41: "https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Cloud/{{ arch }}/images" + fedora-40: "https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/{{ arch }}/images" + # image name must be a match of regex '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?|[1-9][0-9]{0,19}' + arch_for_image_name: + x86_64: "x86-64" + aarch64: "aarch64" + gcp_image_name: + fedora-41: "bootc-fedora-41-{{ arch_for_image_name[arch] }}" + fedora-40: "bootc-fedora-40-{{ arch_for_image_name[arch] }}" + + tasks: + - name: get latest Fedora images + shell: curl -s {{ image_url[test_os] }}/ | grep -ioE '>Fedora-Cloud-Base-GCE.*.tar.gz<' | tr -d '><' + register: result_file + when: "'fedora' in test_os" + + - set_fact: + image_file_name: "{{ result_file.stdout }}" + when: + - "'fedora' in test_os" + - result_file.changed + + - name: download image + get_url: + url: "{{ image_url[test_os] }}/{{ image_file_name }}" + dest: /tmp/ + + - name: gcloud/gsutil - authorizing with a service account + command: | + /usr/bin/gcloud auth activate-service-account \ + --key-file="{{ gcp_service_account_file }}" + + - name: create a bucket + command: | + /usr/bin/gcloud storage buckets create \ + gs://{{ gcp_storage_bucket_name }} \ + --project {{ gcp_project }} + + - name: "get MD5 checksum of {{ image_file_name }}" + command: "/usr/bin/gsutil hash -m /tmp/{{ image_file_name }}" + register: result_image_md5 + + - set_fact: + md5_checksum: "{{ result_image_md5.stdout.split('\t\t')[-1] }}" + + - name: "upload {{image_file_name}} to gs://{{ gcp_storage_bucket_name }}" + command: /usr/bin/gsutil -h Content-MD5:{{ md5_checksum }} cp /tmp/{{ image_file_name }} gs://{{ gcp_storage_bucket_name }} + + - name: "create new {{ gcp_image_name[test_os] }}" + command: /usr/bin/gcloud compute images create {{ gcp_image_name[test_os] }} --source-uri gs://{{ gcp_storage_bucket_name }}/{{ image_file_name }} --guest-os-features="UEFI_COMPATIBLE,GVNIC,SEV_CAPABLE,VIRTIO_SCSI_MULTIQUEUE" --project={{ gcp_project }} --labels "project=bootc,test_os={{ test_os }},arch={{ arch }}" + + - name: "delete bucket {{ gcp_storage_bucket_name }}" + command: | + /usr/bin/gcloud storage rm \ + --recursive \ + gs://{{ gcp_storage_bucket_name }} \ + --project {{ gcp_project }} diff --git a/tools/upload_openstack.yml b/tools/upload_openstack.yml new file mode 100644 index 0000000..e4c50ee --- /dev/null +++ b/tools/upload_openstack.yml @@ -0,0 +1,45 @@ +--- +# How to run this playbook +# OS_USERNAME=foobar OS_PASSWORD=foobar OS_PROJECT_NAME=foobar OS_AUTH_URL=https://api.foobar.com:13000 OS_USER_DOMAIN_NAME=foobar.com OS_PROJECT_DOMAIN_NAME=foobar.com TEST_OS=fedora-40 ansible-playbook -v tools/upload_openstack.yml +- hosts: localhost + gather_facts: no + become: no + vars: + test_os: "{{ lookup('env', 'TEST_OS') }}" + image_url: + fedora-41: https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Cloud/x86_64/images + fedora-40: https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images + openstack_image_name: + fedora-40: bootc-fedora-40 + fedora-41: bootc-fedora-41 + os_distro: + fedora-40: fedora + fedora-41: fedora + + tasks: + - name: get latest Fedora images + shell: curl -s {{ image_url[test_os] }}/ | grep -ioE '>Fedora-Cloud-Base-Generic.*.qcow2<' | tr -d '><' + register: result_file + when: "'fedora' in test_os" + + - set_fact: + image_file_name: "{{ result_file.stdout }}" + when: + - "'fedora' in test_os" + - result_file.changed + + - name: download image + get_url: + url: "{{ image_url[test_os] }}/{{ image_file_name }}" + dest: /tmp/ + + - name: "upload new {{ test_os }} openstack image" + command: | + openstack --insecure image create \ + --file /tmp/{{ image_file_name }} \ + --disk-format qcow2 \ + --private \ + --property architecture=x86_64 \ + --property os_distro={{ os_distro[test_os] }} \ + --property hw_rng_model=virtio \ + {{ openstack_image_name[test_os] }}