From 483ad1b8f8e8222118d2769529647609fd403166 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Fri, 16 Sep 2022 13:13:49 -0400 Subject: [cirrus|foreman] Expand Foreman testing matrix, automate install Foreman has since made several releases since we initially added integration testing for it. Rebuilding the images is maintenance overhead we can reduce by automating the installation of foreman on images. Provide this scripted installation, and expand our testing matrix to additional versions of Foreman. As of this commit, we will be testing versions 2.5 and 3.1 on CentOS Stream 8 to cover Red Hat Satellite features, as well as Foreman version 3.4 (the latest current upstream) for CentOS 8 and Debian 11. Signed-off-by: Jake Hunsaker --- tests/test_data/foreman_setup.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 tests/test_data/foreman_setup.sh (limited to 'tests') diff --git a/tests/test_data/foreman_setup.sh b/tests/test_data/foreman_setup.sh new file mode 100755 index 00000000..4d869865 --- /dev/null +++ b/tests/test_data/foreman_setup.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +SUCCESS=0 + +if grep -iq centos /etc/os-release; then + if [[ `echo | awk "{print ($FOREMAN_VER >= 3.4)}"` -eq 1 ]]; then + dnf -y install https://yum.puppet.com/puppet7-release-el-8.noarch.rpm + dnf -y install https://yum.theforeman.org/releases/$FOREMAN_VER/el8/x86_64/foreman-release.rpm + dnf -y module enable foreman:el8 + else + dnf -y install https://yum.puppet.com/puppet6-release-el-8.noarch.rpm + dnf -y install https://yum.theforeman.org/releases/$FOREMAN_VER/el8/x86_64/foreman-release.rpm + dnf -y module enable ruby:2.7 + fi + dnf -y install foreman-installer && SUCCESS=1 +elif grep -iq debian /etc/os-release; then + apt-get update + apt-get -y install ca-certificates locales + sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen + locale-gen + export LC_ALL=en_US.UTF-8 + export LANG=en_US.UTF-8 + curl https://apt.puppet.com/puppet7-release-bullseye.deb --output /root/puppet7-release-bullseye.deb + apt-get install /root/puppet7-release-bullseye.deb + curl https://deb.theforeman.org/foreman.asc --output /etc/apt/trusted.gpg.d/foreman.asc + echo "deb http://deb.theforeman.org/ bullseye $FOREMAN_VER" | tee /etc/apt/sources.list.d/foreman.list + echo "deb http://deb.theforeman.org/ plugins $FOREMAN_VER" | tee -a /etc/apt/sources.list.d/foreman.list + apt-get update + apt-get -y install foreman-installer && SUCCESS=1 +fi + +if [[ $SUCCESS == 1 ]]; then + foreman-installer --foreman-db-password='S0Sdb=p@ssw0rd!' --foreman-initial-admin-password='S0S@dmin\\p@ssw0rd!' +else + echo "Setup failed" + exit 1 +fi -- cgit