默认 gitlab-runner 安装使用 gitlab-runner 用户执行命令,这里会遇到用户权限问题,需要修改用户权限或者修改默认用户。

    • 修改默认用户为root

      1. sudo gitlab-runner uninstall
      2. sudo gitlab-runner install --user=root --working-directory=/home/gitlab-runner
      3. sudo gitlab-runner restart
    • 查看用户是否修改了

      1. [root@localhost ~]# ps aux | grep gitlab-runner
      2. root 1174 1.1 0.2 138140 20708 ? Ssl 08:22 3:51 /usr/bin/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user root
      3. root 17883 0.0 0.0 112828 984 pts/1 S+ 13:54 0:00 grep --color=auto gitlab-runner