diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1eaf765..db5a491 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,15 +59,6 @@ test_nginx: - bin/get_formulas.py -c -d /srv/formula -s --clone-from 'https://gitlab.infra.opensuse.org/saltstack-formulas' --clone-branch production -f nginx script: bin/test_nginx.sh -test_sudo: - extends: - - .test_common - before_script: - - bin/prepare_test_env.sh -g -s -n - - bin/get_formulas.py -c -d /srv/formula -s --clone-from 'https://gitlab.infra.opensuse.org/saltstack-formulas' --clone-branch production - script: bin/test_sudo.sh - - # Dynamically generated jobs prepare_includes: script: bin/render_gitlab_ci_includes.py -w diff --git a/bin/test_sudo.sh b/bin/test_sudo.sh deleted file mode 100755 index de93c8d..0000000 --- a/bin/test_sudo.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Validate the salt-generated sudo configs - -[[ $(whoami) == 'root' ]] || { echo 'Please run this script as root'; exit 1; } - -source bin/get_colors.sh - -reset_sudo() { - rm -rf /etc/sudoers* - cp -a /etc/orig/* /etc - printf "roles:\n- $role" > /etc/salt/grains -} - -mkdir /etc/orig -cp -a /etc/sudoers* /etc/orig - -run_tests() { - salt-call --local -l quiet state.apply sudoers,sudoers.included > /dev/null - visudo -c > output 2>&1 - STATUS=$? - if [[ $STATUS == 0 ]]; then - echo_PASSED - else - cat output - echo_FAILED - fi - echo - return $STATUS -} - -pushd pillar > /dev/null -SUDO_ROLES=( - # Get all the roles that contain sudoers entries - $(find role -type f -name '*.sls' -exec grep -l 'sudoers:' {} +) -) -popd > /dev/null - -ALL_STATUS=0 - -for _role in ${SUDO_ROLES[@]}; do - _role=${_role##*/} - role=${_role%%.*} - echo_INFO "Testing role: $role" - reset_sudo - run_tests || ALL_STATUS=$? -done - -exit $ALL_STATUS