DevOpsDay
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    2
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Trunk-Based Development makes DevOps easy. - Paul Hammant {%hackmd @DevOpsDay/B1cnefOI0 %} #### 》[議程介紹](https://devopsdays.tw/2024/speaker-page/1488) #### 》[收看即時AI翻譯字幕|Watch AI-translated subtitles](https://attend.wordly.ai/join/HRTH-6395) #### 》[填寫議程滿意度問卷|回饋建言給辛苦的講者](https://forms.gle/csxMnaFxB8L67zWGA) > 共筆從這開始 ###### tags: `DevOpsDays Taipei 2024` ![620707](https://hackmd.io/_uploads/r1K7twiwC.jpg) # Source control with DevOps is important to me ## CI and Trunk-Based Development ![620706](https://hackmd.io/_uploads/BJbNtwovR.jpg) a branching model for source control ## 4種公司規模 ![620706](https://hackmd.io/_uploads/BJhUKPiP0.jpg) ![620713](https://hackmd.io/_uploads/B1Qz5wiwR.jpg) ![620716](https://hackmd.io/_uploads/rJms9PsvA.jpg) 發佈頻率 100, 10, 1, 1/10 days 佈署一次 緊急修復 2.5, 0.5, <0.1, no 次 CI 本身談論的目標是, 每個開發人員每天將工作重新納入source version control. Release 的頻率愈高,因為 hotfix 的需求愈低,unplanned 的程度反而愈低. 理想狀況是, 持續性計畫性地發布以及 0 個計畫之外的發布. Release **頻率愈低,抓馬愈多,加班愈多**,愈多制度上的不公平(修錯誤要加班,獎金發給加班的人) Release 的頻率相當於練習的頻率,「專家會練到不犯錯」,頻繁 release 等於增加練習的頻率 如果公司每天能發布 10 個版本時, 會發現公司的時間其實已經消除了所有可能發生的錯誤. ## Bad Branching models(對應到前面四分的 Slow Enterprise) ![620720](https://hackmd.io/_uploads/H11ijvowC.jpg) 紅線表示 build 不起作用, 可能無法編譯, 或者單元測試無法運行. Slow Enterprise : (紅線)Not deployable 數量約等於 deployable - 死線到了才 merge - merge 很痛苦,unmerge 很難 [![](https://paulhammant.com/files/multi-branch.jpg)](https://paulhammant.com/blog/branch_by_abstraction.html) > 簡報圖片的來源 ## Traditional Trunk-Based Dev (對應到前面四分的 Better Enterprise) ![620723](https://hackmd.io/_uploads/rybH2viD0.jpg) 圖中的藍色區域是每個開發人員在工作的地方, 距離主幹分之的距離應該只有一天的時間間隔. 發布分支(灰色部分)在接近發布時間時, 不該允許開發人員在該分之上工作, 只有發布工程師和 SRE 可以在該分之上工作. Trunk,所有開發者共享的 branch [![](https://tw.trunkbaseddevelopment.com/trunk1a@2x.png)](https://tw.trunkbaseddevelopment.com/) > 簡報圖片的來源(中文版) ## Better TBD (1/1 Transitional) ![620729](https://hackmd.io/_uploads/Sk9ChwiwA.jpg) 基於主幹開發需要我們在source control 中實踐良好的feature toggle 機制 ## Google-class TBD 沒有分支,只有標籤。 - [Branch by Abstraction](https://paulhammant.com/blog/branch_by_abstraction.html) (一天發布十次) ![620732](https://hackmd.io/_uploads/rJ17aDivA.jpg) ## Case Study - Big FX Bank ![620737](https://hackmd.io/_uploads/Syf9TvjDA.jpg) 這樣的分支模型, 很可能導致有些人在 release 的最後幾天內長時間的工作. 需要做的是將這混亂的建置系統轉移至都是綠線的統一建置系統, 所以需要引入`單元測試`以及`測試自動化`. `抽象分支`的目的是, 使得發布意圖早於發布的工作完成之前. ## More differentiators: Pre-prod 環境(QA, UAT 等) ![620741](https://hackmd.io/_uploads/Hk1qAwovC.jpg) 這裡以 QA 的角度, 並運用四種顏色, 討論與表達更多差異化因素. Slow:因為QA環境都是手動建立,沒有留下任何文件,容易失去/無法重建QA環境 Better : 複製相同環境需要一天 Transitional : 通過 IaC 工具將基礎設施環境也加入source control中, 能快速建立 QA 環境並獨立執行測試 將建立 QA 環境的方法、測試都包含到主幹中,建立不同的 QA 環境變成可以計算的成本(只需要額外取得算力)。 Fast : All in trunk, 隨時產生QA env ## More differentiators: Release binaries ![620749](https://hackmd.io/_uploads/B1tzxuivA.jpg) Slow: zip, 包啥誰也不知道 Better: pkg Transitional: pkg for roll-back Fast: Just fix forward. ## More differentiators: databases ![620751](https://hackmd.io/_uploads/rJx2luiwA.jpg) Slow: 資料庫的發布計畫交由 dba 執行, 但這並不會在開發團隊的掌控之中. Better: 會同時定義出兩個版本間的migration script 以及rollback script Transitional: Fast: 會一直forward fix , 不考慮rollback ## Google's TBD monorepo ![620757](https://hackmd.io/_uploads/SkssZdjPR.jpg) monorepo 促進團隊, 無論使用什麼技術, 都在同一個source control repo中, 只是被劃分至不同的目錄之中.這使得所有團隊能同步更新對應的依賴. 改一個模組,所有用到模組的都會 release。 Google monorepo 是指 Google 使用的單一、龐大的程式碼儲存庫,其中包含了幾乎所有 Google 產品和服務的原始碼。這個儲存庫被稱為 Piper,它是一個集中式的版本控制系統,讓 Google 的工程師們可以更輕鬆地協作、共享程式碼,並維護程式碼的一致性。 by Gimini ### One CD: Continuous Delivery ![620763](https://hackmd.io/_uploads/SJ4CG_oD0.jpg) > is to be or not to be.要麻生存, 要馬毀滅 > from Shakespare CI 事實上只是把每個commit 或 pr, 推入 QA/UAT 環境中, 並不會直接投入正式環境中 CD(持續交付) 指在沒人覺得不妥的情況下, 將程式的變更投入 QA/UAT 環境中. ### The other CD: Continuous Deployment ![620764](https://hackmd.io/_uploads/HJFIX_owC.jpg) 沒有發布指令、pull requests 直接投入production env ### Non Continuous Delivery ![620766](https://hackmd.io/_uploads/Hy2DmuswA.jpg) ### CD 和 NCD # Grading companies / clients ## At the get-to-konw-you stage ![620767](https://hackmd.io/_uploads/HyM4VuswR.jpg) 通過以下的問題循序漸進地了解, 客戶的公司正處於什麼階段. 問客戶的問題: - 同一個應用程式/服務,一年有多少計畫中和計劃外的發布? - 從這個問題可以把客戶分進前面的四類,大概就知道後面的情況 - 要能區分 planned release 或單純只是 bugfix - 製作一個 QA(或 UAT)環境要多久? - 製作第二個要多久? - 服務和資料庫不能跟第一個環境共用 - 防火牆要分開 - 可以清楚知道所需預算 - 製作第三個 QA 環境要多久? https://phdo.paulhammant.com/Trunk-Correlated-Practices-Chart https://phdo.paulhammant.com/BofA-Platform-Case-Study # Q&A Q: A: 這比較是個社交技巧的問題。當然需要支持的架構。要搜集意見、找到對的人挺 TBD、讓團隊能表達安心的轉移時程、好好計畫。在舊作法和新作法之間找到一個折衷。 ---- ## 共筆聊天室: [TW TBD](https://tw.trunkbaseddevelopment.com/) HIHI HI Hi Hi~~ morning zzz testingggggg Hi 簽到~ Forward Fixing:前進就可以得到兩樣東西! 不懂就問:為何要製作多個QA環境? 1. 測試不同feature? 1. 不同程度的整合測試? 翻譯是不是用不了@@ ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully