Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab's Shell executor, no privileges

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?

like image 436
Roland Avatar asked May 02 '16 16:05

Roland


People also ask

Who is the executor of GitLab runner?

Shell executor This executor is running the jobs directly on the machine where the runner has been installed.

What Shell does GitLab runner use?

PowerShell Desktop Edition is the default shell when a new runner is registered on Windows using GitLab Runner 12.0-13.12. In 14.0 and later, the default is PowerShell Core Edition. PowerShell doesn't support executing the build in context of another user.

How does GitLab Docker executor work?

GitLab Runner can use Docker to run jobs on user provided images. This is possible with the use of Docker executor. The Docker executor when used with GitLab CI, connects to Docker Engine and runs each build in a separate and isolated container using the predefined image that is set up in .


1 Answers

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

like image 163
unforgiven1987 Avatar answered Sep 30 '22 22:09

unforgiven1987