Jenkins无效的Git修订版 [英] Jenkins Invalid Git Revisions

查看:138
本文介绍了Jenkins无效的Git修订版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Jenkins中,我使用XML API来获取提交的SHA,例如

http:// jenkins / view / job / test / 470 / api / xml?xpath = // lastBuiltRevision / SHA1& wrapper = SHAS



我把它放在一个包装中,因为它经常包含多个SHA并且我要处理这些进一步的。



然而其中一个SHA总是无效...

 < SHAS> 
< SHA1> cbf26ebac6b4b3860a794c0b1ad86758e7757a3a< / SHA1>
< SHA1> 7e861132ce428911585a818107ba35c44cf12bbf< / SHA1>
< / SHAS>

第二个SHA很好,但是当我检查我们的GIT repo提交的第一个SHA时,一个错误页面:


提交'cbf26ebac6b4b3860a794c0b1ad86758e7757a3a'在
repository'test'中不存在。


有谁知道我们为什么会在Jenkins上获得无效的SHA,以及如何解决此问题?

更新:



完成lastBuiltRevision ...

 <包裹> 
>
< SHA1> cbf26ebac6b4b3860a794c0b1ad86758e7757a3a< / SHA1>
<分行>
< SHA1> cbf26ebac6b4b3860a794c0b1ad86758e7757a3a< / SHA1>
<名称> origin / master< / name>
< / branch>
< / lastBuiltRevision>
>
< SHA1> 7e861132ce428911585a818107ba35c44cf12bbf< / SHA1>
<分行>
< SHA1> 7e861132ce428911585a818107ba35c44cf12bbf< / SHA1>
< name> refs / remotes / origin / develop< / name>
< / branch>
< / lastBuiltRevision>
< / wrapped>


解决方案

b
$ b


  • Jenkins在其$ lastBuiltRevision

  • 有人强制推送( git push --force )并用新的历史覆盖SHA1

    In Jenkins I'm using the XML API to get the SHA(s) of a commit, e.g.

    http://jenkins/view/job/test/470/api/xml?xpath=//lastBuiltRevision/SHA1&wrapper=SHAS

    I put it in a wrapper because often it contains more than one SHA and I'm going to process these further.

    However one of the SHAs always is invalid...

    <SHAS>
    <SHA1>cbf26ebac6b4b3860a794c0b1ad86758e7757a3a</SHA1>
    <SHA1>7e861132ce428911585a818107ba35c44cf12bbf</SHA1>
    </SHAS>
    

    The second SHA is fine but when I check the first SHA here on our GIT repo commits it leads to an error page:

    Commit 'cbf26ebac6b4b3860a794c0b1ad86758e7757a3a' does not exist in repository 'test'.

    Does anyone know why we get invalid SHAs on Jenkins and how to resolve this issue?

    UPDATE:

    The complete lastBuiltRevision ...

    <wrapped>
        <lastBuiltRevision>
            <SHA1>cbf26ebac6b4b3860a794c0b1ad86758e7757a3a</SHA1>
            <branch>
                <SHA1>cbf26ebac6b4b3860a794c0b1ad86758e7757a3a</SHA1>
                <name>origin/master</name>
            </branch>
        </lastBuiltRevision>
        <lastBuiltRevision>
            <SHA1>7e861132ce428911585a818107ba35c44cf12bbf</SHA1>
            <branch>
                <SHA1>7e861132ce428911585a818107ba35c44cf12bbf</SHA1>
                <name>refs/remotes/origin/develop</name>
            </branch>
        </lastBuiltRevision>
    </wrapped>
    

    解决方案

    One possible case is when:

    • Jenkins records a SHA1 for origin/master in its lastBuiltRevision
    • someone force push (git push --force) and overwrite the SHA1 with a new history

    这篇关于Jenkins无效的Git修订版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