2012-05-30 39 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); 
} 

(这应该是对以前的答案评论,但我没有代表处作出评论)