<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Keith Yeh on Medium]]></title>
        <description><![CDATA[Stories by Keith Yeh on Medium]]></description>
        <link>https://medium.com/@keithyeh?source=rss-72b888b1e6aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5-_g3vZsSCo-7KZ2_w9G9A.jpeg</url>
            <title>Stories by Keith Yeh on Medium</title>
            <link>https://medium.com/@keithyeh?source=rss-72b888b1e6aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:36:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@keithyeh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[使用 Gitlab issue board 達成任務與工作流程視覺化，並搭配 Webhook 打造自動化 Kanban]]></title>
            <link>https://medium.com/sparkamplab/%E4%BD%BF%E7%94%A8-gitlab-issue-board-%E9%81%94%E6%88%90%E4%BB%BB%E5%8B%99%E8%88%87%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E8%A6%96%E8%A6%BA%E5%8C%96-%E4%B8%A6%E6%90%AD%E9%85%8D-webhook-%E6%89%93%E9%80%A0%E8%87%AA%E5%8B%95%E5%8C%96-kanban-5a05eab8603a?source=rss-72b888b1e6aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a05eab8603a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kanban]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[agile-development]]></category>
            <dc:creator><![CDATA[Keith Yeh]]></dc:creator>
            <pubDate>Wed, 09 May 2018 17:38:45 GMT</pubDate>
            <atom:updated>2018-05-09T17:38:45.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1oKzHRpUFpJg9UsE." /><figcaption>“Colorful sticky notes on a gray wall” by <a href="https://unsplash.com/@pperkins?utm_source=medium&amp;utm_medium=referral">Patrick Perkins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>從 Gitlab CE 6.x 的時代一路用到了現在 10.x 的版本，應該也算是他們的資深用戶了。這篇文章會分享我這幾年在使用 Gitlab 跑敏捷開發的一些經驗談。</p><p>一開始我們的 Gitlab 只拿來存程式碼，專案的管理有嘗試過用 Trello 來管理工作流程，大約試了幾個 Sprint 之後就放棄了，放棄的原因是因為要一直在不同的系統間來回切換，還得花不少時間在維護 Trello board 讓它保持在最新狀態。</p><p>後來折衷的做法是使用 Gitlab 的 milestone 頁面，不過那頁也只有三種預設的清單 (Unstarted, Ongoing and Completed) 。雖然陽春了點，至少能大略了解目前的進度。最重要的是不用手動維護清單的狀態，對努力找到偷懶方法的軟體工程師來說，能自動的東西，絕對不想手動去做。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x9-br0l4NGtLG2UfVTNuQA.png" /></figure><p>雖然 Milestone 頁面，能夠提供目前的進度，但是對更細節的資訊就稍嫌不足。譬如我想知道某個 BUG 目前的修復狀態到哪了，原本的介面只會告訴我正在進行中。無法得知是已經開始進行、正在進行自動化測試或者已經部署到 Staging 環境上等待驗收之類的訊息。</p><p>對於每個月總會定時更新 Gitlab 的忠實用戶來說，看到他們推出 issue board 的時候其實還滿興奮的，馬上將當時的工作流程切割成洋洋灑灑數個階段，並放到 issue board 上面。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jTSoqiQ9SDDtyx_H7K2HLQ.png" /><figcaption>Issue Board in HWTrek</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTNFqJy7uWr4so6LQIIR6g.png" /><figcaption>Issue Board in SparkAmplify</figcaption></figure><p>上圖所包含的階段分別是：</p><ol><li><strong>Planning</strong>: 規劃中的任務，還有些細節需要釐清。</li><li><strong>To Do</strong>: 接下來待處理的任務</li><li><strong>Doing</strong>: 處理中的任務。</li><li><strong>Ready for Testing</strong>: 已發出 Merge Request，等待執行自動化測試。</li><li><strong>Testing</strong>: 已發出 Merge Request，正在執行自動化測試。</li><li><strong>Ready for Review</strong>: 已通過自動化測試，等待 Code Review</li><li><strong>Review</strong>: 正在進行 Code review</li><li><strong>Staging</strong>: 已部署到 Stage 的環境，等待驗收。</li><li><strong>Ready for Production: </strong>已在 Stage 環境驗收過，等待部署到 Production</li><li><strong>Production: </strong>已部署到 Production 的環境，等待最後驗收。</li></ol><p>分類完成後，看著井然有序的 Issue 列表，頓時覺得自我感覺良好XD。之前使用 Trello 時需要頻繁切換系統和 Milestone 頁面只有陽春狀態的問題都是過去式了。</p><p>然而這種自我感覺良好的心情並沒有持續太久。實際運作了一兩週後，發現我還是得花心力去維護 issue board 讓它保持在最新的狀態。最初版本的 issue board 唯一內建的自動化功能就只有切換清單的時候，會自動移除舊的標籤，並加上新的標籤。雖然後續有強化了不少<a href="https://medium.com/@gitlab/the-evolution-of-gitlab-issue-board-aae84c6a9793">功能</a>，對當時的團隊來說遠遠不夠。這時軟體工程師努力讓自己可以變得更懶的病又發作了XD。</p><p>對我來說，最理想的目標就是每個人只要做著跟平常一樣流程（我們團隊使用的是 Git flow / Gitlab flow）：</p><ol><li>Open feature branch</li><li>Make some change and commit</li><li>Push to Gitlab</li><li>Create merge request</li><li>Review and merge</li><li>Verify and close issue</li></ol><p>Issue board 就會即時反應最新的狀態，需要人為介入的地方越少越好。要達到這個目的，我整合了 <a href="https://docs.gitlab.com/ce/user/project/integrations/webhooks.html">Gitlab webhook</a> 和 <a href="https://docs.gitlab.com/ce/api/">Gitlab API</a> 來打造一個自動化看板。下面的篇幅會一一介紹任務在每個工作階段移動的流程，與自動化所需的步驟。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*NkC_xusS6d2ZxUKdkJvzCg.png" /><figcaption>Gitlab webhook</figcaption></figure><h4>Backlog 到 Planning / To Do</h4><p>任務從 Backlog 到 To Do 的步驟，我們目前沒有做自動化。畢竟排定任務優先權與決定施作順序的責任還是在 PM 身上，暫時無法由機器代勞。</p><h4>To Do 到 Doing</h4><p>因為團隊是實行 Git flow / Gitlab flow 的關係，每次的功能變動後會先建立一個分支，告一段落後才會合併回 master。若是直接使用 Gitlab UI 建立分支的話，還會連對應的 Merge Request 都建立好。</p><p>所以這裡我串接了 Push event 的 webhook。因為走 Gitlab flow 的關係，分支的命名規則會是 ##-this-is-issue-xx-title 。最前面的 ## 代表的就是對應的 issue iid。</p><p>在 Push event webhook 裡面去解析來源分支的名稱，再拿解析出的 issue iid 去呼叫對應的 API 更改 issue label，增加 Doing 移除 To Do ( Issue board 的清單都是從特定的標籤產生的)。</p><h4>Doing 到 Ready For Testing / Testing</h4><p>當 Feature branch 的開發告一段落後，會發一個 Merge Request 給其他人。我們使用了 <a href="https://gitlab.com/help/user/project/description_templates.md">Gitlab description templates</a> 來規範 Merge Request 的敘述要包含哪些東西，其中最重要的就是這個 MR 裡面包含的 issue 編號。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9ox3OtkQ3QqoYDzB8Ea6g.png" /><figcaption>Merge Request Template</figcaption></figure><p>在 Merge Request event webhook 裡面去解析 description 的內容，得到所有相關連的 issue iid。再拿來源分支名稱去專案裡面的所有的 <a href="https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines">pipeline 清單</a>做比較，得到最新的 pipeline id 與狀態， pending 就移到 <em>Ready for Testing</em>；<em> </em>running 就移到 <em>Testing</em>。最後再將所有 issue iid 寫入快取，讓接下來的 Pipeline event webhook 使用。</p><h4>Ready for Testing / Testing 到 Ready for Review</h4><p>每次 Feature branch 有新的 commit 都會觸發 CI pipeline，執行相關的自動化測試。為了即時反應 Merge Request 所包含之 Issue 的最新狀態，我在 Pipeline event webhook 裡面去檢查快取是否含有 Merge Request event 提及的 issue iid。如果有的話，在 pipeline 狀態變成 running 時，把 <em>Ready for Testing </em>的 issue 移到 <em>Testing</em>；狀態是 success 時，把 issue 移到 <em>Ready for Review</em> 並通知 reviewer 可以開始進行 Code review 的流程。</p><p>通知 reviewer 的方式，目前是使用一個 Bot 的帳號透過留言 mention reviewer 的方式，這樣會觸發 Gitlab 內建的通知系統，並把這個留言自動加到 reviewer 的<a href="https://docs.gitlab.com/ce/workflow/todos.html">待辦清單</a>裡。如果想要更即時的話還可以整合 Slack 的 API 同步發 Slack 訊息給 reviewer。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdMzbSwXkcub7T0QnJnXxg.png" /><figcaption>Gitlab Todos</figcaption></figure><h4>Ready for Review 到 Review</h4><p>將 Code review 拆成 <em>Ready for Review</em> 和 <em>Review</em> 兩階段的原因是，當同一個 Reviewer 身上會同時有多個 Merge Request 等待審核時，就能知道哪些 issue正在審核中，而哪些 issue 還在排隊。</p><p>原本的做法是要求 Reviewer 手動將 issue 從 <em>Ready for Review</em> 拉到 <em>Review</em> 的清單，當一個 Merge Request 裡面包含多筆 issues 時，這就變成擾人的一件事。</p><p>為了解決這個問題，我們串接了 <a href="https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-merge-request">Comment event hook</a> 針對在已通過自動化測試的 Merge Request 的留言動作，自動將同一個 Merge Request 裡面提到的相關 issues 移到 <em>Review </em>的清單裡。</p><h4>Ready for Review / Review 到 Staging</h4><p>這裡串接了 Merge Request event hook。當 MR 被合併之後，Webhook 會將所有提及的 issue iid 存到快取中，讓接下來的 Pipeline event webhook 使用。</p><p>當 master 的 pipeline 執行成功後，Webhook 就會把快取裡的所有 issues 移到 <em>Staging</em> 的清單，把 issue 重新指派給 issue owner，並通知 issue owner 和PM 可以到 stage 上面去驗收成果。</p><h4>Staging ➔ Ready for Production ➔ Production</h4><p>在 Stage 上驗收完成的 issue 得由 issue owner / PM 手動拉到 <em>Ready for Production</em>。這會搭配接下來要部署到 Production 時，需要包含的 Changelog 有關。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*BEN3d836Gbebuby2KJSlWQ.png" /><figcaption>Changelog Snippet</figcaption></figure><p>當一個 Milestone 的功能都完成並測試過後，我們會發一個 Merge Request 並包含 Changelog 的訊息。這時 Merge Request event hook 就會去檢查，所有提及到的 issue 是否都已經在 <em>Ready for Production</em> 的清單裡面。當 MR 被合併之後，Webhook 一樣會將所有提及的 issue iid 存到快取中，當接下來的 Pipeline event webhook 部署成功後，就會將快取中所有的 issues 移到 <em>Production </em>的清單，並通知 PM 做最後的驗收。</p><p>在更新過的流程裡面，需要手動調整 Issue board 的地方就只剩下一開始排定任務優先權和施作順序，以及最後在 Stage 和 Production 的驗收步驟。其他人只需要遵照正常的 Git flow / Gitlab flow 開發流程來作業，Issue board 就會反映專案目前最新的狀態，有這些資訊後才能確認目前的團隊工作流程是否存在瓶頸，對症下藥，進而加速團隊的交付速度。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a05eab8603a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sparkamplab/%E4%BD%BF%E7%94%A8-gitlab-issue-board-%E9%81%94%E6%88%90%E4%BB%BB%E5%8B%99%E8%88%87%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B%E8%A6%96%E8%A6%BA%E5%8C%96-%E4%B8%A6%E6%90%AD%E9%85%8D-webhook-%E6%89%93%E9%80%A0%E8%87%AA%E5%8B%95%E5%8C%96-kanban-5a05eab8603a">使用 Gitlab issue board 達成任務與工作流程視覺化，並搭配 Webhook 打造自動化 Kanban</a> was originally published in <a href="https://medium.com/sparkamplab">SparkAmpLab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>