Detect build directory permissions before starting GitLab Runner
Overvoiew
GitLab Runners can throw a non-descript and potentially misleading error if the build directory does not have the appropriate permissions.
When the job is launched, errors such as ERROR: Job failed (system failure): prepare environment: unable to upgrade to tcp, received 409 (exec.go:71:0s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information can be seen. These errors are ambiguous enough not to identify the core problem. In this case, the /opt/gitlab-runner/builds directory did not have the appropriate permissions. Correcting this was easy as the directory was given rwx permissions by the user that launched gitlab-runner.
Proposal
- This is a proposal to check these permissions before run time and throw and error if the builds directory cannot be accessed correctly.
Implementation plan
-
improve the shell-profile-loadingerror message
Edited by Darren Eastman