CI/CD 部署gitlab runner
Ubuntu安装 runner
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt-get install gitlab-runner
Centos 安装 runner
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E yum install gitlab-runner
安装python3和fabric
yum install python3
pip3 install fabric
配置runner
Setup a specific Runner manually
- 安装一个与 GitLab CI 兼容的 Runner (如需了解更多的安装信息,请查看 GitLab Runner)
- 在 Runner 设置时指定以下 URL: http://git.puppetek.com:8090/
- 在安装过程中使用以下注册令牌: 1DkeoWb4znNxA91Yq8oH
- 启动 Runner!
sudo gitlab-runner register
安装gitlab-runner默认会将用户设置为:gitlab-runner,该设置会使编写.ci的脚本,操作带来很大不便,本人深受其害。
1.通过ps aux|grep gitlab-runner命令查看gitlab-runner进程,可以查看到gitlab-runner的工作目录和默认用户等一系列相关信息。
2.通过该命令sudo gitlab-runner uninstall可以删除掉gitlab-runner
3.重新安装gitlab-runner并将用户设置为root sudo gitlab-runner install --working-directory /home/gitlab-runner --user root
4.sudo service gitlab-runner restart重启gitlab-runner
5.再通过第一步的命令查看gitlab-runner看默认用户是否变成root