前言

什么是CI/CD?

CI (Continuous Integration) 持续集成, CD (Continuous Delivery) 持续部署

个人理解

本地开发代码, 提交远程仓库

仓库接收到提交操作,进入持续集成, 包括编译,自动化测试 (CI)

编译测试成功后,部署到线上服务器(CD)

gitlab-runner 介绍

gitlab 提供了一个持续集成的服务, 如果你在项目仓库里面加入.gitlab-ci.yml文件 同时给项目配置了gitlab-runner, 那么每一次push commit, 都会触发你的 CI pipeline (持续集成管道)

安装gitlab-runner

官方文档

代理安装 gitlab-runner

如果机器能够正常访问外网,那么查阅官方文档进行安装

一般来说,内网与外网是处于隔断的情况,但是可以通过http代理服务器,允许内网访问外网的资源。

假设代理服务器机器的ip为: http://192.168.1.100:8000

具体步骤:

编辑 yum.conf

sudo vi /etc/yum.conf

# 追加一行
proxy=http://192.168.1.100:8000 #添加 GitLab's official repository (yum仓库) http_proxy=http://192.168.1.100:8000 curl -L -x $http_proxy https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sed "s#curl -sSf#curl -x $http_proxy -sSf#g" > script.rpm.sh
sudo bash script.rpm.sh

下载安装gitlab

# 查看gitlab-runner的版本
yum list gitlab-runner --showduplicates | sort -r gitlab-runner.x86_64 10.5.0-1 runner_gitlab-runner
gitlab-runner.x86_64 10.4.0-1 runner_gitlab-runner
gitlab-runner.x86_64 10.3.1-1 runner_gitlab-runner
gitlab-runner.x86_64 10.3.0-1 runner_gitlab-runner
gitlab-runner.x86_64 10.2.1-1 runner_gitlab-runner
gitlab-runner.x86_64 10.2.0-1 runner_gitlab-runner
gitlab-runner.x86_64 10.1.1-1 runner_gitlab-runner
gitlab-runner.x86_64 10.1.0-1 runner_gitlab-runner
gitlab-runner.x86_64 10.0.2-1 runner_gitlab-runner
gitlab-runner.x86_64 10.0.1-1 runner_gitlab-runner
gitlab-runner.x86_64 10.0.0-1 runner_gitlab-runner # 指定安装某个版本
sudo yum install gitlab-runner-10.1.1-1 -y

安装完成后, 出现一个/home/gitlab-runner 文件夹

gitlab-runner 命令

主要的命令操作有如下: install, start, stop, status, register, unregister

install 命令

安装配置 gitlab-runner, 如果使用yum install 则会默认安装

# --user 用户名
# --working-directory 工作目录
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner

start 命令

sudo gitlab-runner start, 启动服务

stop 命令

sudo gitlab-runner stop, 关闭服务

status 命令

sudo gitlab-runner status, 查看服务运行状态

在仓库中查阅CI / CD Setting, 得到 CI token

sudo gitlab-runner register

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.com/ Please enter the gitlab-ci token for this runner:
gHKt7inn3nBzJ2m5gx-P 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
Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml
hostname Executor=shell Token=token URL=https://gitlab.com/

注册后,gitlab 页面将出现一个运行的runner

gitlab-runner unregister 命令

通过 url 和 token 取消注册 gitlab-runner unregister --url http://gitlab.example.com/ --token t0k3n

通过name取消注册 gitlab-runner unregister --name test-runner

删除所有注册runner gitlab-runner unregister --all-runners

gitlab-ci-runner安装的更多相关文章

  1. Docker搭建自己的Gitlab CI Runner

    转载自:https://cloud.tencent.com/developer/article/1010595 1.Gitlab CI介绍 CI:持续集成,我们通常使用CI来做一些自动化工作,比如程序 ...

  2. 在 Kubernetes 上安装 Gitlab CI Runner Gitlab CI 基本概念以及 Runner 的安装

    简介 从 Gitlab 8.0 开始,Gitlab CI 就已经集成在 Gitlab 中,我们只要在项目中添加一个.gitlab-ci.yml文件,然后添加一个Runner,即可进行持续集成.在介绍 ...

  3. 3.在 Kubernetes 上安装 Gitlab CI Runner

    结合文章:1. 在 Kubernetes 上安装 Gitlab ,地址:https://www.cnblogs.com/sanduzxcvbnm/p/13852854.html 总结: 结合开头的文章 ...

  4. K8s 部署 Gitlab CI Runner

    K8s 版本:1.20.6 GitLab CI 最大的作用是管理各个项目的构建状态.因此,运行构建任务这种浪费资源的事情交给一个独立的 Gitlab Runner 来做就会好很多,而且 Gitlab ...

  5. GitLab CI runner can't connect to tcp://localhost:2375 in kubernetes

    报错的.gitlab-ci.yml配置如下 image: docker:latest services: - docker:dind variables: DOCKER_HOST: tcp://loc ...

  6. 使用GitLab CI + Capistrano部署CakePHP应用程序

    使用GitLab CI + Capistrano部署CakePHP应用程序 摘要:本文描述了如使用GitLab CI + Capistrano部署CakePHP应用程序. 目录 1. 问题2. 解决方 ...

  7. Gitlab CI持续集成 - GitLab Runner 安装与注册

    GitLab Runner安装 需要添加gitlab官方库: # For Debian/Ubuntu/Mint curl -L https://packages.gitlab.com/install/ ...

  8. Ubuntu Docker 安装和配置 GitLab CI 持续集成

    相关文章: Ubuntu Docker 简单安装 GitLab 劈荆斩棘:Gitlab 部署 CI 持续集成 目的:在 Ubuntu 服务器上,使用 Docker 安装和配置 GitLab Runne ...

  9. [转] Gitlab 8.x runner安装与配置

    [From]http://muchstudy.com/2018/07/13/Gitlab-8-x-runner%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE ...

  10. docker-Gitlab、GitLab Runner安装

    以下操作均在CentOs下操作 1.Gitlab install ① 启动gitlab docker run --detach \ --hostname 115.30.149.35 \ --publi ...

随机推荐

  1. ORACLE复杂查询之连接查询

    一.传统的连接查询 1.交叉连接:返回笛卡尔积 WHERE中限定查询条件,可以预先过滤掉掉不符合条件的记录,返回的只是两个表中剩余记录(符合条件的记录)的笛卡尔积. 2.内连接:参与连接的表地位平等, ...

  2. centos 5.3 安装(samba 3.4.4)

    centos 5.3 安装(samba 3.4.4) 博客分类: 操作系统 Linux   随着Linux的普及,如何共享Linux下的文件成为用户关心的问题.其实,几乎所有的Linux发行套件都提供 ...

  3. pydev 下Django 1.7 undefined variables from import问题的解决

    参考:http://stackoverflow.com/questions/24951029/pydev-django-undefined-variables-from-import 参考上面的帖子认 ...

  4. POSTGRESQL 并发控制

    http://meidayhxp.blog.163.com/blog/static/117608156201210243837491/ 这个内容是官方Doc中的一章,具体是那一版的,还未确认. 第九章 ...

  5. C++的拷贝构造函数、operator=运算符重载,深拷贝和浅拷贝、explicit关键字

    原文地址:https://blog.csdn.net/shine_journey/article/details/53081523 1.在C++编码过程中,类的创建十分频繁. 简单的功能,当然不用考虑 ...

  6. 在cmd下运行Python脚本+如何使用Python Shell

    原文:https://blog.csdn.net/flyfrommath/article/details/77447587?locationNum=2&fps=1

  7. HTML 标签小细节

    简书地址:https://www.jianshu.com/p/03a23aa28a34 今天重新学习了一下HTML中标签的用法,补充并记录一下自己新学到的知识. a中的href href Contai ...

  8. 115个Java面试题和答案——终极列表(上)【转】

    本文我们将要讨论Java面试中的各种不同类型的面试题,它们可以让雇主测试应聘者的Java和通用的面向对象编程的能力.下面的章节分为上下两篇,第一篇将要讨论面向对象编程和它的特点,关于Java和它的功能 ...

  9. OC和Swift中的UITabBar和UINaviGationBar的适配 [UITabbar在IPad中的适配]

    作者 sundays http://www.cnblogs.com/sundaysgarden/ OC中UITabbar的适配[iphoneX和Ipad适配] 自定可以UITabar 自定义UITab ...

  10. 微信小程序开发入门:10分钟从0开始写一个hello-world

    小程序开发需要三个描述整体程序的app文件 和 一个描述多个页面的 pages文件夹. (1)三个app文件分别是app.js,app.json,app.wxss. app.js文件是脚本文件处理一些 ...