Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
From Commit to Mulitverse
Search
Neo Kusanagi
September 12, 2024
0
190
From Commit to Mulitverse
Neo Kusanagi
September 12, 2024
Tweet
Share
More Decks by Neo Kusanagi
See All by Neo Kusanagi
From Traditional Web to Modern Web
neokn
0
190
AUGM 2017 Electron talk
neokn
0
96
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
54
13k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
BBQ
matthewcrist
89
9.7k
Site-Speed That Sticks
csswizardry
10
670
The Cult of Friendly URLs
andyhume
79
6.5k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Rebuilding a faster, lazier Slack
samanthasiow
82
9.1k
Navigating Team Friction
lara
187
15k
Transcript
2024 Hello World Conf Jrting - Titansoft Technical Manager 用
commit 生成編年史 構築世界再到多重宇宙
這場演講會講什麼?
• 如何推動 convention a l commits • convention 帶來的 自
動化 • 建構可追蹤可重現的微服務
這場演講不會講什麼?
• 什麼是 convention a l commits • 如何做整合測試 • 怎麼做好微服務
讓我們開始今天的講題
回顧一下你是否有遇過這些場景
場景 (1) - bug 變 feature?
這程式碼看起來怪怪的 ... 怎麼寫成這樣啊!
Blame 啦! 哪次不 Blame
什麼!!! 居然是我自己寫的 ...
為什麼當初會這麼寫呢? 這個和 business domain 對不上呀? 這應該會出 bug 吧!
我該改掉他嗎? 但是沒有使用者回報 ... 難不成 bug 已經變 feature 了?
當工程師 人生好難
場景 (2) - 奇怪的 code 不敢動
這程式碼看起來怪怪的 ... 怎麼寫成這樣啊!
Blame 啦! 哪次不 Blame
Fix Issue
到底 fix 什麼啦! 我是不是不能亂改?
當工程師 人生好難
場景 (3) - rollback
哇!!! 線上出包了啦!!!
先 rollback rollback
要 roll 回哪一版??
就上次 release 的呀! 快點 快點
目前線上的版本 應該要被 rollback 的版本 當工程師 人生好難 找 超 久
我 K8s 很熟 我來!我來!
kubectl rollout undo deployment/hello-world
哇!!! 怎麼 rollback 個 service 整個系統都掛了啦!!!
我們做的 Service Mesh
怎麼變成 Service Crash
當工程師 人生好難
其實 commit 寫好都可以避免
Conventional Commits 很棒的 我們要不要來試試
現在不是好好的嗎? 為什麼要改 這樣我提交程式碼的速度會變慢耶
用 commit 生成編年史 構築世界再到多重宇宙
當一個段 code 被 commit 你期待看到什麼?
5W1H
• Why • What • Who • When • Where
• How
• Why is the change needed? 為什麼需要改 • What •
Who • When • Where • How
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who • When • Where • How
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who made the change? 誰改的 • When • Where • How
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who made the change? 誰改的 • When was this change made? 什麼時候改的 • Where • How
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who made the change? 誰改的 • When was this change made? 什麼時候改的 • Where was the change made? 哪裡被改了 • How
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who made the change? 誰改的 • When was this change made? 什麼時候改的 • Where was the change made? 哪裡被改了 • How was the item implemented? 怎麼被實作的
當我們用了 git
• Why is the change needed? 為什麼需要改 • What does
the commit aim to address? 這個是想解決什麼問題 • Who -> git log • When -> git log • Where -> git diff • How -> git diff
• Why -> 這才是我們想知道的 • What -> 這才是我們想知道的 • Who
-> git log • When -> git log • Where -> git diff • How -> git diff
從哪裡可以拿到?
Go Jira 掃描 QR Code 立即了解
• Why -> Jira 有寫 • What -> Jira 有寫
怎麼做?
Conventional Commits 做下去啦! Just do 督 it 啦!哪次不督!
乾我P事 要做你自己做 反應 1
feat, fix, build, chore, ci, docs, style, refactor, perf, test
好多要選 好多要學 學不動了啦~ 反應 2
為什麼會這樣?
每一個人從出生起就是自由的 - 進擊的巨人
Convention 就是一種限制
Convention 違反人性
如果 Manager 這樣做
Manager 就成了巨人
先解決大家認同的問題
• Why -> Jira 有寫 • What -> Jira 有寫
commit 時加上 Jira 編號
簡單啦~
HW-1012 add some awesome feature
不過就是個 Jira 能做什麼
commit message 還是像 💩
但現在我們有 convention 了
什麼是 convention?
Human Friendly & Machine Readable
Human Friendly & Machine Readable
自動化!
None
會自動識別為 jira 連結
None
連結回 GitLab
None
自動把 commit message 寫在 item comment
None
feat(FT-1984): Hello
fix(FX-1947): just fix it
好麻煩喔 ... 又括號又空白的 我每次 commit 都要記得 jira 編號
怎麼辦?
DevEx
我們只改變 branch name?
feat/FT-1984-ooxx
fix/FX-1947-ooxx
None
有 convention 就有自動化
點 🐸 就會自動生成 JetBrains Plugin: Jira id commit message
事情有那麼簡單嗎?
我在 branch 上就是會修修改改 踹東踹西啊!為什麼要逼我~
None
Option2:Merge 再來檢查吧!
None
小結 • 建立 Convention 的時候一次不要太多
小結 • 建立 Convention 的時候一次不要太多 • 先解決最在乎的 Why, What
小結 • 建立 Convention 的時候一次不要太多 • 先解決最在乎的 Why, What •
盡量貼近成員現在的習慣降低摩擦力提升 DevEx
生成編年史
feat & fix & Jira
有 convention 就能自動化
None
None
Jira Link Git Diff
Auto SemVer
None
這樣真的完美了嗎?
💩💩💩 💩 💩 💩💩
💩💩💩 💩 💩 💩💩 💩💩💩
💩💩💩 💩 💩 💩💩 💩💩💩 到處都是💩
有個容易檢視交付變化的地方 就會有人開始改變習慣 小小改變大💩化
小結 • 有 convention 就能自動化
小結 • 有 convention 就能自動化 • 能自動化就不會改變大家的工作流程
小結 • 有 convention 就能自動化 • 能自動化就不會改變大家的工作流程 • CHANGELOG 可以很容易地查看紀錄那麼
commit message 就會有變化
構築世界
6518efd1 Continuous Integration Continuous Delivery
6518efd1 8cc92431 28116d53 b74e69b8 一個沒有經過完善規劃的微服務
Service Mesh
Service Crash
2.0.2 4.2.0 9.1.2 1.4.3 讓版本易讀也會容易紀錄哪些版本組合是可正常運作的
把版號帶入 ENV
None
把 Image:Ver 帶入 structured logging
sample code using dotnet Serilog
把 Service/Ver 帶入 request
在 header 補上 User-Agent 讓 Service 知道是哪一個服務的哪一個版本送的 request e.g. HelloWorld/9.1.2
建構出一個有 SemVer 的微服務世界
小結 • 即使有貫穿 services 的 log tracing 還是不知道當下的版本
小結 • 即使有貫穿 services 的 log tracing 還是不知道當下的版本 • 有
SemVer 能更貼近真實情況
小結 • 即使有貫穿 services 的 log tracing 還是不知道當下的版本 • 有
SemVer 能更貼近真實情況 • 利用 User-Agent 讓 Server-Side 認得 Client-Side
多重宇宙
用 docker compose 建立不同版本的整合測試
Before SemVer: 不是很容易理解其中的差異
After SemVer: 容易地閱讀以及可以看出有沒有 bracking change
6518efd1 Continuous Integration Continuous Delivery 6518efd1 1.2.0
Loc a l K3s
Loc a l K3s CI docker compose
Loc a l K3s St a ging K8s CI docker
compose
Loc a l K3s St a ging K8s CI docker
compose Production K8s
小結 • 有 SemVer 能容易組合出想測試的版本
小結 • 有 SemVer 能容易組合出想測試的版本 • release 新版本以前能整合,要 rollback 前也能整合
小結 • 有 SemVer 能容易組合出想測試的版本 • release 新版本以前能整合,要 rollback 前也能整合
• 在任何環境都能重現
總結
從 Commit • 帶入一點 convention 重在 why, what
從 Commit • 帶入一點 convention 重在 why, what • 找到利大於弊的槓桿,
小小改變大大改善
生成編年史 • CHANGLOG 是一個方便查閱變更的地方
生成編年史 • CHANGLOG 是一個方便查閱變更的地方 • 不用人工維護, 全仰賴 commit message, 品質有機會變好
構築世界到多重宇宙 • 用 SemVer 讓變更易懂
構築世界到多重宇宙 • 用 SemVer 讓變更易懂 • 有 SemVer 讓 services
組合與追蹤變容易