(2019 iThome 鐵⼈人賽 30 天內容集錦)
Cheng Wei Chen @ STUDY4 TW .NET Conf 2019
和艦長⼀一起玩轉

GitLab & GitLab Workflow
Cheng Wei Chen 陳 正瑋

DevOps Taiwan Community & DevOpsDays Taipei Organizer
《Effective DevOps 中文版》譯者
《DevOps三十六計》繁中版審校者
http://chengweichen.com
https://devopsdays.twhttps://devopstw.club
封⾯面
封⾯面
GitLab
Agenda
• 認識 GitLab

• Workflow & GitLab Workflow

• GitLab Flow

• GitLab Auto DevOps

• 回顧與總結
認識 GitLab
發展
VCS
發展
VCS CI / CD
發展
VCS CI / CD
Project
management DevOps
GitLab CI
圖片來來源 https://about.gitlab.com/product/continuous-integration/
GitLab Auto DevOps
來來源 https://about.gitlab.com/
來來源 https://about.gitlab.com/direction/
名為 GitLab 的⼀一條龍 DevOps 平台
圖片來來源 https://about.gitlab.com/direction/
來來源 https://docs.gitlab.com/ee/development/architecture.html
GitLab
Component diagram
GitLab Component
• Component details

• Alertmanager

• Certificate management

• Consul

• Database migrations

• Elasticsearch

• Gitaly

• GitLab Geo

• GitLab Exporter

• GitLab Pages

• GitLab Runner

• GitLab Shell
• GitLab Workhorse

• Grafana

• Jaeger

• Logrotate

• Mattermost

• MinIO

• NGINX

• Node Exporter

• PgBouncer

• PgBouncer Exporter

• PostgreSQL

• Postgres Exporter
• Prometheus

• Redis

• Redis Exporter

• Registry

• Sentry

• Sidekiq

• Unicorn

• LDAP Authentication

• Outbound Email

• Inbound Email

• GitLab Managed Apps

來來源 https://docs.gitlab.com/ee/development/architecture.html
GitLab
Geo
圖片來來源 https://docs.gitlab.com/ee/administration/geo/replication/index.html
GitLab
Geo
圖片來來源 https://docs.gitlab.com/ee/administration/geo/replication/index.html
Omnibus
搞定安裝、設定

GitLab 的⼤大⼩小事。
gitlab.com Self-Managed或
GitLab
CE
GitLab
EE
GitLab
EE
Workflow & GitLab Workflow
Workflow / ⼯工作流程
Stage 1 Stage 2 Stage 3 Stage 3b Stage 4b Stage 5
Stage 3a
Stage 3c
Stage 4a
Why?
Workflow / ⼯工作流程
Stage 1 Stage 2 Stage 3 Stage 3b Stage 4b Stage 5
Stage 3a
Stage 3c
Stage 4a
Why?
標準化
⾃自動化 透明化
軟體開發⼯工作流程?
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
Plan Code Test Release Deploy
GitLab Workflow
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
GitLab Workflow: IDEA
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
每⼀一個天⾺馬⾏行行空的想法,都可能是產品創
意發想的起始點。
溝通 協作
互動 保存/回顧
Mattermost
GitLab Workflow: ISSUE
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
將 IDEA 轉換成實際的

ISSUE / FEATURE / STORY
討論 追蹤 Issue
Tracker
Issue Tracker
GitLab Workflow: PLAN
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
安排 ISSUE 的優先順序,

