From d05fd14866d679fd73b719f07b98ac20111cc2e1 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Nov 12 2017 16:10:22 +0000 Subject: add script to prepare the CI runner to run the show_highstate tests --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ce452b8..20167c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,11 +21,7 @@ test_custom_grains: test_show_highstate: stage: test before_script: - - zypper -qn in --no-recommends salt git python3 python3-PyYAML - - rm -rf /srv/{salt,pillar} - - ln -s $PWD/salt /srv/salt - - ln -s $PWD/pillar /srv/pillar - - sed -i -e 's/^production:$/base:/' /srv/{salt,pillar}/top.sls + - bin/prepare_test_show_highstate_env.sh - bin/get_formulas.py -c /srv/formula -s script: bin/test_show_highstate.sh tags: diff --git a/bin/prepare_test_show_highstate_env.sh b/bin/prepare_test_show_highstate_env.sh new file mode 100755 index 0000000..f01aca5 --- /dev/null +++ b/bin/prepare_test_show_highstate_env.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Prepares the CI runner environment to run the show_highstate tests + +zypper -qn in --no-recommends salt git python3 python3-PyYAML +rm -rf /srv/{salt,pillar} +ln -s $PWD/salt /srv/salt +ln -s $PWD/pillar /srv/pillar +sed -i -e 's/^production:$/base:/' /srv/{salt,pillar}/top.sls +echo 'domain: infra.opensuse.org' > /etc/salt/grains +ROLES=$(bin/get_roles.py --yaml) +printf "city:\ncountry:\nsalt_cluster: opensuse\nvirt_cluster:\n$ROLES" > pillar/id/${HOSTNAME}.sls diff --git a/bin/test_show_highstate.sh b/bin/test_show_highstate.sh index bf70ded..d85d18b 100755 --- a/bin/test_show_highstate.sh +++ b/bin/test_show_highstate.sh @@ -5,10 +5,6 @@ set -e RUN_TEST="salt-call --local --retcode-passthrough state.show_highstate" -ROLES=$(bin/get_roles.py --yaml) - -echo 'domain: infra.opensuse.org' > /etc/salt/grains -printf "city:\ncountry:\nsalt_cluster: opensuse\nvirt_cluster:\n$ROLES" > pillar/id/${HOSTNAME}.sls sed -i -e 's/\(city:\).*/\1 nuremberg/' -e 's/\(country:\).*/\1 de/' -e 's/\(virt_cluster:\).*/\1 atreju/' pillar/id/${HOSTNAME}.sls $RUN_TEST > /dev/null