Skip to content

Commit

Permalink
Fix the GH CI after systemd removal from setup scripts.
Browse files Browse the repository at this point in the history
Since more scripts have been changed those need to be mounted. We also
need to start postgresql and ssh as systemd services to emulate the second
container start of a real install.

The setup is also done in a separate container with persisted volumes
like the real container.
  • Loading branch information
cbosdo committed Jan 23, 2025
1 parent 5bce092 commit 842bb4d
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/acceptance_tests_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ jobs:
run: ./testsuite/podman_runner/06_collect_and_tag_flaky_tests_in_controller.sh
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_GALAXY_CI }}
- name: setup-server-container
run: ./testsuite/podman_runner/07_server_setup.sh
- name: start-server-container
run: ./testsuite/podman_runner/07_start_server.sh
- name: mgr-setup
run: ./testsuite/podman_runner/08_manager_setup.sh
run: ./testsuite/podman_runner/08_start_server.sh
- name: build_code
run: ./testsuite/podman_runner/09_build_server_code.sh
# - name: copy_ca
Expand Down
35 changes: 33 additions & 2 deletions testsuite/podman_runner/00_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ -z "${UYUNI_VERSION}" ];then
fi

echo "Killing old containers"
containers="deblike_minion rhlike_minion sle_minion opensusessh server controller"
containers="auth_registry buildhost deblike_minion rhlike_minion sle_minion opensusessh server controller"
for i in ${containers};do
sudo -i podman kill ${i}
done
Expand All @@ -23,11 +23,42 @@ for i in ${containers};do
done

echo "Force remove containers"
containers="deblike_minion rhlike_minion sle_minion opensusessh server controller"
containers="auth_registry buildhost deblike_minion rhlike_minion sle_minion opensusessh server controller"
for i in ${containers};do
sudo -i podman rm ${i}
done

echo "Remove volumes"
sudo -i podman volume rm var-cobbler
sudo -i podman volume rm var-search
sudo -i podman volume rm var-salt
sudo -i podman volume rm var-cache
sudo -i podman volume rm var-spacewalk
sudo -i podman volume rm var-log
sudo -i podman volume rm srv-salt
sudo -i podman volume rm srv-www
sudo -i podman volume rm srv-tftpboot
sudo -i podman volume rm srv-formulametadata
sudo -i podman volume rm srv-pillar
sudo -i podman volume rm srv-susemanager
sudo -i podman volume rm srv-spacewalk
sudo -i podman volume rm root
sudo -i podman volume rm ca-cert
sudo -i podman volume rm run-salt-master
sudo -i podman volume rm etc-tls
sudo -i podman volume rm var-pgsql
sudo -i podman volume rm etc-rhn
sudo -i podman volume rm tls-key
sudo -i podman volume rm etc-apache2
sudo -i podman volume rm etc-systemd-multi
sudo -i podman volume rm etc-systemd-sockets
sudo -i podman volume rm etc-salt
sudo -i podman volume rm etc-tomcat
sudo -i podman volume rm etc-cobbler
sudo -i podman volume rm etc-sysconfig
sudo -i podman volume rm etc-postfix
sudo -i podman volume rm etc-sssd

echo "Remove network"
sudo -i podman network rm network

Expand Down
97 changes: 97 additions & 0 deletions testsuite/podman_runner/07_server_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -xe

src_dir=$(cd $(dirname "$0")/../.. && pwd -P)

setup_pm_path=`sudo -i podman run --rm -ti ghcr.io/$UYUNI_PROJECT/uyuni/ci-test-server-all-in-one-dev:$UYUNI_VERSION sh -c 'rpm -ql spacewalk-setup | grep Setup.pm' | tr -d '\r'`

