Running Cucumber tests through RVM


I have a project with some cucumber tests for my Ruby application. When I run the rake task for this on my local development box, all works fine, so I know the tests are properly set up in the project.
I'm having a hard time however getting this to work properly on my buildAgent in TeamCity.

I've created a new project for this, and it's connected to the git repository holding the project. Checking out works fine.
I cannot fire up the rake task however with RVM because the buildAgent keeps complaining that he cannot find a specific gemset for the ruby interpreter.
Running the commands on the buildagent itself under the same user as the application work fine, so why can't the build agent do it when instructed by TeamCity?

In the project I have created 2 build configurations.
The first build configuration ensures that the environment is properly set up on the build agent, by running the following commands on command line:

cd %env.checkout_dir%
rvm use 1.9.3
rvm gemset create %env.TEAMCITY_PROJECT_NAME%

The checkout dir defines where the project is being stored, and then I create the gemset for the project. Sufficient to say, this only runs once on the agent.
The project reported success and the gemset actually exists on the build agent when logging.

The second build configuration uses the rake runner and actually fires up the cucumber tests.
The configuration for the rake runner looks like this:

Rake file path:
Rake tasks: run
Ruby interpreter: RVM interpreter: %env.RUBY_VERSION%@%env.TEAMCITY_PROJECT_NAME%
Execute: Only if all previous steps were successful

The ruby version is passed through parameter, the vlaue is 1.9.3
The gemset is also passed as the project name.

When I run the second build configuration, I receive the following error:

Cannot start build runner: Gemset 'auth' isn't defined for Ruby interpreter '1.9.3' or the interpreter doesn't exist or isn't a file or isn't a valid RVM interpreter name.

However, when I got on the box the following is there:
rvm gemset list
gemsets for ruby-1.9.3-p374 (found in /usr/local/rvm/gems/ruby-1.9.3-p374)
=> (default)

So the gemset actually exists, and is usable.
Why does the buildagent not see it?

Message was edited by: Arne De Herdt

Comment actions Permalink

Hello Arne,

What versions of TeamCity and RVM do you use?
Do you use system-wide or mixed rvm installation?

Could you please pause first step and try to use RubyEnvironmentConfigurator?

Comment actions Permalink


I've actually opened a bug ticket for this, because I'm inclined to believe it's actually a problem with the Rake runner on FreeBSD. I don't have the problem for example when running a buildAgent over Ubuntu.
But to answer your question:

TeamCity Professional 7.1.3 (build 24266)
Our RVM installation is installed under the user that is also running the buildAgent software.

I've currently paused the build step and created a new build configuration using Command Line : This works
Creating a build configuration using the Rake Runner and/or the Ruby Configurator does not seem to be working at all, always complaining about the RVM interpreter and the Gemset.


Please sign in to leave a comment.