简体   繁体   English

詹金斯:运行脚本时的行为有所不同-rake命令使rake中止了!\\ n无法加载此类文件-捆绑器错误

[英]Jenkins: Differing behaviour when running script - rake command gives rake aborted!\ncannot load such file — bundler error

Below is the full content of a script i have that i try to run in Jenkins. 以下是我尝试在Jenkins中运行的脚本的全部内容。 The rake command gives an error of rake命令给出的错误为

rake aborted!\ncannot load such file -- bundler/setup\n/var/www/sponsor1_integration/config/boot.rb:3:in `<top (required)>'\n/var/www/sponsor1_integration/config/application.rb:1:in `<top (required)>'\n/var/www/sponsor1_integration/Rakefile:4:in `<top (required)>'\n(See full trace by running task with --trace)")

Im not sure why this is. 我不确定为什么会这样。 If i log onto server directly and run the command, it executes 如果我直接登录服务器并运行命令,它将执行

Starting process_patient_data_feed.
Finished process_patient_data_feed.

Here is the code. 这是代码。 Is there something environmental i need to do to get this to behave properly via jenkins. 我需要做一些环境工作,以使其通过詹金斯正常运行。

sudo rm -rf /var/www/sponsor1_integration/processed/
sudo rm -rf /var/www/sponsor1_integration/failed/
sudo rm -rf /var/www/sponsor1_integration/to_process
sudo mkdir /var/www/sponsor1_integration/processed/
sudo mkdir /var/www/sponsor1_integration/failed/
sudo mkdir /var/www/sponsor1_integration/to_process
sudo mv /var/lib/jenkins/workspace/test/study-3277_LONGBOAT_20170112_12:37.csv /var/www/sponsor1_integration/to_process
cat /var/www/sponsor1_integration/to_process/study-3277_LONGBOAT_20170112_12:37.csv
sudo chmod 777 /var/www/sponsor1_integration/to_process/study-3277_LONGBOAT_20170112_12:37.csv
sudo chmod 777 /var/www/sponsor1_integration/processed/
sudo chmod 777 /var/www/sponsor1_integration/failed/
sudo chmod 777 /var/www/sponsor1_integration/to_process
cd /var/www/sponsor1_integration/
rake RAILS_ENV=production longboat:process_patient_data_feed_01        search_folder=to_process processed_folder=processed failed_folder=failed
cd /var/www/sponsor1_integration/

You should test script under Jenkins credentials. 您应该在Jenkins凭据下测试脚本。 By default Jenkins user login is jenkins. 默认情况下,Jenkins用户登录名是jenkins。

Check if bundler gem is installed and available to Jenkins user. 检查bundler gem是否已安装并且对Jenkins用户可用。

Also take a look here: Jenkins Rake Plugin , Jenkins RVM Plugin 还可以在这里查看: Jenkins Rake插件Jenkins RVM插件

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

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