sudo -i podman run --cap-add AUDIT_CONTROL --rm \
--tmpfs /run \
-v var-cobbler:/var/lib/cobbler:z \
-v var-search:/var/lib/rhn/search:z \
-v var-salt:/var/lib/salt:z \
-v var-cache:/var/cache:z \
-v var-spacewalk:/var/spacewalk:z \
-v var-log:/var/log:z \
-v srv-salt:/srv/salt:z \
-v srv-www:/srv/www/:z \
-v srv-tftpboot:/srv/tftpboot:z \
-v srv-formulametadata:/srv/formula_metadata:z \
-v srv-pillar:/srv/pillar:z \
-v srv-susemanager:/srv/susemanager:z \
-v srv-spacewalk:/srv/spacewalk:z \
-v root:/root:z \
-v ca-cert:/etc/pki/trust/anchors/:z \
-v run-salt-master:/run/salt/master:z \
-v etc-tls:/etc/pki/tls:z \
-v var-pgsql:/var/lib/pgsql:z \
-v etc-rhn:/etc/rhn:z \
-v tls-key:/etc/pki/spacewalk-tls:z \
-v etc-apache2:/etc/apache2:z \
-v etc-systemd-multi:/etc/systemd/system/multi-user.target.wants:z \
-v etc-systemd-sockets:/etc/systemd/system/sockets.target.wants:z \
-v etc-salt:/etc/salt:z \
-v etc-tomcat:/etc/tomcat:z \
-v etc-cobbler:/etc/cobbler:z \
-v etc-sysconfig:/etc/sysconfig:z \
-v etc-postfix:/etc/postfix:z \
-v etc-sssd:/etc/sssd:z \
-v ${src_dir}/schema/spacewalk/spacewalk-schema-upgrade:/usr/bin/spacewalk-schema-upgrade \
-v ${src_dir}/testsuite:/testsuite \
-v ${src_dir}/schema/spacewalk/upgrade/:/usr/share/susemanager/db/schema-upgrade/ \
-v ${src_dir}/schema/reportdb/upgrade/:/usr/share/susemanager/db/reportdb-schema-upgrade/ \
-v ${src_dir}/web:/web \
-v ${src_dir}/branding:/branding \
-v ${src_dir}/java:/java \
-v ${src_dir}/client:/client \
-v ${src_dir}/susemanager-utils:/susemanager-utils \
-v ${src_dir}/susemanager:/susemanager \
-v ${src_dir}/susemanager/bin/mgr-setup:/usr/lib/susemanager/bin/mgr-setup \
-v ${src_dir}/spacewalk/setup/share/tomcat_java_opts.conf:/etc/tomcat/conf.d/tomcat_java_opts.conf \
-v ${src_dir}/spacewalk/setup/share/tomcat_java_opts_suse.conf:/etc/tomcat/conf.d/tomcat_java_opts_suse.conf \
-v ${src_dir}/java/conf/default/rhn_taskomatic_daemon.conf:/usr/share/rhn/config-defaults/rhn_taskomatic_daemon.conf \
-v ${src_dir}/spacewalk/uyuni-setup-reportdb/bin/uyuni-setup-reportdb:/usr/bin/uyuni-setup-reportdb \
-v ${src_dir}/spacewalk/setup/bin/spacewalk-setup:/usr/bin/spacewalk-setup \
-v ${src_dir}/spacewalk/setup/lib/Spacewalk/Setup.pm:${setup_pm_path} \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
-v /tmp/testing:/tmp \
-e CERT_O="test_org" \
-e CERT_OU="test_ou" \
-e CERT_CITY="test_city" \
-e CERT_STATE="test_state" \
-e CERT_COUNTRY="DE" \
-e CERT_EMAIL="[email protected]" \
-e CERT_CNAMES="server" \
-e CERT_PASS="spacewalk" \
-e UYUNI_FQDN="server" \
-e MANAGER_USER="admin" \
-e MANAGER_PASS="spacewalk" \
-e MANAGER_ADMIN_EMAIL="[email protected]" \
-e MANAGER_MAIL_FROM="[email protected]" \
-e MANAGER_ENABLE_TFTP="n" \
-e MANAGER_DB_NAME="manager" \
-e MANAGER_DB_HOST="localhost" \
-e MANAGER_DB_PORT="5432" \
-e MANAGER_DB_USER="manager" \
-e MANAGER_DB_PASS="manager" \
-e MANAGER_DB_PROTOCOL="TCP" \
-e REPORT_DB_NAME="reportdb" \
-e REPORT_DB_USER="pythia_susemanager" \
-e REPORT_DB_PASS="pythia_susemanager" \
-e EXTERNALDB_ADMIN_USER="" \
-e EXTERNALDB_ADMIN_PASS="" \
-e EXTERNALDB_PROVIDER="" \
-e ISS_PARENT="" \
-e ACTIVATE_SLP="" \
-e SCC_USER="" \
-e SCC_PASS="" \
--cgroupns=host \
-h server \
--name=server-setup \
--network network \
ghcr.io/$UYUNI_PROJECT/uyuni/ci-test-server-all-in-one-dev:$UYUNI_VERSION \
bash -xc "/testsuite/podman_runner/provide-db-schema.sh && \
/usr/lib/susemanager/bin/mgr-setup && \
/usr/bin/spacewalk-schema-upgrade -y && \
/testsuite/podman_runner/run_db_migrations.sh susemanager-schema && \
/testsuite/podman_runner/run_db_migrations.sh uyuni-reportdb-schema"
34 changes: 0 additions & 34 deletions testsuite/podman_runner/07_start_server.sh

This file was deleted.

21 changes: 0 additions & 21 deletions testsuite/podman_runner/08_manager_setup.sh

This file was deleted.

68 changes: 68 additions & 0 deletions testsuite/podman_runner/08_start_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
set -xe
src_dir=$(cd $(dirname "$0")/../.. && pwd -P)

setup_pm_path=`sudo -i podman run --rm -ti ghcr.io/$UYUNI_PROJECT/uyuni/ci-test-server-all-in-one-dev:$UYUNI_VERSION sh -c 'rpm -ql spacewalk-setup | grep Setup.pm' | tr -d '\r'`