分派⼯工作任務。
分派/追蹤
優先順序 Issue
Board
Issue Board - To-Do
Issue Board - Workflow
Issue Board - By Member
GitLab Workflow: CODE
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
就是捲起袖⼦子開⼯工啦!
To-Do List
Milestones
Issue Tracker - Filtering issues by milestone 
圖片來來源 https://docs.gitlab.com/ee/user/project/web_ide/
Web IDE
GitLab Workflow: COMMIT
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
遵守團隊的開發⼯工作原則與分⽀支策略略,將
程式碼送入版本控制系統。
分支策略
工作準則 Git
Server
GitLab
Flow
GitLab Workflow: TEST
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
借助持續整合、⾃自動化測試,確保程式碼
的品質。
自動化
工作準則
GitLab CI
圖片來來源 https://about.gitlab.com/product/continuous-integration/
GitLab Workflow: REVIEW
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
Code Review & Merge branch
自動化
工作準則 Merge
Request
Issue
Tracker
GitLab Workflow: STAGING
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
⾃自動部署⾄至 Staging 環境做進⼀一步的測試與
驗證。
持續部署
持續交付
GitLab CI
GitLab
Auto
DevOps
自動化
GitLab Workflow: PRODUCTION
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
當⼀一切都驗證通過後,即可⾃自動部署⾄至
Production 環境,並事先預備 rollback 計畫。
持續部署
持續交付
GitLab CI
GitLab
Auto
DevOps
自動化
GitLab Workflow: FEEDBACK
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
回顧與反思,產品及⼯工作流程分別有哪些
地⽅方需要改善。
監控 數據收集
報表 持續改善 Cycle
Analytics
Auto
Monitoring
Cycle Analytics
CI/CD Charts
Burndown Chart
GitLab Flow
Git 分⽀支策略略?
圖片來來源 https://about.gitlab.com/blog/2014/09/29/gitlab-flow/
Git flow GitHub flow
GitLab flow
Trunk based
Git 分⽀支策略略?
圖片來來源 https://about.gitlab.com/blog/2014/09/29/gitlab-flow/
Git flow GitHub flow
GitLab flow
Trunk based
Why?
GitLab Flow
Git flow GitHub flow
GitLab flow
GitLab Flow
Git flow GitHub flow
GitLab flowupsteam first for delivery
圖片來來源 https://about.gitlab.com/blog/2014/09/29/gitlab-flow/
Production branch
Environment branch
搭配持續交付、持續部署,明
確控管已部署之環境的程式碼
版本。
圖片來來源 https://about.gitlab.com/blog/2014/09/29/gitlab-flow/
Release branch
依據 Stable 版本的發佈建立分
⽀支,維持 Master 的穩定前進
並保留留能夠維護各 Stable 版本
的彈性。
GitLab Flow
upsteam first for delivery
GitLab Auto DevOps
Kubernetes
GitLab CI
Auto
DevOps
Prometheus
+ =
Kubernetes
GitLab CI
Auto
DevOps
Prometheus
+ =
沒這麼 Auto 是有條件的
Auto DevOps
• Auto Build

• Auto Test

• Auto Code Quality

• Auto Static Application
Security Testing (SAST)

• Auto Dependency Scanning

• Auto License Compliance
• Auto Container Scanning

• Auto Review Apps

• Auto Dynamic Application
Security Testing (DAST)

• Auto Deploy

• Auto Browser Performance
Testing

• Auto Monitoring K8S
K8S
K8S
Prometheus
Auto DevOps
• Auto Build

• Auto Test

• Auto Code Quality

• Auto Static Application
Security Testing (SAST)

• Auto Dependency Scanning

• Auto License Compliance
• Auto Container Scanning

• Auto Review Apps

• Auto Dynamic Application
Security Testing (DAST)

• Auto Deploy

• Auto Browser Performance
Testing

• Auto Monitoring K8S
K8S
K8S
Prometheus
CI / CD
Pipeline
Templates
Cloud
Native
回顧與總結
回顧
• 認識 GitLab

• Workflow & GitLab Workflow

• GitLab Flow

• GitLab Auto DevOps
GitLab & DevOps
圖片來來源 https://about.gitlab.com/stages-devops-lifecycle/
來來源 https://about.gitlab.com/
軟體開發⼯工作流程?
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
Plan Code Test Release Deploy
軟體開發⼯工作流程?
圖片來來源 https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/
產品開發
Plan Code Test Release Deploy
?
Workflow / ⼯工作流程
Stage 1 Stage 2 Stage 3 Stage 3b Stage 4b Stage 5
Stage 3a
Stage 3c
Stage 4a
Why?
Git 分⽀支策略略?
圖片來來源 https://about.gitlab.com/blog/2014/09/29/gitlab-flow/
Git flow GitHub flow
GitLab flow
Trunk based
Why?
Auto DevOps
• Auto Build

• Auto Test

• Auto Code Quality

• Auto Static Application
Security Testing (SAST)

• Auto Dependency Scanning

• Auto License Compliance
• Auto Container Scanning

• Auto Review Apps

• Auto Dynamic Application
Security Testing (DAST)

• Auto Deploy

• Auto Browser Performance
Testing

• Auto Monitoring K8S
K8S
K8S
Prometheus
Why?
CI
持續整合
CD
持續交付
持續部署
Why?
圖片來來源 https://about.gitlab.com/stages-devops-lifecycle/
Why?
符合需求 學習成本
價格 售後服務 商業支援
生態系社群
設計邏輯
工具選擇策略
教學資源
複雜度
整合性
遷移性
役物而不役於物
Manage Your Toolchain
Before It Manages You
來來源 https://about.gitlab.com/resources/whitepaper-forrester-manage-your-toolchain/
Photo by Clark Tibbs on Unsplash
Thank You
https://devopsdays.twhttps://devopstw.club
謝謝

和艦長一起玩轉 GitLab & GitLab Workflow