GitLab

![]() | |
![]() | |
网站类型 | Git 仓库托管服务 DevOps平台[1] |
---|---|
语言 | 英语 |
股票代號 | NASDAQ:GTLB[2] |
業務範圍 | 全球范围 |
持有者 | GitLab Inc. |
创立者 |
|
代表人物 | |
产业 | 软件行业 |
营业额 | ▲ 1.522億美元 (2021年)[3] |
员工 | 1,765[4](截至2022年4月[update]) |
网址 | gitlab |
商业性质 | 是 |
注册 | 可选 |
推出时间 | 2011年 |
现状 | 在线 |
編程語言 | Ruby、Go和Vue.js |
当前版本 | 15.1.1(2022年6月30日[6]) |
---|---|
源代码库 | gitlab |
编程语言 | Ruby、Go和JavaScript |
操作系统 | 跨平台 |
平台 | x86-64和ARMhf |
许可协议 | MIT許可證 (社群版)[7]/商业许可 (商業版) |
网站 | 商業版 (包括專有元件): about.gitlab.com 社群版 (不含專有元件): gitlab.com/gitlab-org/gitlab |
GitLab 是由 GitLab Inc.开发,一款基于 Git 的完全集成的软件开发平台(fully 集成軟體 development platform)。[8][9] 另外,GitLab 且具有wiki以及在线编辑、issue跟踪功能、CI/CD 等功能。
CI/CD
GitLab CI/CD 是 GitLab 内置的一款工具,用于 通过 持续方法论 (页面存档备份,存于互联网档案馆)(continuous methodologies)的软件开发。 该持续方法论包含三个部分:持续集成、持续交付、持续部署。[10][11]
- 持续集成(Continuous Integration,简称CI),每次在上传代码块到基于Git仓库时,持续集成 会运行脚本去构建、测试、校验代码,这些操作是在合并到默认分支之前进行的。
- 持续交付(Continuous Delivery,简称CD),在 持续集成 之后(即合并到默认分支之后),持续交付 将进行手动部署应用。
- 持续部署(Continuous Deployment,简称CD),在 持续集成 之后(即合并到默认分支之后),持续部署 将进行自动部署应用。
原理
当开发者配置了 GitLab CI/CD,那么当开发者使用 git 提交(commit),那么就会触发 CI/CD 相关的一系列操作。 这一系列操作由 GitLab Runner 执行,相关配置记载于.gitlab-ci.yml
文件中,执行的结果将在Gitlab页面中展示。[12] 每一次的提交(commit)将会出发一条流水线(pipeline),流水线是不同阶段(Stage)的任务(Job)的一个集合。[12] 阶段(Stage)用于逻辑切割,同一阶段的任务以并行方式执行,阶段间是顺序执行,上一个阶段执行失败,下一个阶段将不会执行。[13] .pre
为第一阶段(译为:之前) 和 .post
最后阶段(译为:提交时),这两个阶段不需要被定义,也无法被修改。[14]
示例如下:
stages:
- build
- test
- deploy
job 0:
stage: .pre
script: make something useful before build stage
job 1:
stage: build
script: make build dependencies
job 2:
stage: build
script: make build artifacts
job 3:
stage: test
script: make test
job 4:
stage: deploy
script: make deploy
job 5:
stage: .post
script: make something useful at the end of pipeline
任务(Job)可以构建Artifacts ,提供用户下载。[12] 利用场景如下:在Android项目中,当配置了自动化构建Artifacts后,每次提交(push)代码后,GitLab CI/CD 将自动构建 APK文件,并在GitLab的页面上提供下载按钮。
任务(Job)可以自动部署文件到外部服务器,并通过 GitLab 页面查看该服务器现今部署的状态,以及进行重新部署(re-deploy)等操作。通过使用设定 environment
的 name
和 url
,还可以在GitLab页面直接上查看网站。[15][16] 通过该操作可以达到 持续部署 的目的。[16]
deploy_staging:
stage: deploy
script:
- echo "Deploy to staging server"
environment:
name: staging
url: http://172.23.0.2:5000/
only:
- master
tags:
- Runner名称
GitLab Runner
GitLab Runner 是一项开源项目,用于执行任务(Job),并将执行结果传输回Gitlab。[17]
Runner 可安装在操作系统,也可以通过Docker的方式安装。当 Runner 安装后,需要将其注册在 GitLab 中,方可使用。Runner 有若干种执executor可供使用,如:Docker、Shell、SSH。[17] Runner 默认使用Shell,Shell模式下,所有构建都会发生在Runner安装的机器中,操作十分简单,但是缺点很多。[18][19]
.gitlab-ci.ym
文件中通过 tags
关键词选择Runner。[20]Runner 的相关配置在 config.toml
文件中记载。[21]
与Docker结合
对 基于Docker的项目 进行构建和测试,有几种方式。一种方式是,使用shell executor进行Docker CLI命令操作。 另一种方式就是使用Docker executor进行操作,它是官方推荐的操作,executor通过在Docker中使用 Docker-in-Docker (页面存档备份,存于互联网档案馆)镜像 进行Job相关操作。[22]
历史
GitLab 由乌克兰程序员 Dmitriy Zaporozhets 和 Valery Sizov 开发,它由 Ruby 写成。后来,一部分用 Go 语言重写。截止 2018 年 5 月,该公司约有 290 名团队成员[23],以及 2000 多名开源贡献者。[24] GitLab 被 IBM,Sony,Jülich Research Center,NASA,Alibaba,Invincea,O’Reilly Media,Leibniz-Rechenzentrum (LRZ),CERN[25][26][27],SpaceX 等组织使用。[28]
最初,该产品命名为 GitLab,是完全免费的开源软件,按照 MIT 许可证分发。
2013 年 7 月,产品被拆分为:GitLab CE(社区版)和 GitLab EE(企业版),当时,GitLab CE 和 GitLab EE 的许可仍然是根据 MIT 许可分发的免费和开源软件。
2014 年 2 月,GitLab公司宣布采用开放核心业务模式。GitLab EE 设置在专有许可证下,并且包含 CE 版本中不存在的功能。
2015 年 7 月,GitLab公司又筹集了 150 万美元的种子基金。截至 2015 年的客户包括阿里巴巴集团,IBM 和 SpaceX。
2015 年 9 月,GitLab 从 Khosla Ventures 筹集了 400 万美元的 A 系列资金。
2016 年 7 月,GitLab CEO 确认了公司的开放核心功能。
2016 年 9 月,GitLab 从 August Capital 和其他公司筹集了 2000 万美元的 B 系列资金。
2017年10月9日,C轮融资,GitLab Inc.获得 GV 领投,Telstra Ventures、Matt Mullenweg(个人)和INKEF Capital跟投的2000万美元资金。
2018年9月19日,D轮融资,GitLab Inc.获得 GS Growth 和 ICONIQ Capital 领投,Khosla Ventures、GV和INKEF Capital跟投的1亿美元投资。
2019年9月12日,E轮融资,GitLab Inc.获得 Goldman Sachs 和 ICONIQ Capital 领投,Y Combinator、Coatue、Adage Capital Management等跟投的2.68亿美元投资[29]。
事件
Gitlab 于 2017 年 1 月 31 日發佈一系列緊急通告稱,位於荷蘭的系統管理員因操作失誤而刪除了包含 310GB 產品資料的資料夾,在取消刪除操作後僅剩下 4.5GB。运维人员之后检查发现,网站宣称和配备的多项备份措施均未正常运作或难以利用。Gitlab 在 YouTube 直播了恢復資料的過程[30]。网站最终丢失了最后 6 小时的数据库数据(包括问题、合并请求、评论、片段等,不含代码库)[31]。
参考文献
- ^ GitLab 14 Delivers Modern DevOps in One Platform. DevPro Journal. July 12, 2021 [2022-05-04]. (原始内容存档于2022-01-30).
- ^ Sijbrandij, Sid. GitLab goes public on Nasdaq a $10 billion IPO. CNBC. October 14, 2021 [2022-05-04]. (原始内容存档于2022-01-25).
- ^ Pendleton, Devon. CEO Who Built GitLab Fully Remote Worth $2.8 Billion on IPO. Bloomberg.com. October 14, 2021 [2022-05-04]. (原始内容存档于2022-02-08).
- ^ GitLab Team. [2022-05-04]. (原始内容存档于2018-11-25).
- ^ GitLab.com Alexa Ranking. Alexa Internet. [2018-06-05]. (原始内容存档于2021-02-02).
- ^ GitLab Critical Security Release: 15.1.1, 15.0.4, and 14.10.5. [2022-06-30].
- ^ GitLab Community Edition LICENSE file. [2018-01-31]. (原始内容存档于2019-07-02).
- ^ User Docs | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-30).
- ^ Git | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-04-02).
- ^ GitLab CI/CD | GitLab. docs.gitlab.com. [2020-03-25]. (原始内容存档于2020-12-10).
- ^ Introduction to CI/CD with GitLab | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-28).
- ^ 12.0 12.1 12.2 A beginner's guide to continuous integration. GitLab. [2020-03-27]. (原始内容存档于2021-01-10) (英语).
- ^ stages. docs.gitlab.com. [2020-03-27]. (原始内容存档于2021-01-29).
- ^ pre-and-post. docs.gitlab.com. [2020-03-27]. (原始内容存档于2021-01-29).
- ^ A beginner's guide to continuous integration. GitLab. [2020-03-27]. (原始内容存档于2021-01-10) (英语).
- ^ 16.0 16.1 Environments and deployments | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-24).
- ^ 17.0 17.1 GitLab Runner Docs | GitLab. docs.gitlab.com. [2020-03-22]. (原始内容存档于2021-02-02).
- ^ Executors | GitLab. docs.gitlab.com. [2020-03-24]. (原始内容存档于2021-01-10).
- ^ Shell | GitLab. docs.gitlab.com. [2020-03-24]. (原始内容存档于2021-01-10).
- ^ GitLab CI/CD Pipeline Configuration Reference | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-01-31).
- ^ Advanced configuration | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-02-02).
- ^ Building Docker images with GitLab CI/CD | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-02-02).
- ^ GitLab Team Page. GitLab. [9 May 2018]. (原始内容存档于2018-11-25).
- ^ GitLab Contributors. GitLab.com. [9 May 2018]. (原始内容存档于2017-08-19).
- ^ Andrii Degeler. GitLab is building a business with 0.1% of paying customers. The Next Web. 4 June 2014 [2018-01-31]. (原始内容存档于2019-07-02).
- ^ CERN. Services - CERN or commercial provider?. cern.ch. [2018-01-31]. (原始内容存档于2019-02-26).
- ^ Services - GitLab. [2018-01-31]. (原始内容存档于2019-04-20).
- ^ 存档副本. [2018-01-31]. (原始内容存档于2020-11-30).
- ^ 基于Git的完全集成的软件开发平台:极狐公司GitLab Inc.. 美股之家. 2021-04-18 [2021-04-18]. (原始内容存档于2021-04-24).
- ^ Working on restoring GitLab.com. FAQ below.. [2017-02-02]. (原始内容存档于2020-10-31).
- ^ GitLab.com Database Incident. GitLab. 2017-02-01 [2017-02-10]. (原始内容存档于2019-09-09).