gitlab CI
来源:互联网 发布:淘宝面膜便宜的原因 编辑:程序博客网 时间:2024/05/29 04:11
注意:gitlab 的CI 功能是版本>=8.0才有,如何安装gitlab可以自行搜索,或者点击 官方网站-安装gitlab
CI-官网
1.第一步 Add .gitlab-ci.yml to the root directory of your repository
[root@deployment ~]# mkdir test[root@deployment ~]# cd test/[root@deployment test]# git clone http://deployment/root/hello-world.git正克隆到 'hello-world'...Username for 'http://deployment': root Password for 'http://root@deployment': fatal: Authentication failed for 'http://deployment/root/hello-world.git/'[root@deployment test]# git clone http://deployment/root/hello-world.git正克隆到 'hello-world'...Username for 'http://deployment': rootPassword for 'http://root@deployment': fatal: Authentication failed for 'http://deployment/root/hello-world.git/'[root@deployment test]# git clone http://deployment/root/hello-world.git正克隆到 'hello-world'...Username for 'http://deployment': rootPassword for 'http://root@deployment': warning: 您似乎克隆了一个空版本库。[root@deployment test]# ll总用量 0drwxr-xr-x. 3 root root 18 6月 25 12:18 hello-world[root@deployment test]# cd hello-world/[root@deployment hello-world]# ll总用量 0[root@deployment hello-world]# git status # 位于分支 master## 初始提交#无文件要提交(创建/拷贝文件并使用 "git add" 建立跟踪)[root@deployment hello-world]# 相关新建.gitlab-ci.yml文件以及提交就不多解释了git add .gitlab-ci.ymlgit commit -m "Add .gitlab-ci.yml"git push origin master
通过页面操作也是可以的
gitlab提供了各种语言的模版,请自行摸索
添加.gitlab-ci.yml之后查看Pipelines页面,将看到如下图的效果
2.第二部Configure a Runnerinstall gitlab runner
Shared Runners 和 specific Runners 的区别请参照官方文档
本文采用的是Shared Runners
安装Runners 链接地址
docker的安装
curl -sSL https://get.docker.com/ | sh
安装Runners
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash执行以上命令后,会出现如下提示Generating yum cache for runner_gitlab-ci-multi-runner...导入 GPG key 0xE15E78F4: 用户ID : "GitLab B.V. (package repository signing key) <packages@gitlab.com>" 指纹 : 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4 来自 : https://packages.gitlab.com/runner/gitlab-ci-multi-runner/gpgkeyThe repository is setup! You can now install packages.
sudo yum install gitlab-ci-multi-runner
gitlab-ci-multi-runner-9.3.0-1.x86_64.rpm | 29 MB 00:10:04 Running transaction checkRunning transaction testTransaction test succeededRunning transaction 正在安装 : gitlab-ci-multi-runner-9.3.0-1.x86_64 1/1 GitLab Runner: creating gitlab-runner... 验证中 : gitlab-ci-multi-runner-9.3.0-1.x86_64 1/1 已安装: gitlab-ci-multi-runner.x86_64 0:9.3.0-1 完毕!
配置Runners链接
注册Runner
[root@deployment hello-world]# gitlab-gitlab-ci-multi-runner gitlab-ctl gitlab-psql gitlab-rails gitlab-rake gitlab-runner[root@deployment hello-world]# gitlab-runner registerRunning in system-mode. Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):http://192.168.1.105/Please enter the gitlab-ci token for this runner:7vs6PBYvsyDfa4vfxzXHPlease enter the gitlab-ci description for this runner:[deployment]: gitlab-runner testPlease enter the gitlab-ci tags for this runner (comma separated):test-tagWhether to run untagged builds [true/false]:[false]: trueWhether to lock Runner to current project [true/false]:[false]: falseRegistering runner... succeeded runner=7vs6PBYvPlease enter the executor: parallels, shell, ssh, docker-ssh+machine, kubernetes, docker-ssh, virtualbox, docker+machine, docker:dockerPlease enter the default Docker image (e.g. ruby:2.1):ubuntu:latestRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
注册成功之后 就会自动执行.gitlab-ci.yml 文件定义的job了
root@deployment hello-world]# docker images REPOSITORY TAG IMAGE ID CREATED SIZEgitlab/gitlab-runner-helper x86_64-3df822b 406664baeda2 8 minutes ago 50.48 MBdocker.io/docker dind 7243eea1f98a 5 days ago 99.6 MBdocker.io/docker latest 9f8e0f96efdf 5 days ago 93.99 MB
以上的报错 不会影响功能,只是解析不了域名,因为没有注册域名:)
本人觉得关键是要学会.gitlab-ci.yml文件定义的语法.gitlab-ci.yml语法
3.官方例子视频
end
阅读全文
0 0
- gitlab CI
- Gitlab CI集成Gitlab Runner
- GitLab-CI安装教程
- gitlab-ci.yml配置
- gitlab 添加https://gitlab.com/ci gitlab-ci-multi-runner
- gitlab之gitlab-ci自动部署
- gitlab-ci环境使用感受
- GITLAB CI-RUNNER的分类
- gitlab ci docker模式初探
- Gitlab CI Multi Runner搭建CI持续集成环境
- Gitlab CI Multi Runner搭建CI持续集成环境
- GitLab-CI持续集成(CI)的介绍与运行机制
- Jenkins+Gitlab搭建CI持续集成架构
- Jenkins+Gitlab搭建CI持续集成架构
- Blueprint+Dredd+Gitlab-CI 实现持续集成
- Docker搭建自己的Gitlab CI Runner
- Qt gitlab-ci的配置和运行
- CI 系统搭建Jenkins+GitLab+Gerrit
- 结构体struct前面加 typedef和不加typedef的区别
- hdu2650
- jquery实现拖动
- Android 常用设计模式之 -- 策略模式
- HDU5969(二进制计算)
- gitlab CI
- 逻辑回归中代价函数求导推导
- 软件编写规范(注释篇)
- jsp
- Lab_2
- nvm的window下配置和安装
- tcp粘包和nagle算法
- Caffe-SSD(single-shot-multibox)在Windows平台下的配置(CPU和GPU)与训练记录
- gmapping 算法解析