From b40db291e936175629534fe7d4dac0da50e0f23e Mon Sep 17 00:00:00 2001 From: Christian Poetter Date: Wed, 26 Apr 2017 11:51:14 +0200 Subject: [PATCH] add SUDOER variable to allow passwordless sudo access in shell executor --- entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3e2c19c..59f5e65 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -60,6 +60,13 @@ configure_ci_runner() { fi } +configure_sudoer() { + if [[ $SUDOER == true ]]; then + sudo adduser ${GITLAB_CI_MULTI_RUNNER_USER} sudo + sudo echo "${GITLAB_CI_MULTI_RUNNER_USER} ALL=NOPASSWD: ALL" > /etc/sudoers.d/${GITLAB_CI_MULTI_RUNNER_USER} + fi +} + # allow arguments to be passed to gitlab-ci-multi-runner if [[ ${1:0:1} = '-' ]]; then EXTRA_ARGS="$@" @@ -75,6 +82,7 @@ if [[ -z ${1} ]]; then update_ca_certificates generate_ssh_deploy_keys grant_access_to_docker_socket + configure_sudoer configure_ci_runner start-stop-daemon --start \