搭建环境Ubuntu18、gitlab-ce15.6.2、gitlab-runner15.6.3、maven3.8.8、openjdk17

先说句废话,我不是专业运维,我也不是非专业运维,我是个做开发的

第一步:安装gitlab

源地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
选择合适的版本

我用的15.6.2,别问我为什么因为公司已经在使用的就是这个版本

get https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.6.2-ce.0.el7.x86_64.rpm


rpm -ivh gitlab-ce-15.6.2-ce.0.el7.x86_64.rpm

vim /etc/gitlab.rb   # 编辑站点地址
gitlab-ctl reconfigure  # 配置


#服务控制
gitlab-ctl start 
gitlab-ctl status
gitlab-ctl stop 

还有其它安装方式 docker 、k8s等,我没有自己实践所以就不在这里说了

第二步安装gitlab-runner

GitLab Runner是一个开源项目,用于运行您的作业并将结果发送回GitLab。它与GitLab CI结合使用,GitLab CIGitLab随附的用于协调作业的开源持续集成服务。

# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

#安装指定版本
apt-cache madison gitlab-runner
sudo apt-get install gitlab-runner=15.6.2

这是我用的方式,还有其它方式请自行百度

登录gitlab找到项目中设置-》cicd-〉runner

我使用的是交互方式注册的

注册成功后

第三步配置gitlab-ci.yml

在项目根目录下创建并验证

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