詹金斯 - 标记构建失败,NoHeadException
问题描述:
当我试图通过詹金斯标记一个特定的构建,我得到以下错误:詹金斯 - 标记构建失败,NoHeadException
ERROR: Error tagging repo 'refs/remotes/origin/master' :
org.eclipse.jgit.api.errors.NoHeadException: Tag on repository without
HEAD currently not supported hudson.plugins.git.GitException:
org.eclipse.jgit.api.errors.NoHeadException: Tag on repository without
HEAD currently not supported at
org.jenkinsci.plugins.gitclient.JGitAPIImpl.tag(JGitAPIImpl.java:509)
at
hudson.plugins.git.GitTagAction$TagWorkerThread.perform(GitTagAction.java:199)
at hudson.model.TaskThread.run(TaskThread.java:129) Caused by:
org.eclipse.jgit.api.errors.NoHeadException: Tag on repository without
HEAD currently not supported at
org.eclipse.jgit.api.TagCommand.call(TagCommand.java:137) at
org.jenkinsci.plugins.gitclient.JGitAPIImpl.tag(JGitAPIImpl.java:507)
... 2 more Trying next branch Completed
当试图在它工作正常,工作区标记,HEAD是实际上连接,git refs看起来很好,这可能是Jenkins试图标记它时正在查找错误的工作目录的问题吗?
有没有办法将更多的详细日志与它试图标记?
FYI - 使用Jenkins 2.81和swarm Linux代理,最新的Git插件。
答
考虑actual code throwing the exception:
try (RevWalk revWalk = new RevWalk(repo)) {
// if no id is set, we should attempt to use HEAD
if (id == null) {
ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$
if (objectId == null)
throw new NoHeadException(
JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported);
仔细检查你的配置:详见 “Jenkins Git plugin detached HEAD”。你需要确保Jenkins实际上检查一个分支。
尝试添加一个简单的测试步骤,并在其中添加git status
以验证该步骤。
我检查了我的配置,它看起来不错,在编译期间,我可以标记没有问题,当我想标记特定的构建之后,那就是当我遇到该错误。问题是我不想标记每一个构建,我需要在事实之后标记某些构建。 当您点击构建和“无标签”部分时,我通过功能进行标记。当我检查工作区时,git status/refs看起来不错,手动标记工作得很好,它通过Jenkins表明它已经打破了已经构建的构建。 –