简体   繁体   English

Jenkins 无法使用自制软件安装运行 rake

[英]Jenkins cannot run rake with homebrew installation

I did following to install jenkins on my Mac for a ruby on rails project with a rspec test suite我做了以下操作,在我的 Mac 上安装了 jenkins,用于带有 rspec 测试套件的 ruby​​ on rails 项目

1- installed with brew 1- 用 brew 安装

2 - started jenkins and installed git/rake/rvm plugins 2 - 启动 jenkins 并安装 git/rake/rvm 插件

3 - managed to run bundle exec spec after installing rails in "/Users/me/.jenkins/workspace/myp-project" 3 - 在“/Users/me/.jenkins/workspace/myp-project”中安装 rails 后设法运行 bundle exec spec

4 - But I am getting an error while running a build on jenkins interface 4 - 但是在 jenkins 界面上运行构建时出现错误

 $ bundle exec rake spec
 FATAL: rake execution failed
 java.io.IOException: Cannot run program "bundle"
 (in directory "/Users/me/.jenkins/workspace/my-project"): error=2, No such file or directory

any pointers how can I fix this ?任何指针我该如何解决这个问题?

I recently faced the same issue When running from Console everything is ok , when running from execute shell all is alright when in Jenkins the Jenkins-man simply could not execute "gem" or "bundler" or X sample :我最近遇到了同样的问题从控制台运行时一切正常,从执行 shell 运行时一切正常,而在 Jenkins 中,Jenkins-man 根本无法执行“gem”或“bundler”或 X 示例:

 18:20:40 Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "bundler" (in directory "/home/builder/lcg-qa-jenkins-slave/workspace/delete_me2/target/src/main"): error=2, No such file or directory 18:20:40 around Ant part ...<exec failonerror="false" dir="target/src/main" executable="bundler">... @ 78:76 in /home/builder/lcg-qa-jenkins-slave/workspace/delete_me2/target/antrun/build-main.xml

The error is totally misleading as the files do exist but for some weird reason cannot pick up executable stuff from /.rbenv/shims.该错误完全具有误导性,因为文件确实存在,但由于某些奇怪的原因无法从 /.rbenv/shims 中获取可执行文件。 I tried uninstalling - reinstalling through numerous official and unofficial rbenv or rvm and each time got the same issue with Jenkins.我尝试卸载 - 通过众多官方和非官方 rbenv 或 rvm 重新安装,每次都遇到与 Jenkins 相同的问题。 Note that this only occurs on Jenkins when Jenkins is executing while works perfect when actually running from the actual Jenkins slave or running localy.请注意,仅当 Jenkins 正在执行时才会在 Jenkins 上发生这种情况,而在实际从实际 Jenkins 从站运行或在本地运行时工作完美。 My issue is solved with getting those executables with simlinks to /usr/bin So when you see jenkins doing the I cant execute thingy.. then symlink the executables:我的问题是通过将带有 simlinks 的可执行文件添加到 /usr/bin 来解决的,所以当你看到 jenkins 执行我无法执行的事情时,然后对可执行文件进行符号链接:

sudo ln -sfn /home/builder/.rbenv/shims/bundler /usr/bin/bundler sudo ln -sfn /home/builder/.rbenv/shims/bundler /usr/bin/bundler

None of the below additions to the 'execute shell' in Jenkins had any effect at all when previous tries:在之前的尝试中,以下对 Jenkins 中的“执行 shell”的添加都没有任何效果:

 ##!/bin/bash #export PATH=$PATH:/usr/local/bin:$HOME/.rbenv/bin:$HOME/.rbenv/shims #eval "$(rbenv init -)" #rbenv local #rbenv rehash #export PATH="$HOME/.rbenv/shims:$PATH" #echo "$PATH" #echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc #echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM