#!/bin/bash set -exuo pipefail # Check environment printenv # This must work outside of a container too bootc status # temp folder to save building files and folders BOOTC_TEMPDIR=$(mktemp -d) trap 'rm -rf -- "$BOOTC_TEMPDIR"' EXIT # Copy files and folders in hack to TEMPDIR cp -a . "$BOOTC_TEMPDIR" # Keep testing farm run folder cp -r /var/ARTIFACTS "$BOOTC_TEMPDIR" # Copy bootc repo cp -r /var/share/test-artifacts "$BOOTC_TEMPDIR" ARCH=$(uname -m) # Get OS info source /etc/os-release # Some rhts-*, rstrnt-* and tmt-* commands are in /usr/local/bin if [[ -d /var/lib/tmt/scripts ]]; then cp -r /var/lib/tmt/scripts "$BOOTC_TEMPDIR" ls -al "${BOOTC_TEMPDIR}/scripts" else cp -r /usr/local/bin "$BOOTC_TEMPDIR" ls -al "${BOOTC_TEMPDIR}/bin" fi # Get base image URL TEST_OS="${ID}-${VERSION_ID}" BASE=$(jq -r --arg v "$TEST_OS" '.base[$v]' < os-image-map.json) if [[ "$ID" == "rhel" ]]; then # OSCI gating only CURRENT_COMPOSE_ID=$(skopeo inspect --no-tags --retry-times=5 --tls-verify=false "docker://${BASE}" | jq -r '.Labels."redhat.compose-id"') if [[ -n ${CURRENT_COMPOSE_ID} ]]; then if [[ ${CURRENT_COMPOSE_ID} == *-updates-* ]]; then BATCH_COMPOSE="updates/" else BATCH_COMPOSE="" fi else BATCH_COMPOSE="updates/" CURRENT_COMPOSE_ID=latest-RHEL-$VERSION_ID fi # use latest compose if specific compose is not accessible RC=$(curl -skIw '%{http_code}' -o /dev/null "http://${NIGHTLY_COMPOSE_SITE}/rhel-${VERSION_ID%%.*}/nightly/${BATCH_COMPOSE}RHEL-${VERSION_ID%%.*}/${CURRENT_COMPOSE_ID}/STATUS") if [[ $RC != "200" ]]; then CURRENT_COMPOSE_ID=latest-RHEL-${VERSION_ID%%} fi # generate rhel repo tee "${BOOTC_TEMPDIR}/rhel.repo" >/dev/null <