Gitlab-runner安装配置

gitlab-runner介绍

gitlab-runner是gitlab的一个可持续集成和可持续部署的一个工具。通过ci/cd部署脚本将git仓库代码可持续性部署到服务器上。

gitlab-runner安装

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 r e l e a s e v e r − releasever- releaseverbasearch/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
再执行

sudo yum makecache
sudo yum install gitlab-runner

gitlab-runner配置

gitlab-runner注册

  • 注册命令:
sudo gitlab-runner register 
  • 执行命令后输出以下:

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):

https://git.xxxx.com/ (此处输入git项目地址)

Please enter the gitlab-ci token for this runner:

xxxxxxxxx-P   (此处输入key,通过gitlab页面获取)

Please enter the gitlab-ci description for this runner:

hostname

Please enter the gitlab-ci tags for this runner (comma separated):

node,test    (此处为项目标签)

Whether to run untagged builds [true/false]:
true
Whether to lock the Runner to current project [true/false]:
false
Registering runner… succeeded runner=gHKt7inn
Please enter the executor: docker+machine, kubernetes, docker-ssh, ssh, shell, virtualbox, docker-ssh+machine, docker, parallels:

shell   (输入你的部署方式)
  • 注册后使用 gitlab-runner list 查阅配置
sudo gitlab-runner list
  • 注册后,gitlab 页面将出现一个运行的runner

gitlab-runner 安装完需要写ci/cd自动化部署脚本
gitlab官网扩展示例
下载扩展示例
Gitlab-runner安装配置_第1张图片

下载命令

git clone https://gitlab.com/gitlab-org/gitlab.git

想要自己编写ci/cd见
gitlab自定义脚本

你可能感兴趣的:(gitlab,git)