Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

Gitlab的CI/CD[0]

Posted on 2023年11月14日2023年11月15日 by

CI/CD的出现改变了原有的软件的开放模式,使得现代软件的交付和变更更加迅速,相对于传统的软件的开发测试等流程,采用CI/CD的方式,使得一次配置软件的编译环境,即可实现自动化的编译和测试发布,将由人为因素导致的错误降到最低。

此部分的介绍和DevOps内容部分重合。

  • 概念

企业使用Gitlab作为工作仓库进行代码发布及版本控制,Gitlab内置了CI/CD的工具,这些工具可以用于代码提交的同时完成镜像构建、自动化测试、自动化部署等连续的工作

基本概念:
CI: Continuous Integration(持续集成)
CD: Continuous Delivery(连续交付)
CD: Continuous Deployment(持续部署)
  • Gitlab-CI/CD工作流

  1. 你当前的代码库托管在Gitlab上, 且已经为代码仓库配置了gitlab-runner服务, 它是用来实际执行CI任务的服务器;
  2. 提交代码,且根目录中包含一个名为.gitlab-ci.yml文件,该文件是用来指定构建、测试和部署流程、以及CI触发条件的脚本,其概念类似于docker-compose.yml文件;
  3. Gitlab检测到.gitlab-ci.yml文件,若当前提交符合文件中指定的触发条件,则会使用配置的gitlab-runner服务运行该脚本进行测试等工作;
  4. 若.gitlab-ci.yml中定义的某个自动化脚本运行失败,将判定为此次CI不通过,则需要提交者修复问题代码后重复提交,直至自动化CI通过。
  5. 没有问题的提交才能被项目负责人merge到主分支,进行后续的部署工作(此文暂不涉及CD自动化部署)
  • Pipeline说明

一个.gitlab-ci.yml文件触发后会形成一个pipeline任务流由gitlab-runner来运行处理,pipeline中stage、job概念如下,需要按照项目实际情况定义不同stage和job:

参考资料:
  1. https://juejin.cn/post/6921581836426706957
  2. https://juejin.cn/post/6963927908444274718
  3. https://segmentfault.com/a/1190000037748013
  4. https://github.com/yangpeng14/DevOps/blob/master/ops/gitlab-ci-%E6%90%AD%E5%BB%BA%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90%E7%8E%AF%E5%A2%83.md

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT