As far as I can tell, the RVM ruby environment configurator is completely broken. Here's how I have it configured:
RVM is installed and that ruby + gemset combination exists. Here's what happens when I trigger a build:
As you can see, it's using the system ruby (see Evergreen_Example_Continuous_Integration_17.log for the whole thing).
Note that the system ruby is my rvm default (rvm use system --default). When I switch the rvm defaul to ruby-1.9.2 and restart teamcity, ruby -v returns 1.9.2.
What exactly does the the RVM ruby environment configurator do if it's not doing what I would expect here?
I found a work around using rvm-shell:
rvm-shell will look for a .rmvrc and runs the specified command using the correct ruby environment. See the attached log to see what it looks like when it's working.
Note that I removed the build feature, since it didn't seem like it was doing anything. It would be great to see teamcity just work with .rvmrc files.
Sorry for a long time to reply. Indeed it is a regression and Ruby env build feature was broken between 6.0.3 and 6.5 releases. Due to bug the feature doesn't set necessary ENV variables for cmdline runner. I've already fixed the regression, fix will be available in 6.5 bug fix update. As your original bug (http://youtrack.jetbrains.net/issue/TW-14803) I couldn't reproduce it in early 6.0.x releases and I'm trying to reproduce it again.
"rvm-shell" is good point, but it doesn't cover all cases. E.g. in "cucmber" gem project .rvmrc file doesn't specify ruby interpreter, only gemset:
# .rvmrc rvm @cucumber --create
Probably 3rd option in build feature may use .rvmrc file and launch process using rvm-shell. What do you think?
Thanks for the response. I'm glad to hear the regression has been fixed. Any idea when 6.5.1 will be available?
Taking a step back, I can describe how I would expect the RVM environment configurator to work. I would expect both the command line and rake runners to completely honor the rvm settings without the need to use rvm-shell (see http://youtrack.jetbrains.net/issue/TW-14803). That's basically saying that I expect both rake and command line runners to work exactly like the real command line when you're using a specific rvm ruby + gemset. I really want to either explicitly set the rvm env (1.9.2-p180@foobar) or tell teamcity to use the settings in .rmvrc (http://youtrack.jetbrains.net/issue/TW-14493).
Ideally, the RVM support would allow me to be completely DRY with regards to ruby and gemset.
Any idea when 6.5.1 will be available?
Bug fix update will be available in a couple of weeks
I would both the command line and rake runners to completely honor the rvm settings without the need to use rvm-shell (see http://youtrack.jetbrains.net/issue/TW-14803).
I'm going to play with it a bit, in case of success I will inform you
I've played a bit with .rvmrc support. I don't want to redirect all execution to rvm-shell because people use rake runner not only for Ruby projects, also for some .NET projects. So such people may want to pass rvm environment not only to CommandLine and Rake build runners, but also to some other runners type. So general solution is to fetch all environment variables using rvm-shell script and then pass it to all build steps. As far as I understand such rvm-shell emulation has the same behaviour as commands redirecting to rvm-shell script.
So Ruby env configurator build feature will provide 3 ways for specifing interpreter
1. ruby interpreter path (e.g. for Windows guys)
2. rvm sdk & gemset name (for those how don't want use .rvmrc settings, e.g. to run tests on different ruby interpreters instead of hardcoded in .rvmrc file) Here most likely I'll replace current implementation with rvm-shell environment variables way
3. .rvmrc (TC will fetch env variable using rvm-shell and will pass it to all build steps)
3rd way is DRY but not flexible, you miss some advantages of CI because better to run tests on different interpreters.
P.S: rvm-shell support will be added only in 6.5.2 or later. 6.5.1 is almost ready and it includes fix for regression in passing ruby env. build feature settings to cmdline build runner.