有没有办法告诉詹金斯在克隆Git回购协议方面取得了多大进展?

有没有办法告诉詹金斯在克隆Git回购协议方面取得了多大进展?,git,jenkins,Git,Jenkins,我现在已经在Jenkins中运行了一个构建,在控制台输出中可以看到: Started by user anonymous Building in workspace /var/lib/jenkins/workspace/Main Checkout:Main / /var/lib/jenkins/workspace/Main - hudson.remoting.LocalChannel@820ea4 Using strategy: Default Cloning the remote Git re

我现在已经在Jenkins中运行了一个构建,在控制台输出中可以看到:

Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/Main
Checkout:Main / /var/lib/jenkins/workspace/Main - hudson.remoting.LocalChannel@820ea4
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
我理解这可能是因为Git进程尚未刷新其输出流;但这很令人沮丧,因为如果我从终端运行一个
git克隆
,那么我可以清楚地看到实时更新的百分比,告诉我命令完成的距离有多近

这其实并不重要,除非:

  • 我需要尽快关掉这台机器
  • 这种特殊的回购需要很长时间才能克隆(大约一个多小时)
  • 因此,如果克隆达到90%,我想让它完成。如果它更像是50%,那么我只想停止构建,然后在早上重新开始
  • 有人知道是否有可能以某种方式获得我渴望的信息吗?

    搜索clone并查看它在哪里检查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.
    

    我看到了类似的症状,我发现这是由Jenkin的Git plugin clone()方法中递归删除工作区引起的(请参见下面的代码片段)。在我的例子中,我们有许多作业共享一个自定义工作区,因此delete调用需要几个小时才能完成。删除自定义工作区后,克隆操作成功完成

    发件人:


    (这应该是对前面答案的评论,但我还没有代表发表评论。)

    您有什么版本的GIT?
    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);
    }