本文介绍了Gitlab CI CD,来源于Gitlab的官方文档 (阅读全文中有链接)翻译
文中涉及到几个概念Gitlab CI,Gitlab CD,GitLab Runner,Pipelines。
Gitlab CI
What is CI? Continuous Integration is the practice of integrating code into a shared repository and building/testing each change automatically, as early as possible - usually several times a day.
CI翻译为持续集成,是基于团队共享代码库,开发人员合并提交代码后,触发事先编写好的pinpine构建任务,对代码进行构建,测试的过程。
CI是基于共享代码库的代码集成实践,基于每一次的更改进行构建和测试,通常一天进行很多次。
What is CD?
Continuous Delivery adds that the software can be released to production at any time, often by automatically pushing changes to a staging system.
CD用于对稳定系统的推送,在任何时候,自动的可以发布到生产环境。 Continuous Deployment goes further and pushes changes to production automatically.
Why your team needs a CI/CD workflow
Continuous Integration Detects errors as quickly as possible: fix problems while fresh in developers mind
更快更可能的检测到错误
Reduces integration problems: smaller problems are easier to digest 降低集成问题,小的问题容易被消化
Avoid compounding problems: allows teams to develop faster, with more confidence 忽略混合问题,允许团队更快,更信任的开发
Continuous Delivery
Ensures every change is releasable: test everything, including deployment, before calling it done 确保每次更改都是可发布的 Lowers risk of each release: makes releases “boring” 对于每一次发布是低风险的 Delivers value more frequently: reliable deployments mean more releases 更多的部署代表更多的版本 Tight customer feedback loops: fast and frequent customer feedback on changes 在变化中快速频繁的接受客户的反馈
GitLab CI/CD有哪些优势
What are the advantages of GitLab CI/CD?
- Integrated: GitLab CI/CD is part of GitLab, enabling a single conversation from planning to deployment (and beyond) GitLab CI/CD 是GitLab 的一部分
- Open source: CI/CD is a part of both the open source GitLab Community Edition and the proprietary GitLab Enterprise Edition 社区版本和企业版本均是开源的
- Easy to learn: See our Quick Start guide
- Seamless: Part of the single GitLab application, with a single great user experience
- Scalable: Tests run distributed on separate machines of which you can add as many as you want
- Faster results: Each build can be split in multiple jobs that run in parallel on multiple machines
- Optimized for delivery: multiple stages, manual deploy gates, [environments,] (https://docs.gitlab.com/ee/ci/environments.html) and variables
GitLab is one application for the entire DevOps lifecycle
GitLab是整个DevOps生命周期的一部分
- Build your application using GitLab Runners 使用GitLab Runners进行构建
- Run unit and integration tests to check if your code is valid 运行单元和集成测试检验代码准确性
- Look at a live preview of your development branch with [Review Apps] (https://about.gitlab.com/product/review-apps/)before merging into stable 可以进行在线预览
- Deploy to multiple environments like staging and production, and support advanced features such as canary deployments 基于不同环境的部署
- Monitor performances and status of your application 监控应用程序的运行状态
Architecture
GitLab CI/CD
GitLab CI/CD is a part of GitLab, a web application with an API that stores its state in a database. It manages projects/builds and provides a nice user interface, besides all the features of GitLab.
GitLab CI/CD是GitLab 工作流的一部分。
GitLab Runner
GitLab Runner is an application which processes builds. It can be deployed separately and works with GitLab CI/CD through an API.
In order to run tests, you need at least one GitLab instance and one GitLab Runner.
GitLab Runner
To perform the actual build, you need to install GitLab Runner which is written in Go.
It can run on any platform for which you can build Go binaries, including Linux, OSX, Windows, FreeBSD and Docker.
GitLab Runner has many features, including autoscaling, great Docker support, and the ability to run multiple jobs concurrently.
Pipeline
一次 Pipeline 其实相当于一次构建任务,里面可以包含多个流程,如安装依赖、运行测试、编译、部署测试服务器、部署生产服务器等流程。
在业界使用的GitLabCI/CD,瓦力部署系统,Jenkins都是持续集成在不同环境下的具体实现方式。核心流程是实现代码的测试,发布,上线一体化,优化开发流程,最大程度的使用自动化代替重复的人工干预。
市面上的Azure DevOps则是一款云平台DevOps解决方案。
CI/CD理论体系上属于敏捷(agile)开发范畴。
以下是知乎搜索的关于持续集成的资料
end 2019年10月