Skip to content

fix(ci): notify on jakarta build failures instead of dead main guard - #212

Merged
shihyuho merged 1 commit into
jakartafrom
fix/jenkins-failure-notification-branch-guard
Jul 20, 2026
Merged

fix(ci): notify on jakarta build failures instead of dead main guard#212
shihyuho merged 1 commit into
jakartafrom
fix/jenkins-failure-notification-branch-guard

Conversation

@shihyuho

Copy link
Copy Markdown
Member

Refs #197 (COR-02 only)

問題

Jenkinsfile 的失敗通知守衛寫死在 BRANCH_NAME == 'main',但這個 repo 的預設分支與作用線是 jakarta,該條件永遠不成立——jakarta 上的 build 失敗從來沒有通知過任何人

改動

守衛改為 env.BRANCH_IS_PRIMARY == 'true' || env.BRANCH_NAME == 'jakarta'

  • BRANCH_IS_PRIMARY 由 multibranch 的 branch-api 在 SCM 預設分支上設為 'true',之後預設分支若改名不必再回來改這裡;
  • 非 multibranch job 沒有這個變數,故保留分支名字面比對作為 fallback。

Jenkinsfile 單檔,+4/-1。

#206 的關係

本 PR 從 #206 抽出 COR-02 這一項單獨處理。#206 另外兩項經評估後決定不做:

  • TEST-01(新增 GitHub Actions build gate) — 與既有 Jenkins build 功能重疊,同一份測試跑兩次;
  • DEP-02(第三方 action SHA 釘選) — 維護成本相對於本 repo 的風險輪廓不划算。

#206 將關閉,理由記錄於該 PR 與 #197

驗證

Jenkins pipeline 語法無法在本機執行,改動本身是單一條件式重寫、不涉及 Java 原始碼,未跑 make test。實際生效需待合併後由 jakarta 上一次真實的 build 失敗驗證。

The failure notification was gated on BRANCH_NAME == 'main', which is never
true on the active jakarta line, so build failures never alerted anyone.

Gate on branch-api's BRANCH_IS_PRIMARY flag so the guard survives a default
branch rename, with a literal jakarta fallback for non-multibranch jobs where
that variable is absent.

Co-authored-by: Claude Opus 4.8 <[email protected]>
@shihyuho
shihyuho merged commit 9827739 into jakarta Jul 20, 2026
2 of 4 checks passed
@shihyuho
shihyuho deleted the fix/jenkins-failure-notification-branch-guard branch July 20, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant