gitlab-runner LaunchAgent PATH issue
Summary
Using gitlab-runner on macOS with virtualbox executor and starting it as a LaunchAgent results in a stripped down PATH that doesn't include /usr/local/bin for some unknown reason.
Adding the following to Library/LaunchAgents/gitlab-runner.plist remedies the problem.
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
Steps to reproduce
Not actually sure how to reproduce this, it may be due to how my shell rc files are set up although I'm not sure how/if it can influence LaunchAgents. Anyway it's the most trivial setup with a specific runner:
stages:
- test
test:
stage: test
script:
- hostname
- pwd
tags:
- darwin
- sierra
Then starting it with:
gitlab-runner install
gitlab-runner register
gitlab-runner start
And pushing to trigger a CI pipeline.
Actual behavior
Running with gitlab-runner 11.1.0 (081978aa)
on galileo 79c47580
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in $PATH
Will be retried in 3s ...
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in $PATH
Will be retried in 3s ...
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in $PATH
Will be retried in 3s ...
ERROR: Job failed (system failure): exec: "vboxmanage": executable file not found in $PATH
Expected behavior
This is the output when setting PATH.
Running with gitlab-runner 11.1.0 (081978aa)
on galileo 79c47580
Using VirtualBox version 5.2.16r123759 executor...
Restoring VM from snapshot...
Starting VM...
Waiting VM to become responsive...
Starting SSH command...
Running on Sierra.local via Galileo.local...
Cloning repository...
Cloning into 'builds/archmac/ci-test'...
Checking out 2ff3f9a7 as master...
Skipping Git submodules setup
$ hostname
Sierra.local
$ pwd
/Users/runner/builds/archmac/ci-test
Skipping cache archiving due to empty cache key
Job succeeded
Relevant logs and/or screenshots
Jul 31 09:14:33 Galileo gitlab-runner[7702]: time="2018-07-31T09:14:33+02:00" level=warning msg="Running in user-mode."
Jul 31 09:14:33 Galileo gitlab-runner[7702]: time="2018-07-31T09:14:33+02:00" level=warning msg="Use sudo for system-mode:"
Jul 31 09:14:33 Galileo gitlab-runner[7702]: time="2018-07-31T09:14:33+02:00" level=warning msg="$ sudo gitlab-runner..."
Jul 31 09:15:00 Galileo gitlab-runner[7702]: time="2018-07-31T09:15:00+02:00" level=warning msg="Preparation failed: exec: \"vboxmanage\": executable file not found in $PATH" job=85557757 project=7692194 runner=79c47580
Jul 31 09:15:03 Galileo gitlab-runner[7702]: time="2018-07-31T09:15:03+02:00" level=warning msg="Preparation failed: exec: \"vboxmanage\": executable file not found in $PATH" job=85557757 project=7692194 runner=79c47580
Jul 31 09:15:06 Galileo gitlab-runner[7702]: time="2018-07-31T09:15:06+02:00" level=warning msg="Preparation failed: exec: \"vboxmanage\": executable file not found in $PATH" job=85557757 project=7692194 runner=79c47580
Jul 31 09:15:09 Galileo gitlab-runner[7702]: time="2018-07-31T09:15:09+02:00" level=error msg="Job failed (system failure): exec: \"vboxmanage\": executable file not found in $PATH" job=85557757 project=7692194 runner=79c47580
Jul 31 09:15:15 Galileo gitlab-runner[7702]: time="2018-07-31T09:15:15+02:00" level=warning msg="Requested service stop: terminated" builds=0
Environment description
Custom installation on macOS, using virtualbox executor. Using latest virtualbox (5.2.16), and stock macOS bash too, although with customised dotfiles (which is far from unusual I guess).
Used GitLab Runner version
Version: 11.1.0
Git revision: 081978aa
Git branch:
GO version: go1.8.7
Built: 2018-07-22T07:24:45+00:00
OS/Arch: darwin/amd64