Jenkins 的 Gerrit 触发器找不到任何要构建的修订

2024-05-02

我在使用 Jenkins+Gerrit 时遇到问题。

这是我到目前为止得到的:

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

  • 我用过这个:Jenkins:Gerrit 触发器问题的设置 https://stackoverflow.com/questions/7582331/jenkins-settings-for-gerrit-trigger-problems也能够“手动”启动它。

  • 至于我的配置,我有 像这样的东西:https://stackoverflow.com/a/18347982/2248987 https://stackoverflow.com/a/18347982/2248987。分支说明符为 $GERRIT_BRANCH,参考规范为 $GERRIT_REFSPEC

  • Gerrit 和 Git 各自的工作都很好。访问似乎也还可以。

这是我的问题。构建时(gerrit触发或手动),日志输出为:

 > 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

我被这条消息困住了,尝试了空仓库、非空仓库,以及带有或不带有“审查中”变更集


我曾经遇到过这个问题,我想我现在已经解决了它,我责怪 Jenkins UI 隐藏了一些基本的配置元素;)

这是修复之前我的 Jenkins 构建的输出:

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

您需要打开构建配置并转到“源代码管理”部分,如下所示:

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

现在您可以在此处输入您的参考规范:$GERRIT_REFSPEC

现在,要么重新触发失败的构建,要么放弃审核并提交新的审核,它应该可以正常工作。

现在我们有了适当的 refspec,这是 Jenkins 作业的输出:

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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Jenkins 的 Gerrit 触发器找不到任何要构建的修订 的相关文章

  • Windows 版 GitKraken 中的文件名太长

    正如建议的Q22575737 https stackoverflow com a 22575737 6623589 我已经更新了我的注册表并设置了git config system core longpaths true在处理长路径时 问题
  • 有没有办法缓存 https 凭据以推送提交?

    我最近转而将我的存储库同步到 GitHub 上的 https 由于防火墙问题 并且每次都要求输入密码 有没有办法缓存凭据 而不是每次都进行身份验证git push 自 Git 1 7 9 2012 年发布 以来 Git 中有一个巧妙的机制可
  • git 预提交钩子格式代码 - Intellij/Android Studio

    本要点展示了如何在预提交时使用 Eclipse 格式化程序自动格式化 Java 代码 Source https gist github com ktoso 708972 https gist github com ktoso 708972
  • 无法使用 git 配置文件进行 ssh

    我知道它被问了很多次 但我无法得到我的问题的答案 我正在尝试使用配置文件 ssh 到系统 配置文件是 Host qa HostName 10 218 70 345 User user IdentityFile C Users bean ss
  • 重新打包存储库对于大型二进制文件有用吗?

    我正在尝试将大量历史记录从 Perforce 转换为 Git 并且一个文件夹 现在是 git 分支 包含大量大型二进制文件 我的问题是运行时内存不足git gc aggressive 我的主要问题是重新打包存储库是否可能对大型二进制文件产生
  • 推送时发生 Git 错误 - update_ref 失败

    当我尝试推送本地提交时遇到问题 这可能是在 Android Studio 崩溃时发生的 这是错误 update ref 引用 refs remotes origin master 失败 无法锁定 ref refs remotes origi
  • 远程测试时如何搭建git开发环境

    这似乎是一个愚蠢的问题 但我觉得我对 GIT 相当了解 但我似乎无法按照我的意愿设置我的开发环境 我要么错过了一些非常简单的东西 要么我做错了 我在我的服务器上初始化了一个裸 git 存储库 将其克隆到我的本地计算机 提交我的文件并推送到原
  • Jenkins:在管道 Jenkins 文件内执行 AWS CLI 命令

    您知道如何在 aws 中执行 AWS CLI 命令吗 Jenkinsfile为了建立管道 我没有找到任何插件 首先 您需要在服务器上安装 aws cli 并确保 jenkins 用户有权运行它 或者在创建 EC2 实例时简单地使用 Amaz
  • 有没有办法让 git flow 显示它在幕后执行的命令?

    有什么方法可以让 git flow 提前告诉我当我执行 flow 命令时它将执行的确切 git 命令吗 或者告诉我它是东吗 我只能看到输出和摘要吗 你可以使用Git的GIT TRACE 环境变量 http git scm com docs
  • 使用 zip 实用程序从工作区目录中压缩多个文件/文件夹

    我们有一个 Jenkins 管道 我想压缩位于工作区中多个目录中的多个文件 py 和 cfg 有没有一种方法可以将多个值传递给dirzip 方法的选项 zip zipFile package zip dir WORKSPACE infra
  • 如何在 Jenkins 声明式管道中设置 PATH

    在 Jenkins 脚本化管道中 您可以像这样设置 PATH 环境变量 node git url https github com jglick simple maven project with tests git withEnv PAT
  • 自动将所有 GitHub 存储库镜像到 gitlab

    对于 GitLab 必须手动为每个存储库设置拉 推镜像 我想知道那里有any way可以自动将所有 Github 存储库同步到 GitLab 这样 当您在 GitHub 中创建新的存储库时 GitLab 中的存储库将自动创建 并充当拉取镜像
  • Jenkins + Gradle + Artifactory:无法读取生成的构建信息

    我正在尝试使用 Jenkins Pipeline 调用 Gradle 工具 将我的工件推送到 Artifactory 我正在关注 GitHub 上发布的示例 Example1 https github com JFrogDev projec
  • git 匹配多个单词的标签

    我们可以得到最后一个 git 标签 它以一个单词 例如 TEST 开头 如下所示 git describe tag dirty match TEST 我想知道如何获得最后一个以 word1 开头的标签orword2 例如测试OR跑步 我尝试
  • Composer 用于下载私有 GitHub 存储库

    我无法使用 Composer 下载 github 私人存储库 php composer phar update 我收到以下错误 The https api github com repos company private1 https ap
  • .gitconfig 别名函数调用

    我在 gitconfig 中定义了以下别名 alias teamcity tc tc是我在我的中定义的一个shell函数 bashrc文件 由于某种原因 我收到以下错误 aafghani 03 git workday amirafghani
  • Jenkins 和 Github 不使用 SSH 密钥

    我已将 Jenkins 设置为从 Github 上的私有存储库中提取特定作业 尽管我已经生成了私钥 公钥并将其作为部署密钥添加到 github 但 Jenkins 似乎并未使用 SSH 密钥 当我从 Jenkins 用户进行 git clo
  • Ansible bitbucket 克隆存储库配置 ssh 错误

    我之前发布过这个问题 但那里的答案不再有效 总之 当使用 Ansible 配置我的 vagrant box 时 在尝试使用 ssh 克隆我的 bitbucket 私有存储库时 我遇到了一个神秘的错误 该错误指出 权限被拒绝 公钥 然而 如果
  • Jenkins 可以检测到任何 svn 用户每次提交代码吗?

    Jenkins 可以检测到任何 svn 用户每次提交代码吗 我想知道每次 Jenkins 提交 svn user 时 有什么方法或 jenkins 插件吗 现在我用svn updateJenkins 中的 cmd 来更新 svn 您可以按照
  • 在 Windows 7 上的 Sourcetree 中比较 Word docx 文件

    我一直在尝试获取在 Windows 7 上的 Sourcetree 中工作的 Word docx 文件的文本差异 我已按照此处的说明进行操作将 Microsoft Word 与 git 结合使用 http blog martinfenner

随机推荐