执行Jenkins作业时出错:致命:引用不是树



我正在尝试执行Jenkins作业,该作业从git repo中提取代码,然后构建并执行集成。在获取git期间,我得到了以下问题。我有另一个Jenkins工作,配置了相同的git repo,在那里工作得很好。我引用了很多线程,比如Git子模块head';引用不是树';错误,但仍然不知道如何在詹金斯的一份工作中,它工作良好,在另一份中失败

17:48:37  > git rev-parse origin/alternate^{commit} # timeout=10
17:48:37 Checking out Revision 8e4ffd8bb7596248efd4082ea529d42ce8022b1e (origin/alternate)
17:48:37  > git config core.sparsecheckout # timeout=10
17:48:37  > git checkout -f 8e4ffd8bb7596248efd4082ea529d42ce8022b1e # timeout=10
17:48:39 Commit message: "Merged 1 PR(s): pull request #1987 (disable batch node in dev/stage) from ksdwpta/disable_SYSE-6232  (https://git.corp.mycompany.com/Org/StorageService/pull/1987)"
17:48:39 First time build. Skipping changelog.
17:48:39 [EnvInject] - Inject global passwords.
17:48:39 [EnvInject] - Mask passwords that will be passed as build parameters.
17:48:39 [css-dev-esm-an1-deploytool-validation-demo] $ /bin/bash /apps/temp/jenkins1473873858039772764.sh
17:48:39 fatal: reference is not a tree: 9a895aa7b58bc033068f1a61b8dab66ab4faedd4
17:48:39 Build step 'Execute shell' marked build as failure
17:48:39 $ ssh-agent -k
17:48:39 unset SSH_AUTH_SOCK;
17:48:39 unset SSH_AGENT_PID;
17:48:39 echo Agent pid 20731 killed;
17:48:39 [ssh-agent] Stopped.
17:48:39 Recording test results
17:48:39 ERROR: Step ?Publish JUnit test result report? failed: No test report files were found. Configuration error?
17:48:39 Archiving artifacts
17:48:39 Notifying endpoint with url 'https://conduit.pipeline.corp.mycompany.com/v1/jenkins/status'
17:48:39 Started calculate disk usage of build
17:48:39 Finished Calculation of disk usage of build in 0 seconds
17:48:39 Started calculate disk usage of workspace
17:48:40 Finished Calculation of disk usage of workspace in 0 seconds
17:48:40 Finished: FAILURE

TLDR:如果您很容易拆除一个jenkins代理并生成一个新的代理,请尝试一下,看看它是否能解决问题。


更多详细信息:

git的说法:;树;是存储在git数据库中的目录。

由于某些原因:错误消息中提到的哈希9a895aa...标识的树不可访问。

这就是你发布的信息的全部内容,如果你需要进一步的帮助,我们需要更多的细节(请参阅下面的"调试"(


一些可能的原因:

  • 跟踪中提到了sparsecheckout选项:如果此代理的repo中没有该树,它将无法访问它
  • 由于某种原因,该特定代理使用的git克隆已损坏,现在缺少该树
  • 您的repo中有一些子模块尚未正确初始化/提取

调试:

  • 您的跟踪提到了一个jenkins1473873858039772764.sh,它是在您的管道中编写的内联脚本的符号(正确吗?(

如果可以:将此脚本的文本添加到您的问题中。

您还可以编辑脚本以添加更多跟踪(例如:通过在其中添加echo "some message"指令(

  • 在您的本地克隆上,您可以检查树9a895aa...是否应该是您自己的repo的一部分,或者可能是某个子模块的一部分:

    # from your repo, run :
    git show 9a895aa
    

修复

  • 尝试删除sparsecheckout选项
  • 如果树在本地克隆上成功显示:jenkins代理应该有它;最简单的修复方法是在该代理上重新克隆repo,或重置该代理
  • 如果不是:它可能是子模块中的树,请在每个子模块中运行相同的命令;一旦确定了子模块,请检查该子模块是如何在此jenkins代理上初始化的

相关内容

最新更新