如何设置授权 Hudson /Jenkins 来克隆您的 Mercurial 存储库
安装并使用 Mercurial 后,我试图让 Hudson 克隆存储库,以便它可以构建我的项目。
目前以下任务有效。
- 我可以同步到我的外部主机,并且代码显示在该主机上。
现在我正在尝试配置 hudson / jenkins 以访问我的主机上的代码。
但不幸的是,我遇到了一个错误:
Started by user anonymous
$ hg clone --rev default https://bitbucket.org/*/testproject "F:\Hudson\jobs\testproject\workspace"
abort: http authorization required
ERROR: Failed to clone https://bitbucket.org/*/testproject
[workspace] $ hg log --rev . --template {node}
java.io.IOException: Cannot run program "hg" (in directory "F:\Hudson\jobs\testproject\workspace"): CreateProcess error=267, The directory name is invalid
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(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:298)
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:254)
at hudson.scm.SCM._calcRevisionsFromBuild(SCM.java:304)
at hudson.model.AbstractProject.calcPollingBaseline(AbstractProject.java:1186)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1175)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:523)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:418)
at hudson.model.Run.run(Run.java:1362)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 18 more
Finished: FAILURE
我需要执行哪些操作才能告诉 Hudson 使用用户名 x 和密码 y 来访问数据?
已编辑 =>找到了如何集成 ssh 。
After installing and playing around with mercurial , I am trying to get Hudson to clone the repository so it can build my project.
At the moment the following task works.
- I Can sync to my external host and the code shows up on that host.
Now I am trying to configure hudson / jenkins to access the code on my host.
But unfortunately I am rolling on a error:
Started by user anonymous
$ hg clone --rev default https://bitbucket.org/*/testproject "F:\Hudson\jobs\testproject\workspace"
abort: http authorization required
ERROR: Failed to clone https://bitbucket.org/*/testproject
[workspace] $ hg log --rev . --template {node}
java.io.IOException: Cannot run program "hg" (in directory "F:\Hudson\jobs\testproject\workspace"): CreateProcess error=267, The directory name is invalid
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(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:298)
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:254)
at hudson.scm.SCM._calcRevisionsFromBuild(SCM.java:304)
at hudson.model.AbstractProject.calcPollingBaseline(AbstractProject.java:1186)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1175)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:523)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:418)
at hudson.model.Run.run(Run.java:1362)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 18 more
Finished: FAILURE
What actions do i need to do to tell Hudson to use username x and password y to acces the data?
Edited => Found how to integrate ssh .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用 SSH 而不是 https
从 PuTTY 网站下载 putty.exe、puttygen.exe、pageant.exe 和 plink.exe。
启动 puttygen 并生成OPENSSH FORMAT(hudsons 格式)的密钥 (=> 如何使用 Svn + SSH )
单击保存私钥按钮并将 .PPK 文件保存在某处。
单击保存公钥按钮并保存。
转到您的网站并输入公共 ssh 密钥
运行 pageant.exe。选美图标(戴着帽子的计算机)将显示在状态托盘中。
右键单击选美图标并选择添加键。
选择您之前保存的 .PPK 文件并输入其密码。
以下内容(结尾部分是复制的)来自 Ted Naleid(谢谢!)博客女巫,可以在这里找到:将 hudson 连接到您的 ...
这是第一个成功的构建!
结论:这是散布在互联网上的所有小博文的摘要。我希望这篇文章可以帮助您启动 Hudson 和 Mercurial。
Used SSH instead of https
Download putty.exe, puttygen.exe, pageant.exe, and plink.exe from the PuTTY website.
Start puttygen and generate a key in OPENSSH FORMAT (hudsons format) (=> How to use Svn + SSH )
Click the Save private key button and save the .PPK file somewhere.
Click the Save public key button and save it.
Go to your website and enter the public ssh-key
Run pageant.exe. The pageant icon (a computer wearing a hat) will show up in the status tray.
Right-click the pageant icon and choose Add Key.
Choose the .PPK file you saved earlier and type in its passphrase.
The following (end part is copied) from Ted Naleid (Thank you!) blog witch can be found here : Hooking up hudson to your ...
and here it is the first succesfull build !
Conclusion : This is a summary of all the small blogpost scattered arround the internet. I hope this post helps you in starting hudson and mercurial.
我认为问题与用户名和密码无关。您的堆栈跟踪告诉您路径
F:\Hudson\jobs\testproject\workspace
有问题。无论如何,您可以在 URL 中指定用户名和密码,例如:
http://user:[电子邮件受保护]
。I think the problem is not related to username and password. Your stacktrace tells you there's something wrong with the path
F:\Hudson\jobs\testproject\workspace
.Anyway, you can specify the username and password in the URL like:
http://user:[email protected]
.为了使用 BitBucket 验证 Jenkins/Hudson Mercurial 插件,我也发现使用 SSH 协议而不是 HTTPS 很有用,特别是因为:
似乎没有办法使用 Mercurial Jenkins 插件将 HTTPS 凭证存储到 BitBucket ,但是通过 SSH,您可以安全可靠地存储您的凭据
这里提供了有关设置对 BitBucket 的 SSH 访问的良好说明: http://confluence.atlassian.com/display/BITBUCKET/Using+SSH+to+Access+your+Bitbucket+Repository
注意:
如果您在 *nix 服务器上运行 Jenkins/Hudson ,您将希望以运行 Jenkins 进程的用户身份登录,并从该用户主目录执行这些操作,因此该用户将找到配置(例如,在我的 Jenkins 独立安装的 Debian 服务器上,创建了用户“jenkins”)并且主目录设置为“/var/lib/jenkins”[不是 /home/jenkins] - 我在其中执行了上面链接中提供的说明)。
我发现在尝试让 Jenkins 调用之前确保 hg clone 命令在命令行中工作非常有帮助。
重要提示:为了使其正常工作,我必须生成一个没有 ** 密码的密钥 **。
To authenticate the Jenkins/Hudson Mercurial plugin with BitBucket I too found it useful to use the SSH protocol instead of HTTPS particularly since:
there doesn't seem to be a way to store your HTTPS credentials to BitBucket with the Mercurial Jenkins plugin, but with SSH you can safely and securely store your credentials
with SSH you can configure it to use compression, which Mercurial doesn't do natively.
Good instructions for setting up SSH access to BitBucket are available here: http://confluence.atlassian.com/display/BITBUCKET/Using+SSH+to+Access+your+Bitbucket+Repository
Notes:
If you are running Jenkins/Hudson on a *nix server, you will want to login as the user running the Jenkins process and perform these operations from that users home directory, so the configurations will be found by that user (e.g. on my Debian server installation of Jenkins standalone, the user 'jenkins' is created and the home directory is set to '/var/lib/jenkins' [not /home/jenkins] - where I performed the instructions provided at the above link).
I found it very helpful to assure the hg clone command worked from the command line before attempting to have Jenkins call it.
IMPORTANT: In order to get this to work, I had to generate a key ** without ** a passphrase.
您可以将以下行添加到 jenkins .hgrc 文件(通常为 /var/lib/jenkins/.hgrc)
请参阅 http://www.selenic.com/mercurial/hgrc.5.html#auth
You can add the following lines to jenkins .hgrc file (usually /var/lib/jenkins/.hgrc)
See http://www.selenic.com/mercurial/hgrc.5.html#auth
您可以在 Jenkins 的“Credentials”部分添加 scm 凭据:
同时更改作业配置以使用凭据:
You can add your scm credentials in the 'Credentials` section of Jenkins:
Also change the job configuration to use the credentials: