环境介绍:

说明 节点 ip 系统
Gitlab Server git.ds.com 10.0.1.179 CentOS 7.5.1804
Gitlab Runner   10.0.1.178 CentOS 7.5.1804
Docker Registry Harbor harbor.ds.com 10.0.1.183 CentOS 7.5.1804

关于 gitlab server和Harbor的安装这里就表述了。

一、gitlab runner的安装 (gitlab 10版本的)

1、根据具体的系统环境下载对应的二进制执行文件

1
2
3
4
5
6
7
8
# Linux x86-64
sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
 
# Linux x86
sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386
 
# Linux arm
sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm

通过下面的地址你可以找到左右版本的二进制文件

https://docs.gitlab.com/runner/install/bleeding-edge.html#download-any-other-tagged-release

2、给刚下载的二进制执行文件添加执行权限

1
sudo chmod +x /usr/local/bin/gitlab-runner

3、安装docker

1
curl -sSL https://get.docker.com/ | sh

4、创建一个gitlab ci用户

1
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash

5、将gitlab ci用户添加到docker运行用户的组里面

1
usermod -aG root gitlab-runner

由于我的docker是用root用户运行的所以我这边将gitlab-runner用户加到root的组里面了。

6、开始运行GitLab-Runner

1
2
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
gitlab-runner start

二、注册Runners

1、打开gitlab页面找到runners的注册令牌

2、去gitlab runner的节点上做注册动作

1
gitlab-runner register
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
[root@DS-VM-Node_10_0_1_178 ~]$ gitlab-runner register
Running in system-mode.
 
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://git.ds.com
Please enter the gitlab-ci token for this runner:
Fx1jQzBW5ZJoxz157KEU
Please enter the gitlab-ci description for this runner:
[DS-VM-Node_10_0_1_178.dwhd.org]:
Please enter the gitlab-ci tags for this runner (comma separated):
myrunner_10_0_1_178_2
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock the Runner to current project [true/false]:
[true]: true
Registering runner... succeeded                     runner=Fx1jQzBW
Please enter the executor: docker-ssh+machine, kubernetes, docker-ssh, shell, virtualbox, docker+machine, docker, parallels, ssh:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
[root@DS-VM-Node_10_0_1_178 ~]$

3、重启一下runner使之生效

1
gitlab-runner restart

4、去gitlab上检查
能发现到一个刚注册的runner

5、将这个runner指定到指定项目上去

三、测试

新建了一个gitlab项目。

git clone https://github.com/lvelvis/ngx-docker.git

k8s Gitlab CI/CD 之自动编译Docker镜像并推送到指定的Registry的更多相关文章

  1. 利用 Maven 创建 Docker 镜像并且推送到私有注册中心

    利用 Maven 命令生成项目框架 mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -Darchetype ...

  2. 03.pipeline实现项目自动编译docker镜像自动打包

    https://jenkins.io/zh/doc/book/pipeline/ 官方教程,可以中文.Jenkinsfile就是把pipeline内容保存到文件,然后提交到svn等版本控制库中.安装b ...

  3. 使用Jenkins自带功能(不用shell)构建Docker镜像并推送到远程仓库

    意义: 一开始实现这个目的是在Jenkins中使用的shell脚本,也就是如下的这个: bash # 进入到生成jar包的根目录 cd ${WORKSPACE}/${module_filename} ...

  4. 【OF框架】在Visual Studio中发布Docker镜像,推送镜像到Azure容器注册表

    准备 拥有Azure账号,已经创建 Azure容器注册表,获得注册表地址.账号.密码 本地已经在Visual Studio登录Azure账号. 本地已经拥有Docker环境 注意:首次发布Docker ...

  5. Docker 镜像的推送(六)

    目录 一.为镜像命名 二.推送到官方 Docker Hub 1.首先得在 Docker Hub 上注册一个账号. 2.在 Docker Host 上登录 3.修改镜像命名 4.镜像上传 5.登录查看上 ...

  6. 使用maven插件dockerfile-maven-plugin生成Docker镜像并推送到镜像仓库

    1.引入maven插件 <build> <plugins> <plugin> <groupId>com.spotify</groupId> ...

  7. 实践分享!GitLab CI/CD 快速入门

    用过 GitLab 的同学肯定也对 GitLab CI/CD 不陌生,GitLab CI/CD 是一个内置在 GitLab 中的工具,它可以帮助我们在每次代码推送时运行一系列脚本来构建.测试和验证代码 ...

  8. GitLab CI/CD的官译【原】

    CI / CD方法简介 软件开发的持续集成基于自动执行脚本,以最大限度地减少在开发应用程序时引入错误的可能性.从新代码的开发到部署,它们需要较少的人为干预甚至根本不需要干预. 它涉及在每次小迭代中不断 ...

  9. .Net Core自动化部署系列(三):使用GitLab CI/CD 自动部署Api到Docker

    之前写过使用Jenkins实现自动化部署,最近正好没事研究了下GitLab的自动化部署,顺便记录一下. 使用GitLab部署我们需要准备两件事,第一个起码你得有个GitLab,自己搭建或者使用官方的都 ...

随机推荐

  1. [原创]Linux(CentOS)下安装mongodb

    和上一篇一样,装个这个踩了无数个坑…… 1.下载 wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel55-3.2.12.tgz ...

  2. Eclipse Rap开发 异步刷新UI处理

    1.Display.getCurrent()获取的是当前线程的display对象,如果当前在非UI线程中那么获取到的display对象为空:      一般Display.getCurrent() 用 ...

  3. 开源作品-PHP写的Redis管理工具(单文件绿色版)-SuRedisAdmin_PHP_1_0

    前言:项目开发用到了Redis,但是在调试Redis数据的时候,没有一款通用的可视化管理工具.在网络找了一些,但是感觉功能上都不尽人意,于是决定抽出一点时间,开发一个用起来顺手的Redis管理工具.秉 ...

  4. Embedded之Makefile

    1 Header files The header files are empty, so you can create them with touch: $ touch a.h $ touch b. ...

  5. apicloud UISearchBar 使用方法

    app中经常会有搜索的页面. 大概逻辑是,一般来说首页有一个搜索的图,点击之后跳转到一个搜索的页面,在这个页面做搜索. 正常代码逻辑 <body> <a class="bu ...

  6. 物理cpu与逻辑cpu概述

    物理cpu与逻辑cpu概述(本博客属于转载部分内容:主要学习目的用于大数据平台Hadoop之yarn资源调度的配置) 一.yarn资源调度器中主要的资源分类       1.memory(内存) 2. ...

  7. Python画三维图-----插值平滑数据

    一.二维的插值方法: 原始数据(x,y) 先对横坐标x进行扩充数据量,采用linspace.[如下面例子,由7个值扩充到300个] 采用scipy.interpolate中的spline来对纵坐标数据 ...

  8. pytorch实战(7)-----卷积神经网络

    一.卷积: 卷积在 pytorch 中有两种方式: [实际使用中基本都使用 nn.Conv2d() 这种形式] 一种是 torch.nn.Conv2d(), 一种是 torch.nn.function ...

  9. 认识计算机操作系统(day01)

    一.计算机的框架 什么是操作系统?(汽车) 加油系统 油门 用户跟加油子系统交互的窗口.(接口) 方向系统 方向盘 用户跟方向系统的交互接口. 导航系统 ... 汽车的操作系统有很多的子系统来完成.这 ...

  10. [luogu2825 HEOI2016/TJOI2016] 游戏 (二分图最大匹配)

    传送门 Description 在2016年,佳缘姐姐喜欢上了一款游戏,叫做泡泡堂.简单的说,这个游戏就是在一张地图上放上若干个炸弹,看是否能炸到对手,或者躲开对手的炸弹.在玩游戏的过程中,小H想到了 ...