debian-forge-composer/schutzbot/deploy.sh
Tom Gundersen 64432c706a schutzbot/mockbuild: test against osbuild in target release by default
To make sure we test against what we will release with, use osbuild from
the target distro rather than rebuilding it.

The only exception is in RHEL8.3, where we are not rebasing any longer,
but expect users who use new osbulid-composer from upstream to use it
with new osbuild from upstream too. In this case, use the RPM from
osbuild upstream, for now pinned to the same version as was in the
submodule.

This introduces a new configuration file: Schutzfile, which is meant
to contain the full test-matrix. For now it only points to the upstream
osbuild commit to add to the distro we are testing against (only relevant
for 8.3).

The submodule is now unused and is therefore removed. The produced repos
now only contain osbuild-composer, osbuild is never built as part of
osbuild-composer CI.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-11-15 14:25:50 +01:00

78 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
set -euxo pipefail
# Colorful output.
function greenprint {
echo -e "\033[1;32m${1}\033[0m"
}
function retry {
local count=0
local retries=5
until "$@"; do
exit=$?
count=$((count + 1))
if [[ $count -lt $retries ]]; then
echo "Retrying command..."
sleep 1
else
echo "Command failed after ${retries} retries. Giving up."
return $exit
fi
done
return 0
}
# Get OS details.
source /etc/os-release
ARCH=$(uname -m)
if [[ -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then
greenprint "Registering RHEL"
sudo chmod +x "$RHN_REGISTRATION_SCRIPT"
sudo "$RHN_REGISTRATION_SCRIPT"
fi
greenprint "Enabling fastestmirror to speed up dnf 🏎️"
echo -e "fastestmirror=1" | sudo tee -a /etc/dnf/dnf.conf
greenprint "Adding osbuild team ssh keys"
cat schutzbot/team_ssh_keys.txt | tee -a ~/.ssh/authorized_keys > /dev/null
greenprint "Setting up a dnf repository with the RPMs we want to test"
sudo tee /etc/yum.repos.d/osbuild-composer.repo << EOF
[osbuild-composer]
name=osbuild composer ${GIT_COMMIT}
baseurl=http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild-composer/${ID}-${VERSION_ID}/${ARCH}/${GIT_COMMIT}
enabled=1
gpgcheck=0
# Default dnf repo priority is 99. Lower number means higher priority.
priority=5
EOF
# TODO: include this in the jenkins runner (and split test/target machines out)
sudo dnf -y install jq
OSBUILD_GIT_COMMIT=$(cat Schutzfile | jq -r '.["'"${ID}-${VERSION_ID}"'"].dependencies.osbuild.commit')
if [[ "${OSBUILD_GIT_COMMIT}" != "null" ]]; then
greenprint "Setting up a dnf repository with our unreleased osbuild depedency"
sudo tee /etc/yum.repos.d/osbuild.repo << EOF
[osbuild]
name=osbuild ${OSBUILD_GIT_COMMIT}
baseurl=http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild/${ID}-${VERSION_ID}/${ARCH}/${OSBUILD_GIT_COMMIT}
enabled=1
gpgcheck=0
# Default dnf repo priority is 99. Lower number means higher priority. This repo may contain an old composer build, dump the priority.
priority=10
EOF
fi
if [[ $ID == rhel ]]; then
greenprint "Setting up EPEL repository"
# we need this for ansible and koji
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
fi
greenprint "Installing the Image Builder packages"
# Note: installing only -tests to catch missing dependencies
retry sudo dnf -y install osbuild-composer-tests