2014-10-27 30 views
1

我試圖在我的企業內部署實驗Rails應用程序。這裏的所有東西都是爲Java開發設置的,所以我不得不開闢新的天地以獲得對Rails公司的接受。RVM未能爲Jenkins構建加載

我需要在辦公室的CentOS(5.9版本)臨時服務器上使用Jenkins CI(v。1.580)來部署我的Rails 4.1.4應用程序(ruby-2.1.2),以作爲概念證明我的應用程序將被允許靠近生產服務器。

我已經安裝在詹金斯以下插件並重新啓動:哈德森紅寶石插件,RVM,耙插件,紅寶石運行時,RubyMetrics插件詹金斯,GIT客戶端插件,插件GIT,GitHub的API插件,插件GitHub的

在下面輸出的RVM初始化腳本期間,Jenkins構建似乎失敗。

我詹金斯.bashrc文件看起來是這樣的:

#/var/lib/jenkins/.bashrc 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting 

而且.rvmrc:

我試過的摧毀RVM並使用多用戶的指令重新安裝,並確保我的jenkins用戶是rvm組的成員。

我的構建腳本的樣子:

source ~/.bashrc   # Loads RVM 
cd .  # Loads the RVM environment set in the .rvmrc file 
# set env vars 
#export GEM_PATH=/usr/local/lib/ruby/gems/1.2/gems 
#export CI_REPORTS=results 
export RAILS_ENV=test 
#cp config/database.yml.example config/database.yml 
# creates a database.yml 
bundle install   # Installs gems 
rake db:schema:load  # Loads all the database schema 
rake      # Runs RSpec tests 

下面是從詹金斯

完整的控制檯輸出
Started by user Pete 
Building in workspace /var/lib/jenkins/jobs/MerchantManager/workspace 
> git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> git config remote.origin.url https://github.com/***/epgDataPoC# timeout=10 
Fetching upstream changes from https://github.com/***/epgDataPoc 
> git --version # timeout=10 
using .gitcredentials to set credentials 
> git config --local credential.helper store --file=/tmp/git5734173224303904567.credentials # timeout=10 
> git fetch --tags --progress https://github.com/***/epgDataPoc +refs/heads/*:refs/remotes/origin/* 
> git config --local --remove-section credential # timeout=10 
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10 
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 
Checking out Revision 8bced4d8fecd4135bcb4868aa4011e140adf46d3 (refs/remotes/origin/master) 
> git config core.sparsecheckout # timeout=10 
> git checkout -f 8bced4d8fecd4135bcb4868aa4011e140adf46d3 
> git rev-list 8bced4d8fecd4135bcb4868aa4011e140adf46d3 # timeout=10 
[workspace] $ /bin/bash -xe /tmp/hudson1400066644804618273.sh 
+ source /var/lib/jenkins/.bashrc 
++ [[ -s /var/lib/jenkins/.rvm/scripts/rvm ]] 
++ source /var/lib/jenkins/.rvm/scripts/rvm 
+++ builtin test -n '3.2.25(1)-release' -o -n '' 
+++ case "`uname`" in 
++++ uname 
++++ command ps -p 29628 -o ucomm= 
++++ ps -p 29628 -o ucomm= 
+++ __shell_name=bash 
+++ case "$__shell_name" in 
+++ unset __shell_name 
+++ __rvm_has_opt posix 
+++ [[ -n '' ]] 
+++ [[ -n 3.2.25(1)-release ]] 
+++ [[ :braceexpand:errexit:hashall:interactive-comments:xtrace: =~ :posix: ]] 
+++ return 1 
+++ export HOME rvm_prefix rvm_user_install_flag rvm_path 
+++ HOME=/var/lib/jenkins 
+++ [[ -n '' ]] 
++++ umask 
+++ export rvm_stored_umask=0022 
+++ rvm_stored_umask=0022 
+++ (( 0 == 0 )) 
+++ rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") 
+++ [[ -n '' ]] 
+++ for rvmrc in '"${rvm_rvmrc_files[@]}"' 
+++ [[ -f /etc/rvmrc ]] 
+++ GREP_OPTIONS= 
+++ command grep '^\s*rvm .*$' /etc/rvmrc 
Build step 'Execute shell' marked build as failure 
Publishing rails stats report... 
[email protected] 
Finished: FAILURE 
+0

得到同樣的問題在OSX上的優勝美地與RVM 1.26.4 – 2014-12-16 01:35:34

回答

0

我的試驗和錯誤修復此:

通過交換的.bashrc這些行:

#/var/lib/jenkins/.bashrc 
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting 

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

並做以下修改到我的構建腳本:

#!/bin/bash 
source $JENKINS_HOME/.bashrc 
rvm use [email protected] 
# Set "fail on error" in bash 
set -e 
# Do any setup 
# e.g. possibly do 'rake db:migrate db:test:prepare' here 
#cp config/database.example.yml config/database.yml 
bundle install 
rake db:schema:load 
rake 
+0

不幸的是這並沒有爲我工作。 – 2014-12-16 01:34:41