sudo -i podman run --cap-add AUDIT_CONTROL --rm \
--tmpfs /run \
-v var-cobbler:/var/lib/cobbler:z \
-v var-search:/var/lib/rhn/search:z \
-v var-salt:/var/lib/salt:z \
-v var-cache:/var/cache:z \
-v var-spacewalk:/var/spacewalk:z \
-v var-log:/var/log:z \
-v srv-salt:/srv/salt:z \
-v srv-www:/srv/www/:z \
-v srv-tftpboot:/srv/tftpboot:z \
-v srv-formulametadata:/srv/formula_metadata:z \
-v srv-pillar:/srv/pillar:z \
-v srv-susemanager:/srv/susemanager:z \
-v srv-spacewalk:/srv/spacewalk:z \
-v root:/root:z \
-v ca-cert:/etc/pki/trust/anchors/:z \
-v run-salt-master:/run/salt/master:z \
-v etc-tls:/etc/pki/tls:z \
-v var-pgsql:/var/lib/pgsql:z \
-v etc-rhn:/etc/rhn:z \
-v tls-key:/etc/pki/spacewalk-tls:z \
-v etc-apache2:/etc/apache2:z \
-v etc-systemd-multi:/etc/systemd/system/multi-user.target.wants:z \
-v etc-systemd-sockets:/etc/systemd/system/sockets.target.wants:z \
-v etc-salt:/etc/salt:z \
-v etc-tomcat:/etc/tomcat:z \
-v etc-cobbler:/etc/cobbler:z \
-v etc-sysconfig:/etc/sysconfig:z \
-v etc-postfix:/etc/postfix:z \
-v etc-sssd:/etc/sssd:z \
-v ${src_dir}/schema/spacewalk/spacewalk-schema-upgrade:/usr/bin/spacewalk-schema-upgrade \
-v ${src_dir}/testsuite:/testsuite \
-v ${src_dir}/schema/spacewalk/upgrade/:/usr/share/susemanager/db/schema-upgrade/ \
-v ${src_dir}/schema/reportdb/upgrade/:/usr/share/susemanager/db/reportdb-schema-upgrade/ \
-v ${src_dir}/web:/web \
-v ${src_dir}/branding:/branding \
-v ${src_dir}/java:/java \
-v ${src_dir}/client:/client \
-v ${src_dir}/susemanager-utils:/susemanager-utils \
-v ${src_dir}/susemanager:/susemanager \
-v ${src_dir}/susemanager/bin/mgr-setup:/usr/lib/susemanager/bin/mgr-setup \
-v ${src_dir}/spacewalk/setup/share/tomcat_java_opts.conf:/etc/tomcat/conf.d/tomcat_java_opts.conf \
-v ${src_dir}/spacewalk/setup/share/tomcat_java_opts_suse.conf:/etc/tomcat/conf.d/tomcat_java_opts_suse.conf \
-v ${src_dir}/java/conf/default/rhn_taskomatic_daemon.conf:/usr/share/rhn/config-defaults/rhn_taskomatic_daemon.conf \
-v ${src_dir}/spacewalk/uyuni-setup-reportdb/bin/uyuni-setup-reportdb:/usr/bin/uyuni-setup-reportdb \
-v ${src_dir}/spacewalk/setup/bin/spacewalk-setup:/usr/bin/spacewalk-setup \
-v ${src_dir}/spacewalk/setup/lib/Spacewalk/Setup.pm:${setup_pm_path} \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
-v /tmp/testing:/tmp \
--cgroupns=host \
-h server \
-p 8443:443 \
-p 8080:80 \
-p 9090:9090 \
-p 4505:4505 \
-p 4506:4506 \
-d --name=server \
--network network \
ghcr.io/$UYUNI_PROJECT/uyuni/ci-test-server-all-in-one-dev:$UYUNI_VERSION
sudo -i podman exec -d server prometheus

4 changes: 2 additions & 2 deletions testsuite/podman_runner/run
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ set -e
./04_setup_ssh_controller.sh
./05_install_gems_in_controller.sh
./06_collect_and_tag_flaky_tests_in_controller.sh
./07_start_server.sh
./08_manager_setup.sh
./07_server_setup.sh
./08_start_server.sh
./09_build_server_code.sh
./10_run_sshminion.sh
./11_setup_sshd.sh
Expand Down
9 changes: 4 additions & 5 deletions testsuite/podman_runner/run_db_migrations.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/bash -e
#!/bin/bash -ex

if [ $# -ne 2 ];
if [ $# -ne 1 ];
then
echo "Usage: $0 <schema_name> <schema_version>"
echo "Usage: $0 <schema_name>"
echo "where"
echo " schema_name name of the schema to update (susemanager-schema or uyuni-reportdb-schema)"
echo " schema_version version of the schema currently installed"
exit 1
fi

Expand All @@ -24,7 +23,7 @@ fi

# Start with the given schema name and version
schema="$1"
version="$2"
version=$(rpm -q --queryformat '%version' ${schema})

# Get the upgrade dir for the current schema and version
current_dir="$(find ${upgrade_dir} -name "$schema-$version-to-*")"
Expand Down

0 comments on commit 842bb4d

Please sign in to comment.