Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
test: add fedora bootc image test
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaofeng Wang <[email protected]>
  • Loading branch information
henrywang committed May 8, 2024
1 parent d2da70e commit 2d784fc
Show file tree
Hide file tree
Showing 15 changed files with 376 additions and 45 deletions.
84 changes: 83 additions & 1 deletion .github/workflows/anaconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 &&
Expand Down
68 changes: 35 additions & 33 deletions anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,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"
Expand Down Expand Up @@ -178,30 +184,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"
Expand Down Expand Up @@ -256,10 +253,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"
Expand Down Expand Up @@ -407,7 +409,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."
Expand Down
10 changes: 10 additions & 0 deletions files/copr-coreos-continuous.template
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions os-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -136,6 +142,14 @@ $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

greenprint "Check $TEST_OS installation Containerfile"
cat "$INSTALL_CONTAINERFILE"

Expand Down
31 changes: 29 additions & 2 deletions playbooks/check-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions playbooks/deploy-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions playbooks/deploy-beaker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 2d784fc

Please sign in to comment.