当前位置: 代码迷 >> 综合 >> centos 7 下 gitlab-runner 自动 CI/CD (持续集成/持续部署) 配置
  详细解决方案

centos 7 下 gitlab-runner 自动 CI/CD (持续集成/持续部署) 配置

热度:99   发布时间:2023-10-10 05:43:18.0

1、下载 gitlab-runner 安装包

[root@izuf61s3j5m1fuhcwghcysz ~]# wget -O /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64

2、赋予执行权限

[root@izuf61s3j5m1fuhcwghcysz ~]# chmod +x /usr/local/bin/gitlab-runner

3、创建runner用户

[root@izuf61s3j5m1fuhcwghcysz ~]# useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash

4、注册runner

先到gitlab上查看如下图信息:
centos 7 下 gitlab-runner 自动 CI/CD (持续集成/持续部署) 配置

开始注册 runner

[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner register

centos 7 下 gitlab-runner 自动 CI/CD (持续集成/持续部署) 配置

5、安装并启动 gitlab-runner

[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner start

如果 gitlab-runner start 无法启动,换成 gitlab-runner run 启动方式

更新操作

停止服务

[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner stop

下载新版本并设置执行权限

[root@izuf61s3j5m1fuhcwghcysz ~]# wget -O /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
[root@izuf61s3j5m1fuhcwghcysz ~]# chmod +x /usr/local/bin/gitlab-runner

启动服务

[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner start
  相关解决方案