跳转到内容

GitLab

本页使用了标题或全文手工转换
维基百科,自由的百科全书

这是本页的一个历史版本,由S8321414留言 | 贡献2021年2月17日 (三) 03:13编辑。这可能和当前版本存在着巨大的差异。

GitLab
网站类型
Git 仓库托管服务
协作式版本控制
语言英语
業務範圍全球范围
持有者GitLab Inc.
创立者
  • Sid Sijbrandij
  • Dmitriy Zaporozhets
  • Valery Sizov
代表人物
  • Sid Sijbrandij (CEO)
  • Dmitriy Zaporozhets (CTO)
产业软件行业
员工412[1](截至2018年11月30日 (2018-11-30)
网址gitlab.com
商业性质
注册可选
推出时间2011年,​13年前​(2011
现状在线
內容許可
MIT許可證 (Community Edition)[2]/商业许可 (Enterprise Edition)
編程語言RubyGo
GitLab (Community Edition)
当前版本
  • 17.0 (2024年5月16日;穩定版本)[4]
編輯維基數據鏈接
源代码库gitlab.com/gitlab-org/gitlab-foss
编程语言Ruby
操作系统跨平台
许可协议 編輯維基數據鏈接
网站about.gitlab.com/ 编辑维基数据

GitLab 是由 GitLab Inc.开发,一款基于 Git 的完全集成的软件开发平台(fully 集成軟體 development platform)。[6][7] 另外,GitLab 且具有wiki以及在线编辑、issue跟踪功能、CI/CD 等功能。

CI/CD

GitLab CI/CD 是 GitLab 内置的一款工具,用于 通过 持续方法论页面存档备份,存于互联网档案馆)(continuous methodologies)的软件开发。 该持续方法论包含三个部分:持续集成持续交付持续部署[8][9]

  • 持续集成(Continuous Integration,简称CI),每次在上传代码块到基于Git仓库时,持续集成 会运行脚本去构建、测试、校验代码,这些操作是在合并到默认分支之前进行的。
  • 持续交付(Continuous Delivery,简称CD),在 持续集成 之后(即合并到默认分支之后),持续交付 将进行手动部署应用。
  • 持续部署(Continuous Deployment,简称CD),在 持续集成 之后(即合并到默认分支之后),持续部署 将进行自动部署应用。

原理

当开发者配置了 GitLab CI/CD,那么当开发者使用 git 提交(commit),那么就会触发 CI/CD 相关的一系列操作。 这一系列操作由 GitLab Runner 执行,相关配置记载于.gitlab-ci.yml文件中,执行的结果将在Gitlab页面中展示。[10] 每一次的提交(commit)将会出发一条流水线(pipeline),流水线是不同阶段(Stage)任务(Job)的一个集合。[10] 阶段(Stage)用于逻辑切割,同一阶段的任务以并行方式执行,阶段间是顺序执行,上一个阶段执行失败,下一个阶段将不会执行。[11] .pre 为第一阶段(译为:之前) 和 .post 最后阶段(译为:提交时),这两个阶段不需要被定义,也无法被修改。[12]

示例如下:

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 ,提供用户下载。[10] 利用场景如下:在Android项目中,当配置了自动化构建Artifacts后,每次提交(push)代码后,GitLab CI/CD 将自动构建 APK文件,并在GitLab的页面上提供下载按钮。 任务(Job)可以自动部署文件到外部服务器,并通过 GitLab 页面查看该服务器现今部署的状态,以及进行重新部署(re-deploy)等操作。通过使用设定 environmentnameurl ,还可以在GitLab页面直接上查看网站。[13][14] 通过该操作可以达到 持续部署 的目的。[14]

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。[15]

Runner 可安装在操作系统,也可以通过Docker的方式安装。当 Runner 安装后,需要将其注册在 GitLab 中,方可使用。Runner 有若干种执executor可供使用,如:DockerShellSSH[15] Runner 默认使用Shell,Shell模式下,所有构建都会发生在Runner安装的机器中,操作十分简单,但是缺点很多。[16][17]

.gitlab-ci.ym 文件中通过 tags 关键词选择Runner。[18]Runner 的相关配置在 config.toml 文件中记载。[19]

与Docker结合

对 基于Docker的项目 进行构建和测试,有几种方式。一种方式是,使用shell executor进行Docker CLI命令操作。 另一种方式就是使用Docker executor进行操作,它是官方推荐的操作,executor通过在Docker中使用 Docker-in-Docker页面存档备份,存于互联网档案馆镜像 进行Job相关操作。[20]

历史

GitLab 由乌克兰程序员 Dmitriy Zaporozhets 和 Valery Sizov 开发,它由 Ruby 写成。后来,一部分用 Go 语言重写。截止 2018 年 5 月,该公司约有 290 名团队成员[21],以及 2000 多名开源贡献者。[22] GitLab 被 IBM,Sony,Jülich Research Center,NASA,Alibaba,Invincea,O’Reilly Media,Leibniz-Rechenzentrum (LRZ),CERN[23][24][25],SpaceX 等组织使用。[26]

最初,该产品命名为 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 系列资金。

事件

Gitlab 于 2017 年 1 月 31 日發佈一系列緊急通告稱,位於荷蘭的系統管理員因操作失誤而刪除了包含 310GB 產品資料的資料夾,在取消刪除操作後僅剩下 4.5GB。运维人员之后检查发现,网站宣称和配备的多项备份措施均未正常运作或难以利用。Gitlab 在 YouTube 直播了恢復資料的過程[27]。网站最终丢失了最后 6 小时的数据库数据(包括问题、合并请求、评论、片段等,不含代码库)[28]

参考文献

  1. ^ GitLab Team. [2018-01-31]. (原始内容存档于2018-11-25). 
  2. ^ GitLab Community Edition LICENSE file. [2018-01-31]. (原始内容存档于2019-07-02). 
  3. ^ GitLab.com Alexa Ranking. Alexa Internet. [2018-06-05]. (原始内容存档于2021-02-02). 
  4. ^ GitLab 17.0 released with generally available CI/CD Catalog and AI Impact analytics dashboard. [2024年5月17日] (英語). 
  5. ^ GitLab Security Release: 13.8.4, 13.7.7 and 13.6.7. [2021-02-11]. 
  6. ^ User Docs | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-30). 
  7. ^ Git | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-04-02). 
  8. ^ GitLab CI/CD | GitLab. docs.gitlab.com. [2020-03-25]. (原始内容存档于2020-12-10). 
  9. ^ Introduction to CI/CD with GitLab | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-28). 
  10. ^ 10.0 10.1 10.2 A beginner's guide to continuous integration. GitLab. [2020-03-27]. (原始内容存档于2021-01-10) (英语). 
  11. ^ stages. docs.gitlab.com. [2020-03-27]. (原始内容存档于2021-01-29). 
  12. ^ pre-and-post. docs.gitlab.com. [2020-03-27]. (原始内容存档于2021-01-29). 
  13. ^ A beginner's guide to continuous integration. GitLab. [2020-03-27]. (原始内容存档于2021-01-10) (英语). 
  14. ^ 14.0 14.1 Environments and deployments | GitLab. docs.gitlab.com. [2020-03-27]. (原始内容存档于2020-11-24). 
  15. ^ 15.0 15.1 GitLab Runner Docs | GitLab. docs.gitlab.com. [2020-03-22]. (原始内容存档于2021-02-02). 
  16. ^ Executors | GitLab. docs.gitlab.com. [2020-03-24]. (原始内容存档于2021-01-10). 
  17. ^ Shell | GitLab. docs.gitlab.com. [2020-03-24]. (原始内容存档于2021-01-10). 
  18. ^ GitLab CI/CD Pipeline Configuration Reference | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-01-31). 
  19. ^ Advanced configuration | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-02-02). 
  20. ^ Building Docker images with GitLab CI/CD | GitLab. docs.gitlab.com. [2020-03-26]. (原始内容存档于2021-02-02). 
  21. ^ GitLab Team Page. GitLab. [9 May 2018]. (原始内容存档于2018-11-25). 
  22. ^ GitLab Contributors. GitLab.com. [9 May 2018]. (原始内容存档于2017-08-19). 
  23. ^ 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). 
  24. ^ CERN. Services - CERN or commercial provider?. cern.ch. [2018-01-31]. (原始内容存档于2019-02-26). 
  25. ^ Services - GitLab. [2018-01-31]. (原始内容存档于2019-04-20). 
  26. ^ 存档副本. [2018-01-31]. (原始内容存档于2020-11-30). 
  27. ^ Working on restoring GitLab.com. FAQ below.. [2017-02-02]. (原始内容存档于2020-10-31). 
  28. ^ GitLab.com Database Incident. GitLab. 2017-02-01 [2017-02-10]. (原始内容存档于2019-09-09). 

外部連結