简体   繁体   中英

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. The rake command gives an error of

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. By default Jenkins user login is jenkins.

Check if bundler gem is installed and available to Jenkins user.

Also take a look here: Jenkins Rake Plugin , Jenkins RVM Plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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