7

I have GitLab platform in 8.7.0 version and I am currently working on setting up CI part. I have created new gitlab-runner that uses shell as an executor. The problem is that before the runner is invoked to do own jobs the system is not able to fetch git changes. The console output from build process:

gitlab-ci-multi-runner 1.1.3 (a470667)
Using Shell executor...
Running on <my-page>...
Fetching changes...
warning: failed to remove <some-path>/localClassSetAnalysis.bin
warning: failed to remove <some-path>/localClassSetAnalysis.lock
...


gitlab-ci-multi-runner 1.1.3 (a470667)
Using Shell executor...
Running on <my-page>...
Cloning repository...
rm: cannot remove ‘path-to-some-directory>’: Permission denied
rm: cannot remove ‘path-to-some-directory>’: Permission denied
...

The folder where the files are stored is /home/gitlab-runner/builds So I suppose, there are two users: git and gitlab-runner and git user cannot remove or rewrite the files in this directory. After change the directory permissions build process is started and successfully finished but after that the files again have old permissions (read+write for the user (gitlab-runner) and read for the rest). So right now I must (the easiest way) delete all from /home/gitlab-runner/builds always before build, but of course it's not the solution... What should I do?

Roland
  • 189
  • 3
  • 7
  • Have you tried setting a umask to the folder? This you should be able to control what permissions newly created files have. – Fairy May 11 '16 at 12:00
  • Or give sudo privileges to `gitlab-runner` (obviously only if it is running in a docker container running in non-privileged mode). – Simon A. Eugster Nov 03 '17 at 10:25
  • I have the very same issue (i.e. permission denied for a "shell" registered gitlab-runner). However, I cannot use "docker" since I am on an iOS-app. And therefore "sudo" is not an option. Did you find another way of how to overcome this permissions-denied issue ?? [My issue is explained here...](https://stackoverflow.com/questions/55399687/gitlab-ci-ios-project-issue-permission-denied) Thanks for any help. – iKK Mar 29 '19 at 10:09

1 Answers1

2

I was having the same problem, and I think I figured it out. You'll need to verify what group your new files are being created under (mine was tape), and then add gitlab-runner to that group. In my case the command looked like this...

sudo usermod -a -G tape gitlab-runner

unforgiven1987
  • 454
  • 1
  • 3
  • 18