Registering runner... succeeded runner=Q_1HebnF
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
gitlab-runner ALL=(ALL) NOPASSWD: ALL
ERROR, did not find the visudo user thatwas added
Runtime platform arch=amd64 os=linux pid=17862 revision=98daeee0 version=14.7.0
Runtime platform arch=amd64 os=linux pid=17876 revision=98daeee0 version=14.7.0
The gitlab runner is already running
COMPLETED RUNNER INSTALLATION.
visudo_line="$RUNNER_USERNAME ALL=(ALL) NOPASSWD: ALL"
filepath="/etc/sudoers"
added_runner_to_visudo=$(visudo_contains "$visudo_line" "$filepath")
if [ "$added_runner_to_visudo" == "NOTFOUND" ]; then
echo "$RUNNER_USERNAME ALL=(ALL) NOPASSWD: ALL" | sudo EDITOR='tee -a' visudo
added_runner_to_visudo=$(visudo_contains "$visudo_line" "$filepath")
if [ "$added_runner_to_visudo" == "NOTFOUND" ]; then
# TODO: raise exception
echo "ERROR, did not find the visudo user thatwas added"
#exit 1
fi
fi
Also has test:
@test "Test file contains string with variable username that does exist." {
# TODO: Move this test to a function where the installation is completed.
username="$GITLAB_SERVER_ACCOUNT_GLOBAL"
line="$username ALL=(ALL:ALL) ALL"
actual_result=$(visudo_contains "$line" )
EXPECTED_OUTPUT="FOUND"
assert_equal "$actual_result" "$EXPECTED_OUTPUT"
}
in test/no_server_required/preserves_server/test_parsing.bats.
[ ] Resolve issue. (Ensure error message goes away because reason for error is removed.)
Output:
Related code: https://github.com/Simple-Setup/Self-host-GitLab-Server-and-Runner-CI/blob/8fd9eb27ee794e4e61cfe376a0238cd8c926c245/src/install_and_boot_gitlab_runner.sh
Also has test:
in
test/no_server_required/preserves_server/test_parsing.bats
.