以linux系统为例:
1, gitlab runner 和 gitlab 版本建议需要一致,差距过大,会报错。
2,使用清华源,下载对应gitlbal 版本的 gitlab-runner包
sudo curl -L --output /usr/local/bin/gitlab-runner-14.7.0-1.x86_64.rpm "https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/yum/el7/gitlab-runner-14.7.0-1.x86_64.rpm"
3,安装下载后的rpm包
rpm -ivh gitlab-runner-14.7.0-1.x86_64.rpm
4,启动gitlab-runner
systemctl start gitlab-runner
5,查看是否启动成功
systemctl status gitlab-runner
避坑指南:
gitlab、gitlab-runner、git三者之间有版本依赖关系,版本差距过大会报错。
我安装的gitlab-runner15.0,注册runner成功了,verify也正常,但就是不认领任务。降到14.7就正常了。
另外linux自带的git是1.8版本,用runner拉代码会报错,升级到2.36好了。
fatal: git fetch-pack: expected shallow list
fatal: The remote end hung up unexpectedly



