“hg” Jenkins Mercurial 插件调用时找不到

发布于 2024-11-25 21:38:18 字数 2915 浏览 0 评论 0原文

基本上,这是我得到的日志:

由用户 dontcare4free 启动

$ hg clone --rev default ssh://[电子邮件受保护]/dontcare4free/我的存储库/var/lib/jenkins/workspace/Custom-MC-Server

* 导入扩展 hgext.imerge 失败:没有名为 imerge 的模块
远程:主机密钥验证失败。
中止:远程 hg 没有合适的响应!
错误:无法克隆 ssh://
[电子邮件受保护]/dontcare4free/我的存储库
[自定义 MC-服务器] $ hg log --rev 。 --模板{节点}
java.io.IOException:无法运行程序“hg”(在目录“/var/lib/jenkins/workspace/My-Repository”中):java.io.IOException:错误= 2,没有这样的文件或目录
在 java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
在 hudson.Proc$LocalProc.(Proc.java:244)
在 hudson.Proc$LocalProc.(Proc.java:216)
在 hudson.Launcher$LocalLauncher.launch(Launcher.java:698)
在 hudson.Launcher$ProcStarter.start(Launcher.java:329)
在 hudson.Launcher$ProcStarter.join(Launcher.java:336)
在 hudson.plugins.mercurial.MercurialSCM.joinWithPossibleTimeout(MercurialSCM.java:299)
在 hudson.plugins.mercurial.HgExe.popen(HgExe.java:191)
在 hudson.plugins.mercurial.HgExe.tip(HgExe.java:171)
>hudson.plugins.mercurial.MercurialSCM.calcRevisionsFromBuild(MercurialSCM.java:255)
在 hudson.scm.SCM._calcRevisionsFromBuild(SCM.java:304)
在 hudson.model.AbstractProject.calcPollingBaseline(AbstractProject.java:1205)
在 hudson.model.AbstractProject.checkout(AbstractProject.java:1194)
在 hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:555)
在 hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:443)
在 hudson.model.Run.run(Run.java:1376)
在 hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
在 hudson.model.ResourceController.execute(ResourceController.java:88)
在 hudson.model.Executor.run(Executor.java:175)
引起原因:java.io.IOException:java.io.IOException:错误= 2,没有这样的文件或目录
在 java.lang.UNIXProcess.(UNIXProcess.java:164)
在 java.lang.ProcessImpl.start(ProcessImpl.java:81)
在 java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 18 更多
Jabber 通知程序插件:发送通知至:-snip-
Jabber 通知程序插件:通知嫌疑人
Jabber 通知程序插件:通知罪魁祸首
通知上游项目工作完成
完成:失败

据我所知,这意味着它找不到 hg 可执行文件。但是,当我尝试在禁用 Mercurial 集成的情况下将 hg 作为构建步骤(shell 执行)执行时,我没有收到此类错误。

我尝试过更改或不更改安装目录和可执行文件,甚至尝试过从源代码手动编译(好吧,无论有什么)Mercurial,但都无济于事。

编辑:愚蠢的我。我完全误读了日志。这个问题与根本找不到 hg 可执行文件无关,但实际上是因为我忘记正确设置我的密钥。

Basically, this is the log I get:

Started by user dontcare4free

$ hg clone --rev default ssh://[email protected]/dontcare4free/my-repository /var/lib/jenkins/workspace/Custom-MC-Server

* failed to import extension hgext.imerge: No module named imerge
remote: Host key verification failed.
abort: no suitable response from remote hg!
ERROR: Failed to clone ssh://[email protected]/dontcare4free/my-repository
[Custom-MC-Server] $ hg log --rev . --template {node}
java.io.IOException: Cannot run program "hg" (in directory "/var/lib/jenkins/workspace/My-Repository"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:698)
at hudson.Launcher$ProcStarter.start(Launcher.java:329)
at hudson.Launcher$ProcStarter.join(Launcher.java:336)
at hudson.plugins.mercurial.MercurialSCM.joinWithPossibleTimeout(MercurialSCM.java:299)
at hudson.plugins.mercurial.HgExe.popen(HgExe.java:191)
at hudson.plugins.mercurial.HgExe.tip(HgExe.java:171)
at >hudson.plugins.mercurial.MercurialSCM.calcRevisionsFromBuild(MercurialSCM.java:255)
at hudson.scm.SCM._calcRevisionsFromBuild(SCM.java:304)
at hudson.model.AbstractProject.calcPollingBaseline(AbstractProject.java:1205)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1194)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:555)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:443)
at hudson.model.Run.run(Run.java:1376)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 18 more
Jabber notifier plugin: Sending notification to: -snip-
Jabber notifier plugin: Notifying suspects
Jabber notifier plugin: Notifying culprits
Notifying upstream projects of job completion
Finished: FAILURE

