-
Notifications
You must be signed in to change notification settings - Fork 15
ci: allow the installation of greenboot rpm packages from compose #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,15 @@ SSH_KEY_PUB=$(cat "${SSH_KEY}".pub) | |
| EDGE_USER=core | ||
| EDGE_USER_PASSWORD=foobar | ||
|
|
||
| # 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" | ||
|
|
@@ -66,15 +75,33 @@ case "${ID}-${VERSION_ID}" in | |
| BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.8" | ||
| BOOT_ARGS="uefi" | ||
| sudo dnf install -y make rpm-build rust-toolset | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo | ||
| if [[ "${USE_COMPOSE_RPMS}" == true ]]; then | ||
| { set +x; } 2>/dev/null | ||
| GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-9/composes/RHEL-9/${COMPOSE_ID}/compose/AppStream/x86_64/os/Packages/" | ||
| set -x | ||
| fi | ||
| if [[ -n "${DOWNLOAD_NODE:-}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo | ||
| set -x | ||
| fi | ||
| ;; | ||
| "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" | ||
| sudo dnf install -y make rpm-build rust-toolset | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo | ||
| if [[ "${USE_COMPOSE_RPMS}" == true ]]; then | ||
| { set +x; } 2>/dev/null | ||
| GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-10/composes/RHEL-10/${COMPOSE_ID}/compose/AppStream/x86_64/os/Packages/" | ||
| set -x | ||
| fi | ||
| if [[ -n "${DOWNLOAD_NODE:-}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo | ||
| set -x | ||
| fi | ||
| ;; | ||
| *) | ||
| echo "unsupported distro: ${ID}-${VERSION_ID}" | ||
|
|
@@ -174,17 +201,44 @@ fi | |
|
|
||
| ########################################################### | ||
| ## | ||
| ## Build greenboot rpm packages | ||
| ## Get greenboot rpm packages | ||
| ## | ||
| ########################################################### | ||
| greenprint "Building greenboot packages" | ||
| pushd .. && \ | ||
| make rpm | ||
| cp rpmbuild/RPMS/x86_64/*.rpm tests/ | ||
| cp testing_assets/passing_script.sh tests/ | ||
| cp testing_assets/passing_binary tests/ | ||
| cp testing_assets/failing_script.sh tests/ | ||
| cp testing_assets/failing_binary tests/ && popd | ||
| if [[ "${USE_COMPOSE_RPMS}" == true && -n "${GREENBOOT_PACKAGES_URL}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| greenprint "Downloading greenboot RPMs from compose" | ||
| rm -f greenboot-*.rpm | ||
|
|
||
| GREENBOOT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following command could be extracted into a variable to download the page once. It applies to all occurrences. |
||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | grep -oE 'greenboot-[0-9][^"]*\.rpm' \ | ||
| | grep -vE 'debug(info|source)' \ | ||
| | sort -V | tail -n 1)" | ||
| echo "Selected greenboot RPM: ${GREENBOOT_RPM}" | ||
|
|
||
| GREENBOOT_DEFAULT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | 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 \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_RPM}" -o "${GREENBOOT_RPM}" | ||
| curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_DEFAULT_RPM}" -o "${GREENBOOT_DEFAULT_RPM}" | ||
| set -x | ||
| else | ||
| greenprint "Building greenboot packages with make rpm" | ||
| pushd .. | ||
| make rpm | ||
| cp rpmbuild/RPMS/x86_64/*.rpm tests/ | ||
| popd | ||
| fi | ||
|
|
||
| cp ../testing_assets/passing_script.sh . | ||
| cp ../testing_assets/passing_binary . | ||
| cp ../testing_assets/failing_script.sh . | ||
| cp ../testing_assets/failing_binary . | ||
|
|
||
| ########################################################### | ||
| ## | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,15 @@ SSH_KEY_PUB=$(cat "${SSH_KEY}".pub) | |
| EDGE_USER=core | ||
| EDGE_USER_PASSWORD=foobar | ||
|
|
||
| # 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" | ||
|
|
@@ -66,15 +75,33 @@ case "${ID}-${VERSION_ID}" in | |
| BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.8" | ||
| BOOT_ARGS="uefi" | ||
| sudo dnf install -y make rpm-build rust-toolset | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo | ||
| if [[ "${USE_COMPOSE_RPMS}" == true ]]; then | ||
| { set +x; } 2>/dev/null | ||
| GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-9/composes/RHEL-9/${COMPOSE_ID}/compose/AppStream/x86_64/os/Packages/" | ||
| set -x | ||
| fi | ||
| if [[ -n "${DOWNLOAD_NODE:-}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo | ||
| set -x | ||
| fi | ||
| ;; | ||
| "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" | ||
| sudo dnf install -y make rpm-build rust-toolset | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo | ||
| if [[ "${USE_COMPOSE_RPMS}" == true ]]; then | ||
| { set +x; } 2>/dev/null | ||
| GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-10/composes/RHEL-10/${COMPOSE_ID}/compose/AppStream/x86_64/os/Packages/" | ||
| set -x | ||
| fi | ||
| if [[ -n "${DOWNLOAD_NODE:-}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo | ||
| set -x | ||
| fi | ||
| ;; | ||
| *) | ||
| echo "unsupported distro: ${ID}-${VERSION_ID}" | ||
|
|
@@ -174,17 +201,44 @@ fi | |
|
|
||
| ########################################################### | ||
| ## | ||
| ## Build greenboot rpm packages | ||
| ## Get greenboot rpm packages | ||
| ## | ||
| ########################################################### | ||
| greenprint "Building greenboot packages" | ||
| pushd .. && \ | ||
| make rpm | ||
| cp rpmbuild/RPMS/x86_64/*.rpm tests/ | ||
| cp testing_assets/passing_script.sh tests/ | ||
| cp testing_assets/passing_binary tests/ | ||
| cp testing_assets/failing_script.sh tests/ | ||
| cp testing_assets/failing_binary tests/ && popd | ||
| if [[ "${USE_COMPOSE_RPMS}" == true && -n "${GREENBOOT_PACKAGES_URL}" ]]; then | ||
| { set +x; } 2>/dev/null | ||
| greenprint "Downloading greenboot RPMs from compose" | ||
| rm -f greenboot-*.rpm | ||
|
|
||
| GREENBOOT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would explain why the option |
||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | grep -oE 'greenboot-[0-9][^"]*\.rpm' \ | ||
| | grep -vE 'debug(info|source)' \ | ||
| | sort -V | tail -n 1)" | ||
| echo "Selected greenboot RPM: ${GREENBOOT_RPM}" | ||
|
|
||
| GREENBOOT_DEFAULT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | 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 \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_RPM}" -o "${GREENBOOT_RPM}" | ||
| curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_DEFAULT_RPM}" -o "${GREENBOOT_DEFAULT_RPM}" | ||
| set -x | ||
| else | ||
| greenprint "Building greenboot packages with make rpm" | ||
| pushd .. | ||
| make rpm | ||
| cp rpmbuild/RPMS/x86_64/*.rpm tests/ | ||
| popd | ||
| fi | ||
|
|
||
| cp ../testing_assets/passing_script.sh . | ||
| cp ../testing_assets/passing_binary . | ||
| cp ../testing_assets/failing_script.sh . | ||
| cp ../testing_assets/failing_binary . | ||
|
|
||
| ########################################################### | ||
| ## | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,15 @@ for _ in $(seq 0 30); do | |
| sleep 10 | ||
| done | ||
|
|
||
| # 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="" | ||
|
|
||
| # Customize repository | ||
| sudo mkdir -p /etc/osbuild-composer/repositories | ||
|
|
||
|
|
@@ -93,20 +102,46 @@ case "${ID}-${VERSION_ID}" in | |
| OS_VARIANT="rhel9-unknown" | ||
| BOOT_ARGS="uefi" | ||
| BOOT_LOCATION="http://${DOWNLOAD_NODE}/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/BaseOS/x86_64/os/" | ||
| if [[ "${USE_COMPOSE_RPMS}" == true ]]; then | ||
| GREENBOOT_PACKAGES_URL="https://${DOWNLOAD_NODE}/rhel-9/composes/RHEL-9/${COMPOSE_ID}/compose/AppStream/x86_64/os/Packages/" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, for sake of consistency with the other scripts we can have it here... |
||
| fi | ||
| sed "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8-0.json | sudo tee /etc/osbuild-composer/repositories/rhel-98.json > /dev/null;; | ||
| *) | ||
| echo "unsupported distro: ${ID}-${VERSION_ID}" | ||
| exit 1;; | ||
| esac | ||
|
|
||
| # Build greenboot RPMs | ||
| greenprint "Building greenboot packages" | ||
| pushd .. && \ | ||
| make rpm | ||
| # Get greenboot RPMs | ||
| mkdir -p /var/www/html/packages | ||
| cp rpmbuild/RPMS/x86_64/*.rpm /var/www/html/packages/ | ||
| if [[ "${USE_COMPOSE_RPMS}" == true && -n "${GREENBOOT_PACKAGES_URL}" ]]; then | ||
| greenprint "Downloading greenboot RPMs from compose: ${GREENBOOT_PACKAGES_URL}" | ||
|
|
||
| GREENBOOT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would explain why the option |
||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | grep -oE 'greenboot-[0-9][^"]*\.rpm' \ | ||
| | grep -vE 'debug(info|source)' \ | ||
| | sort -V | tail -n 1)" | ||
| echo "Selected greenboot RPM: ${GREENBOOT_RPM}" | ||
|
|
||
| GREENBOOT_DEFAULT_RPM="$(curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}" \ | ||
| | 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 \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_RPM}" -o "/var/www/html/packages/${GREENBOOT_RPM}" | ||
| curl -kfsSL --retry 5 --retry-delay 2 --retry-all-errors \ | ||
| "${GREENBOOT_PACKAGES_URL}${GREENBOOT_DEFAULT_RPM}" -o "/var/www/html/packages/${GREENBOOT_DEFAULT_RPM}" | ||
|
Comment on lines
+117
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that |
||
| else | ||
| greenprint "Building greenboot packages with make rpm" | ||
| pushd .. | ||
| make rpm | ||
| cp rpmbuild/RPMS/x86_64/*.rpm /var/www/html/packages/ | ||
| popd | ||
| fi | ||
| sudo createrepo_c /var/www/html/packages | ||
| sudo restorecon -Rv /var/www/html/packages && popd | ||
| sudo restorecon -Rv /var/www/html/packages | ||
|
|
||
| # Check ostree_key permissions | ||
| KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would explain why the option
-kis needed.