CircleCI 2.0 iOS - Error installing Gems

ios
bundler
circle.yml

#1

Hi folks,

We’re in the process of migrating our iOS build from CircleCI 1.0 to 2.0 and are running into a problem with installing gems.

When we try to run bundle install we get the following output:

Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
Exited with code 17

Our Gemfile is as follows:

source "https://rubygems.org"

gem 'fastlane', '2.93.1'
gem 'cocoapods'
gem 'cocoapods-bugsnag'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Our circle-ci config is as follows:

  deploy_systest:
    macos:
      xcode: "9.0"

    parallelism: 1

    working_directory: ~/[ REDACTED ]/apps

    environment:
      BUNDLE_PATH: ./ios/vendor/bundle

    steps:
      - checkout

      - restore_cache:
          keys:
            - v1-dep-{{ .Branch }}-
            - v1-dep-master-
            - v1-dep-

      - run: brew update

      - run: brew install imagemagick

      - run:
          name: Install Gems
          working_directory: ./ios
          command: |
            pwd
            bundle check || bundle install --path vendor/bundle

      - run:
          name: Install CocoaPods
          working_directory: ./ios
          command: |
            curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
            pwd
            pod install

      - save_cache:
          key: v1-dep-{{ .Branch }}-{{ epoch }}
          paths:
            - ./node_modules
            - ./ios/Pods
            - ./ios/vendor/bundle

      - run:
          working_directory: ./ios
          command: |
            pwd
            bundle exec fastlane systest

Any help would be much appreciated! :slight_smile:

Cheers,
Matt


#2

I’m having the exact same issue. Bundle install is failing, seemingly unrelated to the contents of our gemfile.

Any help would be appreciated!


#3

After some experimentation, i had to change the https at the top of my gemfile to http. This technically works, but I don’t like the fact that I have to use bundle over insecure HTTP! I hope this gets fixed soon


#4

I experienced same error.
It turns out that the “RubyGems and Bundler TLS/SSL Issues”
https://bundler.io/v1.16/guides/rubygems_tls_ssl_troubleshooting_guide.html#why-am-i-seeing-read-server-hello-a

As a result, RubyGems.org will require TLSv1.2 at minimum starting January 2018. This means RubyGems.org and the gem command will no longer support versions of Ruby and OpenSSL that are do not have support of TLS 1.2.

For CircleCI 2.0 macos vm, we can change ruby version from system to another using chruby.

See https://circleci.com/docs/2.0/testing-ios/#custom-ruby-versions for a solution


#5

Thanks @hiroshi. It was fixed using:

steps:
  - checkout

  # Install CocoaPods
  - run:
      name: Install CocoaPods
      command: pod install

  # Set Ruby version
  - run:
      name: Set Ruby Version
      command:  echo "ruby-2.4" > ~/.ruby-version
  # Install bundles
  - run: bundle install
  # Build the app and run tests
  - run:
      name: Build and run tests
      command: bundle exec fastlane $FASTLANE_LANE

#6

Installing CocoaPods takes a lot of time. Isn’t there another way to solve this?


#7

Continuing the discussion from CircleCI 2.0 iOS - Error installing Gems:

Ruby 2.4 should be the default for iOS projects. The current default just doesn’t work because you’ll get
ssl errors trying to install from https://rubygems.org. And this is nowhere mentioned in the docs.


#8

I’m still having this issue, and the ~/.ruby-version workaround is not working for me. I’m curious if anyone has a working solution.


#9

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.