As far as I can see this means that it can't find the hg executable. However, I get no such errors when I try executing hg as a build step (shell execute) with Mercurial integration disabled.

I've tried with and without changing installation directory and executable and I've even tried compiling (well, whatever of that there is) Mercurial manually from source, all to no avail.

EDIT: Silly me. I completely misread the log. The issue is not related to it not finding the hg executable at all, but it's actually because I forgot to set up my key properly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

弃爱 2024-12-02 21:38:18

检查 http://localhost:8080/systemInfo 环境变量 > PATH 显示“/usr/bin:/bin:/usr/sbin:/sbin”。我无法确定为什么詹金斯看到的都是这些。当以守护程序配置用户身份登录时,我会得到一组更大的路径。

我能够通过创建 hg 的符号链接来帮助 Mercurial 插件找到“hg”。

sudo ln -s /usr/local/bin/hg /usr/bin/hg 

我尝试将以下内容添加到 /etc/profile (我重新启动以防万一)

PATH=$PATH:/usr/local/bin
export PATH

我通过在终端中输入来验证这是否修改了我的路径

echo $PATH

。然而,这条路径没有出现在 Jenkins 中,

我可以使用符号链接解决方案,但我真的很想了解 Jenkins 从哪里获取其路径。

Inspecting http://localhost:8080/systemInfo Environment Variables > PATH displays "/usr/bin:/bin:/usr/sbin:/sbin". I can't determine why this is all that Jenkins sees. When logging in as the daemon configured user, I get a much larger set of paths.

I was able to help the Mercurial Plug-in find "hg" by creating a symlink to hg.

sudo ln -s /usr/local/bin/hg /usr/bin/hg 

I tried adding the following to /etc/profile (I restarted just in case)

PATH=$PATH:/usr/local/bin
export PATH

I verified that this modified my path by typing

echo $PATH

in Terminal. However, this path did not show up in Jenkins

I am able to work with the sym link solution but I'd really like to understand where Jenkins gets its Path.

欢烬 2024-12-02 21:38:18

Nullable 是对的,问题不是找不到 hg 可执行文件,而是 jenkins 用户没有公钥。

解决方案如下:

  1. 以 jenkins 用户身份登录
  2. 确保 jenkins 用户有一个公共 ssh 密钥,该密钥应位于 .ssh/id_rsa.pub
  3. 如果没有,请使用 ssh-keygen 生成一个并不要指定密码
  4. 问题 cat .ssh/id_rsa.pub,复制输出。
  5. 登录bitbucket或github,将刚刚复制的公钥添加到您的帐户中
  6. 再试一次!

希望有帮助,祝有这个问题的人好运。

Nullable is right, the issue isn't that the hg executable can't be found, but rather that the jenkins user doesn't have a public key.

The solution is as follows:

  1. Log in as the jenkins user
  2. Make sure the jenkins user has a public ssh key, which should be in .ssh/id_rsa.pub
  3. If not, generate one using ssh-keygen and don't specify a passphrase
  4. Issue cat .ssh/id_rsa.pub, copy the output.
  5. Log into bitbucket or github, add the public key you just copied into your account
  6. Try again!

Hope that helps, best of luck to anyone with this issue.

生活了然无味 2024-12-02 21:38:18

我的第一个想法是你应该检查jenkins设置中hg可执行文件的路径,如果有这样的选项,它可能没有指向正确的路径。

如果这没有帮助,请确保 hg 在 PATH 中。

看起来可能需要根据此页面进行一些设置 http://www.pixelastic.com/blog/162:failed-to-import-extension-hgext-imerge-warning-on-dreamhost

也许可以解决你的问题吗?

My first thought would be that you should check the path to the hg executable in jenkins set up, if there is such an option, it may not point to the correct path.

If that doesn't help, make sure hg is on the PATH.

Looks like there might be some set up required according to this page http://www.pixelastic.com/blog/162:failed-to-import-extension-hgext-imerge-warning-on-dreamhost

Maybe that can fix your issue?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文