From 8f886a8b7154e20bc6b16cc9e1fe50b04eb9b42f Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Mon, 1 Mar 2021 14:28:29 +0100 Subject: [PATCH] [doc/macos-ci-install] add reconfig script for gitlab-runner from homebrew --- doc/macos-ci-install/reconfig-gitlab-runner.sh | 17 +++++++++++++++++ doc/macos.rst | 11 +---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100755 doc/macos-ci-install/reconfig-gitlab-runner.sh diff --git a/doc/macos-ci-install/reconfig-gitlab-runner.sh b/doc/macos-ci-install/reconfig-gitlab-runner.sh new file mode 100755 index 00000000..0bbf8b6a --- /dev/null +++ b/doc/macos-ci-install/reconfig-gitlab-runner.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -x + +if [[ $EUID == 0 ]]; then + # restarts to reconfigure as gitlab user + exec su gitlab -c "$(which bash) ${0}" +fi + +# the command above is bogus - it will use the "admin" user home dir +# you need to reconfigure it to fix this +cfgfile="/Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist" +/bin/launchctl stop $cfgfile +/bin/launchctl unload $cfgfile +/usr/bin/sed -i~ 's/admin/gitlab/g' $cfgfile +/bin/launchctl load $cfgfile +/bin/launchctl start $cfgfile diff --git a/doc/macos.rst b/doc/macos.rst index 3cafe4b4..680f5182 100644 --- a/doc/macos.rst +++ b/doc/macos.rst @@ -151,16 +151,7 @@ Building the reference setup Configure the runner for `shell executor`_, with local caching. As ``gitlab`` user, execute on the command-line:: - $ brew services start gitlab-runner - # the command above is bogus - it will use the "admin" user home dir - # you need to reconfigure it to fix this - $ /bin/launchctl stop /Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist - $ /bin/launchctl unload /Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist - $ vim /Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist - # change all occurences of "admin" with "gitlab" - $ /bin/launchctl load /Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist - $ /bin/launchctl start /Users/gitlab/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist - # n.b.: re-executing "brew services start gitlab-runner" will reset the file above + $ /bin/bash <(curl -s https://gitlab.idiap.ch/bob/bob.devtools/raw/master/doc/macos-ci-install/reconfig-gitlab-runner.sh) Once that is set, your runner configuration (``~/.gitlab-runner/config.toml``) should look like this (remove comments if gitlab does not like them):: -- GitLab