gitlab-ci.yml配置
来源:互联网 发布:淘宝申请客服介入处理 编辑:程序博客网 时间:2024/06/07 03:16
1gittlab,配置本地Git,省略。。。。。。
2 添加项目到CI(Continues Integration)中
3 单击项目,进入CI页面中
第一次没有配置的情况下:
4 添加".gitlab-ci.yml"文件
".gitlab-ci.yml"文件放在仓库的根目录下,用来设置gitlab项目的runner,每次在push的时候自动触发项目的build。
首先在项目的根目录下(git clone ...)创建'.gitlab-ci.yml'文件,针对新建的示例项目创建简单的内容:
stages: - build - test - deployb1: stage: build script: - uname -a - g++ hello.cpp - bash scripts tags: - shellt1: stage: test script: - ./a.out tags: - shell
文件包含多个stage,如build、test、deploy,每个相同的stage运行都是并行的,而后面的stage必须在前面的stage运行结束才能开始。script表示运行命令,示例中以shell命令为例。tags表示runner的标签,用哪个runner来build项目,关于runner的配置在下一章中。
另外,在build完项目后,可以添加一个脚本用来进行测试程序,如'-bash scripts'。
添加文件"hello.cpp"和".gitlab-ci.yml",然后push到gitlab。
$git add hello.cpp .gitlab-ci.yml$git commit -a $git push origin master
成功之后,commit的状态为"pending",意思是正在等待中,因为还没有runner来执行。
关于文件格式内容的详细说明.gitlab-ci.yml
5 配置Runner
单击网页左侧Runners。
有"Specific runners"和"Shared runners"两种,我们只介绍"Specific runners"的配置,关于runner的详细说明。在Spcific runners中有红色的URL和token,这两个数据在配置runner时会用到。
1.安装runner
$sudo apt-get update$sudo apt-get install gitlab-ci-multi-runner
详细安装及Docker的安装
2.配置runner
注册runner,操作时会要求输入上文提到的URL和token,这里我们runner的执行程序用的是shell,所以在excutor选择shell。命令如下:
$sudo gitlab-ci-multi-runner registerPlease enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci )http://gitlab.###.io/ciPlease enter the gitlab-ci token for this runner########################Please enter the gitlab-ci description for this runnermy-runnerINFO[0034] fcf5c619 Registering runner... succeededPlease enter the executor: shell, docker, docker-ssh, ssh?shellINFO[0037] Runner registered successfully. Feel free to start it, but if it'srunning already the config should be automatically reloaded!
配置成功后,我们的项目状态如下,变为running:
之后运行顺利的话,会出现绿色标志:
单击Commit的ID可以查看运行详细信息,错误的信息还是成功后的信息。
作者:zackKui
链接:http://www.jianshu.com/p/2211f16cc099
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
- gitlab-ci.yml配置
- 通过 .gitlab-ci.yml配置任务-官方配置文件翻译
- 持续集成-通过 .gitlab-ci.yml配置任务
- Gitlab部署CI并使用.gitlab-ci.yml配置您的作业(中文翻译)
- Qt gitlab-ci的配置和运行
- gitlab CI
- yml配置
- CentOS安装gitlab,gerrit,jenkins并配置ci流程
- 笔记:gitlab-ci 可持续集成(3) runner 基本配置
- CI(持续集成)之Jenkins+Gitlab的基本配置
- Gitlab CI集成Gitlab Runner
- GitLab-CI安装教程
- gitlab 添加https://gitlab.com/ci gitlab-ci-multi-runner
- gitlab之gitlab-ci自动部署
- gitlab-ci环境使用感受
- GITLAB CI-RUNNER的分类
- gitlab ci docker模式初探
- SpringBoot yml 配置
- JAVA跨域问题
- Redis的数据类型及相关操作命令
- 专访微软研究院张正友:从“张氏标定法”到人机交互,20年视觉技术的探索
- 初识Hibernate之关联映射(二)
- JAVA学习笔记——Set集合
- gitlab-ci.yml配置
- 数据结构学习笔记7--c语言建立一个链表(已测正确无误)
- java总结(持续更新)
- Loadrunner 运行示例遇到的问题及解决方法
- 机器学习技法课程学习笔记14-- Radial Basis Function Network
- 初识Hibernate之关联映射(一)
- ubuntu caffe 下安装nvidia digits排错
- web系统ie浏览器不刷新数据
- 字符串算法——单一数(Single Number II)