Build a git project on hudson & some git plug-in bugs…

最近在處理 daily build system,要把某些 project 透過 hudson 建置成無人值守的自動化編譯系統。

不過在 git plug-in 上吃鱉….。

簡單描述一下我的狀況及解決辦法:

我在 github 上開了個 android project,想要設定 hudson 自動檢查 github 上的 code 是否有變更,有變動的話就抓回來編一份丟給 QA 去測試。

而這個 project 有兩個 branch,分別是 master 跟 bugfix。

為了清楚明瞭,在 hudson 上開了兩個不同的 project,一個專門 build master branch,另一個則專門 build bugfix branch。

這時候怪事來了….bugfix 的 SCM polling check log 看起來似乎抓到了 master 的 commit,而 master 的 polling check log 好像也抓到了 bugfix 的 commit。

本來以為是其他開發人員不小心把兩個 branch 做了 merge,不過仔細一看卻又不像這麼一回事。

稍微思考了一下,決定從 hudson 的 build log 下手。

結果發現了這種東西….

[workspace] $ c:cygwinbingit.exe fetch -t git@github.com:gaod/android.git +refs/heads/bugfix:refs/remotes/origin/bugfix
[workspace] $ c:cygwinbingit.exe ls-tree HEAD
[workspace] $ c:cygwinbingit.exe log –all –pretty=format:’%H#%ct’ origin/bugfix

等等,為什麼是 git log –all 呢?!

抓到兇手!git log –all 會去抓整個 project 的所有 branch commit log 啊!那難怪一直出現奇怪現象…

(不過奇怪的是,我搜尋了一下,似乎沒看到有人遇到這問題?)

解法就是,自己去抓 git plug-in 回來修掉這部分,拿掉做 git log 時傳入的 –all 參數,果然就好了!

下面附上 hudson 上這個 github 的 project 的 project 設定檔(好繞口:p)

URL of repository:git@github.com:gaod/android.git
Name of repository:origin
Refspec:+refs/heads/bugfix:refs/remotes/origin/bugfix
Branch Specifier:origin/bugfix

分類: Computer, FreeBSD, Linux, Software。這篇內容的永久連結

在〈Build a git project on hudson & some git plug-in bugs…〉中有 1 則留言

  1. gaod表示:

    目前最新版的 git plugin 似乎解決掉這問題了:p

發表迴響