Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/greenboot-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,29 @@ jobs:
timeout: 90
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 }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"

rhel-9-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: RHEL-9.9.0-Nightly
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: rhel-9.9-bootc
tmt_context: "arch=x86_64;distro=rhel-9-9"
tmt_plan_regex: bootc
tf_scope: private
variables: "ARCH=x86_64"
timeout: 90
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 }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"

rhel-10-2-bootc:
needs: check-pull-request
if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }}
Expand All @@ -204,3 +227,26 @@ jobs:
variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}"
timeout: 90
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 }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"

rhel-10-3-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: RHEL-10.3-Nightly
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: rhel-10.3-bootc
tmt_context: "arch=x86_64;distro=rhel-10-3"
tmt_plan_regex: bootc
tf_scope: private
variables: "ARCH=x86_64"
timeout: 90
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 }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"
39 changes: 39 additions & 0 deletions tests/common/download-compose-rpms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Source this file to get the download_compose_rpms helper function.

# download_compose_rpms <packages_url> <dest_dir>
#
# Downloads the latest greenboot and greenboot-default-health-checks RPMs
# from the compose packages index at <packages_url> into <dest_dir>.
#
# The packages index page is fetched once and reused for both lookups.
#
# The -k (--insecure) flag is required because RHEL internal compose servers
# use certificates signed by the Red Hat internal CA, which is not present
# in the default system trust store on CI hosts.
download_compose_rpms() {
local packages_url="$1"
local dest_dir="$2"

local packages_page
packages_page="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \
"${packages_url}")"

local greenboot_rpm
greenboot_rpm="$(echo "${packages_page}" \
| grep -oE 'greenboot-[0-9][^"]*\.rpm' \
| grep -vE 'debug(info|source)' \
| sort -V | tail -n 1)"
echo "Selected greenboot RPM: ${greenboot_rpm}"

local greenboot_default_rpm
greenboot_default_rpm="$(echo "${packages_page}" \
| grep -oE 'greenboot-default-health-checks-[0-9][^"]*\.rpm' \
| sort -V | tail -n 1)"
echo "Selected greenboot-default-health-checks RPM: ${greenboot_default_rpm}"

curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \
"${packages_url}${greenboot_rpm}" -o "${dest_dir}/${greenboot_rpm}"
curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \
"${packages_url}${greenboot_default_rpm}" -o "${dest_dir}/${greenboot_default_rpm}"
}
4 changes: 2 additions & 2 deletions tests/files/rhel-10-2.repo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[RHEL-10.2-NIGHTLY-BaseOS]
name=baseos
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.2/compose/BaseOS/x86_64/os
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.2/compose/BaseOS/REPLACE_ARCH_HERE/os
enabled=1
gpgcheck=0
[RHEL-10.2-NIGHTLY-AppStream]
name=appstream
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.2/compose/AppStream/x86_64/os/
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.2/compose/AppStream/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
10 changes: 10 additions & 0 deletions tests/files/rhel-10-3.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[RHEL-10.3-NIGHTLY-BaseOS]
name=baseos
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.3/compose/BaseOS/REPLACE_ARCH_HERE/os
enabled=1
gpgcheck=0
[RHEL-10.3-NIGHTLY-AppStream]
name=appstream
baseurl=http://REPLACE_ME_HERE/rhel-10/nightly/RHEL-10/latest-RHEL-10.3/compose/AppStream/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
4 changes: 2 additions & 2 deletions tests/files/rhel-9-8.repo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[RHEL-9.8-NIGHTLY-BaseOS]
name=baseos
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/BaseOS/x86_64/os/
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/BaseOS/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
[RHEL-9.8-NIGHTLY-AppStream]
name=appstream
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/AppStream/x86_64/os/
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/AppStream/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
10 changes: 10 additions & 0 deletions tests/files/rhel-9-9.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[RHEL-9.9-NIGHTLY-BaseOS]
name=baseos
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.9.0/compose/BaseOS/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
[RHEL-9.9-NIGHTLY-AppStream]
name=appstream
baseurl=http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.9.0/compose/AppStream/REPLACE_ARCH_HERE/os/
enabled=1
gpgcheck=0
88 changes: 88 additions & 0 deletions tests/greenboot-bootc-anaconda-iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ echo -e "\033[0m"
source /etc/os-release

# Setup variables
ARCH=$(uname -m)
TEST_UUID=anaconda-$((1 + RANDOM % 1000000))
TEMPDIR=$(mktemp -d)
GUEST_ADDRESS=192.168.100.50
Expand All @@ -34,6 +35,15 @@ EDGE_USER=core
EDGE_USER_PASSWORD=foobar
CONSOLE_LOG=/tmp/vm-console.log

# RPM acquisition mode:
# If DOWNLOAD_NODE and COMPOSE_ID are both set -> download from compose
# Otherwise -> build locally with make rpm (default)
USE_COMPOSE_RPMS=false
if [[ -n "${DOWNLOAD_NODE:-}" && -n "${COMPOSE_ID:-}" ]]; then
USE_COMPOSE_RPMS=true
fi
GREENBOOT_PACKAGES_URL=""

case "${ID}-${VERSION_ID}" in
"fedora-43")
OS_VARIANT="fedora-unknown"
Expand Down Expand Up @@ -64,14 +74,52 @@ case "${ID}-${VERSION_ID}" in
BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.8"
BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.8"
BOOT_ARGS="uefi"
{ set +x; } 2>/dev/null
sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo
sed -i "s/REPLACE_ARCH_HERE/${ARCH}/g" files/rhel-9-8.repo
if [[ "${USE_COMPOSE_RPMS}" == true ]]; then
GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-9/composes/RHEL-9/${COMPOSE_ID}/compose/AppStream/${ARCH}/os/Packages/"
fi
set -x
;;
"rhel-9.9")
OS_VARIANT="rhel9-unknown"
BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.9"
BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.9"
BOOT_ARGS="uefi"
{ set +x; } 2>/dev/null
sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-9.repo
sed -i "s/REPLACE_ARCH_HERE/${ARCH}/g" files/rhel-9-9.repo
if [[ "${USE_COMPOSE_RPMS}" == true ]]; then
GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-9/composes/RHEL-9/${COMPOSE_ID}/compose/AppStream/${ARCH}/os/Packages/"
fi
set -x
;;
"rhel-10.2")
OS_VARIANT="rhel10-unknown"
BASE_IMAGE_URL="registry.stage.redhat.io/rhel10/rhel-bootc:10.2"
BIB_URL="registry.stage.redhat.io/rhel10/bootc-image-builder:10.2"
BOOT_ARGS="uefi"
{ set +x; } 2>/dev/null
sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo
sed -i "s/REPLACE_ARCH_HERE/${ARCH}/g" files/rhel-10-2.repo
if [[ "${USE_COMPOSE_RPMS}" == true ]]; then
GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-10/composes/RHEL-10/${COMPOSE_ID}/compose/AppStream/${ARCH}/os/Packages/"
fi
set -x
;;
"rhel-10.3")
OS_VARIANT="rhel10-unknown"
BASE_IMAGE_URL="registry.stage.redhat.io/rhel10/rhel-bootc:10.3"
BIB_URL="registry.stage.redhat.io/rhel10/bootc-image-builder:10.3"
BOOT_ARGS="uefi"
{ set +x; } 2>/dev/null
sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-3.repo
sed -i "s/REPLACE_ARCH_HERE/${ARCH}/g" files/rhel-10-3.repo
if [[ "${USE_COMPOSE_RPMS}" == true ]]; then
GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-10/composes/RHEL-10/${COMPOSE_ID}/compose/AppStream/${ARCH}/os/Packages/"
fi
set -x
;;
*)
echo "unsupported distro: ${ID}-${VERSION_ID}"
Expand Down Expand Up @@ -183,6 +231,19 @@ greenprint "Copying test assets"
cp testing_assets/failing_binary tests/
)

###########################################################
##
## Optionally download greenboot rpm packages from compose
##
###########################################################
if [[ "${USE_COMPOSE_RPMS}" == true && -n "${GREENBOOT_PACKAGES_URL}" ]]; then
greenprint "Downloading greenboot RPMs from compose"
rm -f greenboot-*.rpm
# source: tests/common/download-compose-rpms.sh
source "$(dirname "${BASH_SOURCE[0]}")/common/download-compose-rpms.sh"
download_compose_rpms "${GREENBOOT_PACKAGES_URL}" "."
fi

###########################################################
##
## Build bootc container with greenboot installed
Expand All @@ -193,10 +254,25 @@ 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
FROM ${BASE_IMAGE_URL}
EOF

if [[ "${USE_COMPOSE_RPMS}" == true && -n "${GREENBOOT_PACKAGES_URL}" ]]; then
tee -a Containerfile > /dev/null << EOF
COPY greenboot-*.rpm /tmp/
RUN dnf install -y /tmp/greenboot-*.rpm && \
rm -f /tmp/greenboot-*.rpm && \
systemctl enable greenboot-healthcheck.service
EOF
else
tee -a Containerfile > /dev/null << EOF
RUN dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER} && \
dnf install -y greenboot greenboot-default-health-checks && \
systemctl enable greenboot-healthcheck.service
EOF
fi

tee -a Containerfile > /dev/null << EOF
RUN sed -i "s/GREENBOOT_MAX_BOOT_ATTEMPTS=3/GREENBOOT_MAX_BOOT_ATTEMPTS=5/g" /etc/greenboot/greenboot.conf
RUN sed -i 's#DISABLED_HEALTHCHECKS=()#DISABLED_HEALTHCHECKS=("01_repository_dns_check.sh" "not_exit.sh")#g' /etc/greenboot/greenboot.conf

Expand All @@ -220,12 +296,24 @@ COPY files/rhel-9-8.repo /etc/yum.repos.d/rhel-9-8.repo
EOF
fi

if [[ "${ID}-${VERSION_ID}" == "rhel-9.9" ]]; then
tee -a Containerfile >> /dev/null << EOF
COPY files/rhel-9-9.repo /etc/yum.repos.d/rhel-9-9.repo
EOF
fi

if [[ "${ID}-${VERSION_ID}" == "rhel-10.2" ]]; then
tee -a Containerfile >> /dev/null << EOF
COPY files/rhel-10-2.repo /etc/yum.repos.d/rhel-10-2.repo
EOF
fi

if [[ "${ID}-${VERSION_ID}" == "rhel-10.3" ]]; then
tee -a Containerfile >> /dev/null << EOF
COPY files/rhel-10-3.repo /etc/yum.repos.d/rhel-10-3.repo
EOF
fi

greenprint "Building container (retrying until Copr build is available)"
build_success=false
for attempt in $(seq 1 10); do
Expand Down
Loading
Loading