debian-koji-osbuild/test/integration.sh
Tomas Hozza 85d7120d9f CI: Use Fedora 36, RHEL-8.6 and the latest osbuild and composer
Use latest osbuild and osbuild-composer releases. This is important to
be later able to test direct uploading to the cloud for Koji composes.
Also the mock openid server had to be enhanced to be usable for testing
`koji-osbuild`.

Modify used osbuild-worker configuration to use JWT for authentication
with composer. Update configurations of both, composer and worker to
handle multi-tenancy.

Do not start any services in `schutzbot/deploy.sh`, because at that
point, none of the configuration files are in place.

Ensure that the correct units are started and masked by
`test/integration.sh` to simulate the Service scenario more closely.
This means that the local worker is masked and only remote worker is
started.

Co-authored-by: Jakub Rusz <jrusz@redhat.com>
2022-08-22 09:58:06 +02:00

79 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
set -euxo pipefail
function greenprint {
echo -e "\033[1;32m${1}\033[0m"
}
# Get OS data.
source /etc/os-release
if [[ $ID == rhel ]] && ! rpm -q epel-release; then
greenprint "📦 Setting up EPEL repository"
curl -Ls --retry 5 --output /tmp/epel.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo rpm -Uvh /tmp/epel.rpm
fi
greenprint "Fetching RPMs"
sudo mkdir -p /tmp/osbuild-composer-koji-test/rpms
sudo dnf -y \
--downloadonly \
--downloaddir=/tmp/osbuild-composer-koji-test/rpms \
download \
"koji-osbuild*"
greenprint "Creating composer SSL certificates"
sudo /usr/libexec/koji-osbuild-tests/make-certs.sh /usr/share/koji-osbuild-tests
greenprint "Building containers"
sudo /usr/libexec/koji-osbuild-tests/build-container.sh /usr/share/koji-osbuild-tests
greenprint "Starting containers"
sudo /usr/libexec/koji-osbuild-tests/run-koji-container.sh start
greenprint "Print logs"
sudo podman logs org.osbuild.koji.koji
greenprint "Testing Koji hub API access"
koji --server=http://localhost:8080/kojihub --user=osbuild --password=osbuildpass --authtype=password hello
greenprint "Copying credentials, certificates and configuration files"
sudo /usr/libexec/koji-osbuild-tests/copy-creds.sh /usr/share/koji-osbuild-tests
greenprint "Starting mock OpenID server"
sudo /usr/libexec/koji-osbuild-tests/run-openid.sh start
greenprint "Starting osbuild-composer's Cloud API socket and a remote worker"
# Start services.
sudo systemctl stop 'osbuild*'
# make sure that the local worker is not running
sudo systemctl mask osbuild-worker@1.service
# enable remote worker API
sudo systemctl start osbuild-remote-worker.socket
# enable Cloud API
sudo systemctl start osbuild-composer-api.socket
# start a remote worker
sudo systemctl start osbuild-remote-worker@localhost:8700.service
greenprint "Starting koji builder"
sudo /usr/libexec/koji-osbuild-tests/run-builder.sh start /usr/share/koji-osbuild-tests
greenprint "Creating Koji tag infrastructure"
/usr/libexec/koji-osbuild-tests/make-tags.sh
greenprint "Running integration tests"
python3 -m unittest discover -v /usr/libexec/koji-osbuild-tests/integration/
greenprint "Stopping koji builder"
sudo /usr/libexec/koji-osbuild-tests/run-builder.sh stop /usr/share/koji-osbuild-tests
greenprint "Stopping containers"
sudo /usr/libexec/koji-osbuild-tests/run-koji-container.sh stop
greenprint "Stopping mock OpenID server"
sudo /usr/libexec/koji-osbuild-tests/run-openid.sh stop
greenprint "Removing generated CA cert"
sudo rm /etc/pki/ca-trust/source/anchors/osbuild-ca-crt.pem
sudo update-ca-trust