gitlab runner安裝
Debian/Ubuntu 用戶
1.首先信任 GitLab 的 GPG 公鑰:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
2.修改清華源:
vim /etc/apt/sources.list.d/gitlab-runner.list
deb http://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/debian buster main
3.安裝 gitlab-runner:
sudo apt-get update
sudo apt-get install gitlab-runner
CentOS/RHEL
新建 /etc/yum.repos.d/gitlab-runner.repo,內容為
[gitlab-runner]
name=gitlab-runner
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/yum/el$releasever/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
再執行
sudo yum makecache
sudo yum install gitlab-runner
4.啟動
gitlab-runner start
5.注冊runner
gitlab-runner register



運行:
gitlab-runner run
6.docker其他操作 (貌似可以忽略!)
sudo groupadd docker #添加docker用戶組
sudo gpasswd -a gitlab-runner docker #將登陸用戶加入到docker用戶組中
newgrp docker #更新用戶組
su gitlab-runner #切換到runner用戶組
docker ps #測試docker命令是否可以使用sudo正常使用
7.docker gitlab部署安裝
docker pull beginor/gitlab-ce:11.3.0-ce.0
docker run --detach --publish 8443:443 --publish 8880:80 --publish 8822:22 --name my-gitlab --restart unless-stopped --volume /Users/ys/svn_git/05Docker_workspace/gitlab/etc:/etc/gitlab --volume /Users/ys/svn_git/05Docker_workspace/gitlab/log:/var/log/gitlab --volume /Users/ys/svn_git/05Docker_workspace/gitlab/data:/var/opt/gitlab --privileged=true -d beginor/gitlab-ce:11.3.0-ce.0
8.測試
提交代碼,測試,是否觸發CI

相關鏈接
https://mirror.tuna.tsinghua.edu.cn/help/gitlab-runner/
https://github.com/yangshun2005/gitlab-cicd
