2012-05-30 59 views
3

我有現在在詹金斯運行構建和所有我能在控制檯輸出中看到的是:有沒有辦法說明詹金斯在克隆Git回購中有多遠?

Started by user anonymous 
Building in workspace /var/lib/jenkins/workspace/Main 
Checkout:Main//var/lib/jenkins/workspace/Main - [email protected] 
Using strategy: Default 
Cloning the remote Git repository 
Cloning repository origin 

我理解這可能是因爲Git的過程中並沒有刷新其輸出流之中;但這很令人沮喪,因爲如果我從終端運行git clone,那麼我可以清楚地看到實時更新的百分比,告訴我命令要完成的距離有多遠。

它不會真的重要不同之處在於:

  1. 我需要儘快關閉本機。
  2. 這個特定的回購需要時間克隆(如一個多小時)。
  3. 因此,如果克隆的比例是90%,我想讓它結束。如果它更像是50%,那麼我想殺死這個構建並在早上開始。

有誰知道是否有可能以某種方式獲得我渴望的信息?

+0

你有什麼版本的GIT的? –

回答

2

搜索克隆,看看它會檢查Git版本,以確定它是否通過了--progress標誌。如果你的構建已經開始,那麼你可以做的不多,但爲了將來的參考,這可能會有所幫助。

--progress 
     Progress status is reported on the standard error stream by default 
     when it is attached to a terminal, unless -q is specified. This 
     flag forces progress status even if the standard error stream is 
     not directed to a terminal. 
0

我看到了類似的症狀,我發現它是由遞歸刪除詹的Git的插件clone()方法的工作空間(見代碼片段,下同)引起的。就我而言,我們有許多共享一個自定義工作區的作業,因此刪除調用需要數小時才能完成。刪除自定義工作區後,克隆操作成功完成。

https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitAPI.java

final String source = remoteConfig.getURIs().get(0).toPrivateString(); 

listener.getLogger().println("Cloning repository " + source); 
final int[] gitVer = getGitVersion(); 

try { 
    workspace.deleteRecursive(); // This line was taking forever 
} catch (Exception e) { 
    e.printStackTrace(listener.error("Failed to clean the workspace")); 
    throw new GitException("Failed to delete workspace", e); 
} 

(這應該是對以前的答案評論,但我沒有代表處作出評論)