Fast lane and ruby versions

Hi,

I’m trying to build my android project using fastlane and buildkite. As my build machine is running on Mac OS Mojave, I have installed rbenv and have set the ruby version to 2.7.3. On terminal when i check the ruby version it shows 2.7.3 and appears like its all good.

I was also able to run the fastlane build locally in the build machine.

However, when i run the same command via buildkite, it stops at the error

“commander-4.6.0 requires ruby version >= 2.4, which is incompatible with the current version , ruby 2.3.7”

How do i get buildkite to pick the ruby version set in in ./bash_profile?

Thanks,

Hi there!

It depends on how you’ve configured things a little bit.

Are you running your Buildkite Agent as a different user - might they have a different bash profile?

Have you placed the rbenv configuration in a file which will be sourced by bash for a non-interactive session? Bash will behave slightly differently when you open a terminal versus when it is run by another process. I think bash_profile is only run for interactive login sessions. Could you try adding the rbenv configuration to your bashrc as well / instead?

For some context:

Thanks for your response. I set command on ~/.bashrc, however that didnt help.

if which rbenv > /dev/null; then evan "$(rbenv init -)"; fi

What you mentioned makes sense, just dont know how to get buildkite pick the right ruby version.

Maybe add some more diagnostic output, while you’re figuring it out?

# in bashrc
echo "--- Setting up rbenv"
if which rbenv > /dev/null; then
  echo "Found rbenv at $(which rbenv), configuring"
  eval "$(rbenv init -)"

  echo "Ruby versions available:"
  rbenv versions
else
  echo "Couldn't find rbenv! Is your PATH right?"
  echo "${PATH}"
fi

It’s common to install rbenv with homebrew. It might be installed into a homebrew location which isn’t on the default path. Homebrew users usually also put the homebrew path into $PATH using bash_profile. So many sure you’re setting up your PATH in bashrc as well, if you need.