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