在做gitlab-ci的自动部署过程中
1.runner已经安装、
2.runner已经注册
3.gitlab已经找到了runner
4.yml文件已经编写
5.script中脚本shell编写,直接执行
6.脚本在服务器上root测试通过
7.在runner执行过程中脚本报错比较多,大多数是文件夹不存在,无权限等等
我就讲runner的执行用户更改为root
ps aux|grep gitlab-runner #查看当前runner用户 sudo gitlab-runner uninstall #删除gitlab-runner gitlab-runner install --working-directory /home/gitlab-runner --user root #安装并设置--user(例如我想设置为root) sudo service gitlab-runner restart #重启gitlab-runner ps aux|grep gitlab-runner #再次执行会发现--user的用户名已经更换成root了
原文:https://www.cnblogs.com/bafeiyu/p/12538861.html