GitLab全方位
- 撰写日期:2018-10-23
- 更新日期:2018-10-23
- 文库地址:https://www.jianshu.com/p/2b95f72e92d4
建模
愿景
业务建模
业务用例图
交付软件
业务序列图
需求建模
系统用例图
领域建模
系统用例 持续集成/CI
CI
Job
Script
Command
控制类:PipeLine
内容收集
历史
GitLab is a web-based Git-repository manager providing wiki, issue-tracking and CI/CD pipeline[6] features, using an open-source license, developed by GitLab Inc. The software was created by Dmitriy Zaporozhets and Valery Sizov,[7][not in citation given] and is used by several large tech companies including IBM, Sony, Jülich Research Center, NASA, Alibaba, Invincea, O’Reilly Media, Leibniz-Rechenzentrum (LRZ), CERN,[8][9][10] European XFEL, GNOME Foundation, Boeing, Autodata, and SpaceX.[11]
The code was originally written in Ruby, with some parts later rewritten in Go, initially as a source code management solution to collaborate with his team on software development. It later evolved to an integrated solution covering the software development life cycle, and then to the whole DevOps lifecycle. The current technology stack includes Ruby on Rails and Vue.js
It follows an open-core development model where the core functionality is released under an open source (MIT) license while the additional functionality is under a proprietary license.
收购
- Gitorious: GitLab acquired open source hosting and on-premise enterprise Git management service provider Gitorious in March 2015.
- Gitter: In March 2017, GitLab acquired Gitter, an instant messaging platform for developers and declared to open source Gitter codebase.
- Gemnasium: In January 2018, GitLab acquired Gemnasium, a company providing software and services to mitigate security vulnerabilities.
Comparison of source code hosting facilities
愿景
“GitLab supports development teams with a well-documented installation and configuration processes, an easy-to-follow UI, and a flexible per-seat pricing model that supports self service. GitLab’s vision is to serve enterprise-scale, integrated software development teams that want to spend more time writing code and less time maintaining their tool chain.” - CI Wave Report, FORRESTER
GitLab is a "Strong Performer" in The Forrester New Wave: Value Stream Management Tools, Q3 2018. According to the report, “GitLab combines end-to-end capability with the power of open source. GitLab offers a DevOps tool for each step of the software development process. Top-level views sitting across these tools provide its VSM functionalities." - VSM Report, FORRESTER
2018年底,愿景
GitLab认为DevOps开发工具的范围应当在一个应用中包括开发者、运维人员和安全团队。这样能显著减少挫折感,增加合作,启动一个有竞争力的优势。带着上下文转换Doing Aways并且在一个地方就有必要的信息,能够闭环,并且使得团队之间相互更好的理解成为可能。
GitLab reimagines the scope of DevOps tooling to include developers, operations, and security teams in one single application. This dramatically reduces friction, increases collaboration, and drives a competitive advantage. Doing away with context switching and having all of the necessary information in one place closes the loop and enables a better understanding of each team's needs.
目标:200%更快的DevOps生命周期
从项目计划和源代码管理到CI/CD和监控,GitLab是整个DevOps生命周期的单一应用。只有GitLab允许并行的DevOpes,使得软件生命周期200%更快。
用例
https://about.gitlab.com/direction/#vision
管理/Manage
- 周期分析/Cycle Analytics
- DevOps评分/DevOps Score
- 审计管理/Audit Management
- 认证和授权/Authentication and Authorization
计划/Plan
创建/Create
验证/Verify
打包/Package
发布/Release
配置/Configure
监控/Monitor
安全/Secure
- 静态应用安全测试/SAST
- 动态应用安全测试/DAST
- 依赖扫描/Dependency Scanning
- 容器扫描/Container Scanning
- 许可证管理/License Management
特性
可视/Visible
看到任何重要的事情/See everything that matters
- 保持在流程中/Stay in your flow
- 不因同步而等待/Don’t wait on syncing
- 管理项目,而不是工具/Manage projects, not tools
- 改进周期时间?/Improve cycle time.
高效/Efficient
无需等待地合作/Collaborate without waiting
- 立即开始/Start immediately
- 并行工作/Work concurrently
- 没有多余的传递/No more handoffs
治理/Governed
自信地开发和运维/Develop and operate with confidence
- 内置的安全和合规/Security and compliance already built-in
- 简化用户管理/Simplify user management
- 顺畅的审计/Expedite auditing
- 有把握地行动/Act with certaint
业务建模
业务用例:交付软件,运维系统
定义
Continuous integration (CI) systems provide automation of the software build and validation process driven in a continuous way by running a configured sequence of operations every time a software change is checked into the source code management repository. These are closely associated with agile development practices and closely related to the emerging DevOps toolsets.
来自 https://blogs.gartner.com/it-glossary/continuous-integration-ci/
DevOps
DevOps represents a change in IT culture, focusing on rapid IT service delivery through the adoption of agile, lean practices in the context of a system-oriented approach. DevOps emphasizes people (and culture), and seeks to improve collaboration between operations and development teams. DevOps implementations utilize technology — especially automation tools that can leverage an increasingly programmable and dynamic infrastructure from a life cycle perspective.
来自:https://blogs.gartner.com/it-glossary/?s=devops
业务序列图
软件生命周期的各个阶段:
管理
Gain visibility and insight into how your business is performing.
GitLab helps teams manage and optimize their software delivery lifecycle with metrics and value stream insight in order to streamline and increase their delivery velocity. Learn more about how GitLab helps to manage your end to end value stream.
Reporting & Analytics
计划/Plan
The Plan stage is about capturing ideas, organizing issues and epics, scheduling work, and communicating plans.
GitLab enables portfolio planning and management through epics, groups (programs) and milestones to organize and track progress. Regardless of your methodology from Waterfall to DevOps, GitLab’s simple and flexible approach to planning meets the needs of small teams to large enterprises. GitLab helps teams organize, plan, align and track project work to ensure teams are working on the right things at the right time and maintain end to end visibility and traceability of issues throughout the delivery lifecycle from idea to production.
- Chat integration
- Project and portfolio management
创建/Create
GitLab is used to create, collaborate, review and manage content; often source code, by many businesses. We want to make it possible for everyone to be able to contribute content and feedback using GitLab.
- Source code management
- Merge requests
- Web IDE
- Geo
验证/Verify
The Verify stage is all about making sure that your code does what you expected it to do, meets quality standards, and is secure; all via automated testing. We bring best practices from top development teams, and make them the easy, default way to work. But of course you can build on those defaults and customize as needed for your company.
- Continuous Integration (CI)
GitLab CI provides an explicit build stage and the concept of build artifacts, but we might need to separate out the build artifacts from test artifacts. For example, you might want your test runner to create a JUnit-style output file which is available for external consumption, but not included in the build image sent to production. Creation of an explicit build aligns well with Docker where the result of the build stage is a Docker image which is stored in a registry and later pulled for testing and deployment.
打包/Package
- Container Registry
- Binary repository for Maven MVC Premium
发布/Release
- Continuous Delivery (CD) / Release Automation
A key part of CD is being able to deploy. We currently have the ability via scripts in the deploy stage in .gitlab-ci.yml. We will go further.
配置/Configure
- Application Control Panel
- Infrastructure Configuration
- Operations
- Feature Management
There's a big benefit to decoupling deployment of code from delivery of a feature, mostly using feature flags. Continuous integration helps improve the speed of development, but feature flags take it to another level, giving you the confidence to integrate code even more often while providing a gradual and granular method for delivery.
监控/Monitor
Performance is a critical aspect of the user experience, and ensuring your application is responsive and available is everyone's responsibility. We want to help address this need for development teams, by integrating key performance analytics and feedback into the tool developers already use every day.
- Application Performance Monitoring (APM)
- Infrastructure Monitoring
- Production Monitoring
- Error Tracking
- Logging
安全/Secure
- Security Testing
- License Management
非生命周期
性能/Performance
分发/Distribution
GitLab is the engine that powers many companies' software businesses so it is important to ensure it is as easy as possible to deploy, maintain, and stay up to date.
- Omnibus
- Cloud Native Installation
CI
范例:How to deploy Maven projects to Artifactory with GitLab CI/CD
参考
CI: GitLab Runner
使用Docker镜像
什么是镜像?
镜像关键字是Docker执行器将要运行的Docker镜像名字,以执行CI任务。
The image keyword is the name of the Docker image the Docker executor will run to perform the CI tasks.
什么是服务?
服务关键字定义了另一个Docker镜像,它将在任务期间运行,并连接到image关键字所指定的Docker镜像。这样,你就可以在构建期访问服务镜像。
The services keyword defines just another Docker image that is run during your job and is linked to the Docker image that the image keyword defines. This allows you to access the service image during build time.
Runner是如何启动CI任务中所要使用的Docker镜像:
- Runner使用定义好的entrypoint启动一个Docker镜像。(默认来自于Dockerfile,可能会在.gitlab-ci.yml中被重写)
- Runner将自身附加到运行的容器;
- Runner准备好脚本(before_script, script, after_script的组合);
- Runner将脚本发送到容器shell的STDIN然后接受输出。
在构建期Docker所执行的步骤:
- 创建any服务容器:mysql, postgresql, monodb, redis;
- 创建缓存容器以存储所有在config.toml定义的卷,以及构建镜像的Dockerfile(上面的例子为ruby:2.1);
- 创建构建镜像,然后将any服务镜像连接到构建镜像;
- 启动构建镜像,并将任务脚本发送至该容器;
- 运行任务脚本;
- 迁出/builds/group-name/project-name/的代码;
- 执行
.gitlab-ci.yml
所定义的any每一步; - 检查构建脚本的退出状态;
- 删除构建镜像和所有创建的服务镜像;
来源:https://git.iec.io/help/ci/docker/using_docker_images.md
参考:
定义来自私人仓库的镜像
自动化DevOps
与PaaS比较
Auto DevOps受到Heroku的创新工作的启发,并有所超越:
- Auto DevOps使用any Kubernetes集群;
- 没有额外的成本,你可以使用自己搭建的Kubernetes集群或者公有云上的Container as a Service;
- Auto DevOps还包括安全测试、性能测试和代码质量测试;
- 提供增量incremental graduation path。
特性
最佳实践,阶段
- Auto Build
- Auto Test
- Auto Code Quality [STARTER]
- Auto SAST (Static Application Security Testing) [ULTIMATE]
- Auto Dependency Scanning [ULTIMATE]
- Auto License Management [ULTIMATE]
- Auto Container Scanning
- Auto Review Apps
- Auto DAST (Dynamic Application Security Testing) [ULTIMATE]
- Auto Deploy
- Auto Browser Performance Testing [PREMIUM]
- Auto Monitoring
所依赖的组件:
- Kubernetes
- Helm
- Docker
- GitLab Runner
- Prometheus
来源:https://git.iec.io/help/topics/autodevops/index.md
参考
- Auto DevOps
- Multiple Kubernetes clusters [PREMIUM]
- Incremental rollout to production [PREMIUM]
- Disable jobs you don't need with environment variables
- Use a static IP for your cluster
- Use your own buildpacks to build your application
- Prometheus monitoring
延伸阅读
-
From 2/3 of the self-hosted Git market, to the next-generation CI system, to Auto DevOps
SCM -> CI -> Auto DevOps