GitLab的Shell执行器,无权限

标签 git permissions continuous-integration gitlab chmod

我有 8.7.0 版本的 GitLab 平台,我目前正在设置 CI 部分。 我创建了新的 gitlab-runner,它使用 shell 作为执行程序。 问题是在调用运行器来完成自己的工作之前,系统无法获取 git 更改。 构建过程的控制台输出:

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
...

stash 文件的文件夹是/home/gitlab-runner/builds 所以我想,有两个用户:git 和 gitlab-runner 并且 git 用户不能删除或重写这个目录中的文件。更改目录权限后,构建过程开始并成功完成,但之后文件再次具有旧权限(用户(gitlab-runner)读取+写入,其余文件读取)。所以现在我必须(最简单的方法)在构建之前始终从/home/gitlab-runner/builds 中删除所有内容,但这当然不是解决方案...... 我该怎么办?

最佳答案

我遇到了同样的问题,我想我已经解决了。您需要验证您的新文件是在哪个组下创建的(我的是 tape),然后将 gitlab-runner 添加到该组。在我的例子中,命令看起来像这样......

sudo usermod -a -G tape gitlab-runner

关于GitLab的Shell执行器,无权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36987100/

相关文章:

git - 将事物 merge 到生产/发布分支​​的正确方法是什么?

php - 在 PHP mkdir 中使用模式 0664 是个好主意吗?

Linux目录和文件权限

nginx - Github actions Runner 监听器已退出,错误代码为 null

c# - TeamCity + MSTest - 只运行失败的测试?

ios - Git 说 xcode Storyboard文件被修改

.net - 来自 Windows 控制台应用程序的退出代码在 git 钩子(Hook)脚本中不可用

git - 为什么它不是提交并且无法从中创建分支?

linux - WordPress 无法安装主题

notifications - 如何在 UrbanCode 部署中发送通知电子邮件?