Hi Guys,
We’ve recently experienced an issue with our CircleCI deployment pipeline, which has caused me pain for 3 and a half days trying to fix it.
It appears the virtual Circle CI machine running our deployment suddenly stopped using the ruby version installed in the build flow, but rather kept defaulting to the system ruby version which is outdated and therefore wouldn’t allow me to install gems correctly.
I have now implemented a fix for this problem, (using external libraries rbenv and chruby to overwrite the ruby version the shell uses) and added some checks in case the problem occurs in the future. This fix is quite non-trivial and requires alteration of the circle shells bash profile which I never have had to do before.
Was there a release on or around Monday 5th Nov 2018 which has caused this? The only thing I can see which has changed in that time is fastlane released a new gem, but this surely isn’t the cause of this problem. I have below attached our old and new build pipelines for reference.
Please do let me know if I can provide anything else and I look forward to the response. - James
Old:
deploy_ios_dev:
macos:
xcode: "9.0"
environment:
# Sets locale to UTF-8 from https://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ~/repo
- run: brew update
- run: brew install ruby
-run: sudo gem install fastlane -v 2.89.0
# Ovewrite .env.production with .env.dev
# - run: mv .env.dev .env.production
# Build and deploy dev version of iOS app
- run: npm run deploy-ios-dev
New (solution):
deploy_ios_dev:
macos:
xcode: "9.0"
# Shell command necessary or bash scripts below fail
shell: /bin/bash --login -eo pipefail
environment:
# Sets locale to UTF-8 from https://docs.fastlane.tools/getting-started/ios/setup/#set-up-environment-variables
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ~/repo
- run: brew update
# Download & install rbenv and chruby
- run: brew install rbenv ruby-build
- run: brew install chruby
- run: echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# Ensures correct version of ruby is used
- run: rbenv install 2.5.3
- run: echo "ruby-2.5.3" > ~/.ruby-version
- run: which ruby
- run: ruby -v
# SSL check
- run: ruby -ropen-uri -e 'eval open("https://git.io/vQhWq").read'
# Install fastlane
- run: sudo gem install fastlane -v 2.89
- run: fastlane env
# Ovewrite .env.production with .env.dev
# - run: mv .env.dev .env.production
# Build and deploy dev version of iOS app
- run: npm run deploy-ios-dev