Can TC set the Ruby interpreter dynamically?

I've written a build step that sets a TC property based on a value in a file (in this case the jruby interpreter version is being extracted from a Gemfile). I'd like to use this property to configure either the Ruby interpreter in a later Rake build step or to configure the Ruby Environment Configurator interpreter overall. However, in either case, when I set the interpreter to a variable, the configuration expects that variable to be set otherwise no agents are assigned. If I set a default value for that variable, agents will be assigned, but that value will not be overwritten. Any thoughts on if the Ruby interpreter can be set dynamically?

2 comments
Comment actions Permalink

Hello Andy,

We have limited support to dynamically set ruby interpreter version:
Since TeamCity 7.1 you can configure Ruby Environment Configurator to use ruby interpreter version from .rvmrc file.
Since TeamCity 8.0 also rbenv with .rbenv-version files supported.
There also open feature request TW-27688 to support .ruby-version files.

Unfortunately setting interpreter via Bundler (Gemfile) not supported. You may create appropriate feature request in our tracker.

At the same time you could create build configuration (or first step in your configuration) which will read Gemfile and expose required ruby interpreter via 'setParameter' service message. Later you can use that parameter in Ruby Environment Configurator via %% syntax.

0
Comment actions Permalink

Thank you for the idea to use .rvmrc

When I tried using setParameter, my parameter didn't appear to be used in favor of the value set in the run configuration. In addition, this required me to set a default value in the run configuration, otherwise no agents would be assigned because the parameter was missing.

0

Please sign in to leave a comment.