本文介绍了杰金斯的Gerrit触发器找不到任何修订版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Jenkins + Gerrit时遇到了麻烦。



以下是我到目前为止的内容:


  • Jenkins中的Gerrit触发器配置似乎没问题:当我推送一个新的变更集时,Jenkins构建版本启动。

  • 使用此:



    现在您会注意到有一个按钮高级,点击它可以显示如下的额外字段:





    现在你可以在这里输入你的refspec:$ GERRIT_REFSPEC



    现在是eit她重新触发失败的构建或放弃审查并提交一个新的应用程序。



    下面是Jenkins作业的输出,现在我们有相应的refspec:

      Gerrit用户kerrien重新发布:https://bbpcode.epfl.ch/code/15056 
    [EnvInject ] - 加载节点环境变量。
    在工作空间/var/tmp/jenkins/workspace/datamining.nip-commons.gerrit中的rh6.6-02上进行远程构建(amd64-RedHatEnterpriseServer 6.6 RedHatEnterpriseServer amd64-RedHatEnterpriseServer-6.6 rh6.x RedHatEnterpriseServer-6.6 amd64)
    > / usr / bin / git rev-parse --is-inside-work-tree#timeout = 10
    从远程Git存储库获取更改
    > / usr / bin / git config remote.origin.url ssh://bbpcode.epfl.ch/datamining/nip-commons#timeout = 10
    从ssh获取上游更改://bbpcode.epfl.ch/datamining / nip-commons
    > / usr / bin / git --version#timeout = 10
    > / usr / bin / git fetch --tags --progress ssh://bbpcode.epfl.ch/datamining/nip-commons refs / changes / 56/15056/2
    > / usr / bin / git rev-parse 74e4ff18f54bd6e046f7af016614193f566adfe4 ^ {commit}#timeout = 10
    检出版本74e4ff18f54bd6e046f7af016614193f566adfe4(dev)
    > / usr / bin / git config core.sparsecheckout#timeout = 10
    > / usr / bin / git checkout -f 74e4ff18f54bd6e046f7af016614193f566adfe4
    > / usr / bin / git rev-parse FETCH_HEAD ^ {commit}#timeout = 10
    > / usr / bin / git rev-list 2649d51369413cef4dfb7ec50939945005514cfa#timeout = 10
    清理工作区
    > / usr / bin / git rev-parse --verify HEAD#timeout = 10
    重置工作树
    > / usr / bin / git reset --hard#timeout = 10
    > / usr / bin / git clean -fdx#timeout = 10
    触发datamining.nip-commons.gerrit»默认
    datamining.nip-commons.gerrit»默认结果为SUCCESS
    开始计算构建的磁盘使用情况
    已完成计算2秒内构建的磁盘使用情况
    开始计算工作空间的磁盘使用情况
    完成在0秒内计算工作空间的磁盘使用情况
    完成:SUCCESS


    I have trouble using Jenkins+Gerrit.

    Here is what I got so far:

    Here is my issue. When building (gerrit triggered or manually), log output is:

     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url ssh://user@host:29418/testproject # timeout=10
    Fetching upstream changes from ssh://user@host:29418/testproject
     > git --version # timeout=10
    using GIT_SSH to set credentials 
     > git -c core.askpass=true fetch --tags --progress ssh://user@host:29418/testproject refs/heads/master
     > git rev-parse origin/$GERRIT_BRANCH^{commit} # timeout=10
     > git rev-parse $GERRIT_BRANCH^{commit} # timeout=10
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    Finished: FAILURE
    

    I am stuck with this message, tried with empty repo, non-empty ones, and also with or without changeset "in review"

    解决方案

    I used to have this problem and I think I have now fixed it, I am blaming the Jenkins UI for hiding some essential configuration elements ;)

    Here is the output of my Jenkins build prior to the fix:

    Triggered by Gerrit: https://bbpcode.epfl.ch/code/15056
    [EnvInject] - Loading node environment variables.
    Building remotely on rh6.6-02 (amd64-RedHatEnterpriseServer 6.6 RedHatEnterpriseServer amd64-RedHatEnterpriseServer-6.6 rh6.x RedHatEnterpriseServer-6.6 amd64) in workspace /var/tmp/jenkins/workspace/datamining.nip-commons.gerrit
     > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > /usr/bin/git config remote.origin.url ssh://bbpcode.epfl.ch/datamining/nip-commons # timeout=10
    Fetching upstream changes from ssh://bbpcode.epfl.ch/datamining/nip-commons
     > /usr/bin/git --version # timeout=10
     > /usr/bin/git fetch --tags --progress ssh://bbpcode.epfl.ch/datamining/nip-commons +refs/heads/*:refs/remotes/origin/*
     > /usr/bin/git rev-parse 74e4ff18f54bd6e046f7af016614193f566adfe4^{commit} # timeout=10
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    Started calculate disk usage of build
    Finished Calculation of disk usage of build in 0 seconds
    Started calculate disk usage of workspace
    Finished Calculation of disk usage of workspace in 0 seconds
    Finished: FAILURE
    

    SOLUTION

    You will need to open your build configuration and go to the section 'Source Code Management' as shown below:

    Now you will notice that there is a button 'Advanced', click it to reveal the extra fields as below:

    Now you can type your refspec here: $GERRIT_REFSPEC

    Now either retrigger a failed build or abandon reviews and submit a new one and it should be working.

    Here is the output of the Jenkins job now that we have the appropriate refspec:

    Retriggered by user kerrien for Gerrit: https://bbpcode.epfl.ch/code/15056
    [EnvInject] - Loading node environment variables.
    Building remotely on rh6.6-02 (amd64-RedHatEnterpriseServer 6.6 RedHatEnterpriseServer amd64-RedHatEnterpriseServer-6.6 rh6.x RedHatEnterpriseServer-6.6 amd64) in workspace /var/tmp/jenkins/workspace/datamining.nip-commons.gerrit
     > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > /usr/bin/git config remote.origin.url ssh://bbpcode.epfl.ch/datamining/nip-commons # timeout=10
    Fetching upstream changes from ssh://bbpcode.epfl.ch/datamining/nip-commons
     > /usr/bin/git --version # timeout=10
     > /usr/bin/git fetch --tags --progress ssh://bbpcode.epfl.ch/datamining/nip-commons refs/changes/56/15056/2
     > /usr/bin/git rev-parse 74e4ff18f54bd6e046f7af016614193f566adfe4^{commit} # timeout=10
    Checking out Revision 74e4ff18f54bd6e046f7af016614193f566adfe4 (dev)
     > /usr/bin/git config core.sparsecheckout # timeout=10
     > /usr/bin/git checkout -f 74e4ff18f54bd6e046f7af016614193f566adfe4
     > /usr/bin/git rev-parse FETCH_HEAD^{commit} # timeout=10
     > /usr/bin/git rev-list 2649d51369413cef4dfb7ec50939945005514cfa # timeout=10
    Cleaning workspace
     > /usr/bin/git rev-parse --verify HEAD # timeout=10
    Resetting working tree
     > /usr/bin/git reset --hard # timeout=10
     > /usr/bin/git clean -fdx # timeout=10
    Triggering datamining.nip-commons.gerrit » default
    datamining.nip-commons.gerrit » default completed with result SUCCESS
    Started calculate disk usage of build
    Finished Calculation of disk usage of build in  2 second
    Started calculate disk usage of workspace
    Finished Calculation of disk usage of workspace in 0 seconds
    Finished: SUCCESS
    

    这篇关于杰金斯的Gerrit触发器找不到任何修订版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 01:49