CocoaPods 1.0.1 slowing down builds drastically

Hey everyone,

We recently updated our project from CocoaPods 0.38.2 to 1.0.1 and have noticed a significant increase in build times. Previously, the pod install phase took ~1 minute and since upgrading it is now taking ~7-8 minutes per build. I’m aware of the changes that the CocoaPods team made in 1.0.0 for no longer performing shallow fetches, etc, but there needs to be something done to speed this up. I saw in another post a suggestion that containers come preloaded with the CocoaPods master repo downloaded, which would certainly help. Are there any plans to help mitigate this issue on CircleCI’s end? Does anyone have any good workarounds that they have implemented to counter this problem in the meantime?

Thanks!

-Ryan

2 Likes

Quick update since my original post earlier today…

I implemented a temporary solution, which is certainly helping to mitigate the massive time increase. The workaround is caching the CocoaPods master repo and then updating it to make sure that it is fully up to date before running pod install. Here is a snippet from the relevant portion of our circle.yml file:

dependencies:
  cache_directories:
    # Cache the CocoaPods repos to improve build times.
    - ~/.cocoapods
  override:
    # Install gem dependencies.
    - bundle install
    # Update the cached CocoaPods master repo.
    - bundle exec pod repo update
    # Install iOS library dependencies.
    - bundle exec pod install

With these changes, the pod install phase now takes ~8 seconds, but there are also increases in the amount of time that it takes to retrieve, save, and upload the cache (which adds up to around ~2 minutes in total, since the repo is almost 1GB). Overall though, our build times have been reduced by ~5 minutes.

I am hoping that maybe we can get the CocoaPods master repo preloaded on OS X containers and then automatically updated before the builds begin, which would cut out the increased cache time and need to manually add any of this to the cache. Is this already something that the CircleCI team is investigating?

4 Likes

did anyone from Circle come back to this? Providing the master spec repo would be great

1 Like

Our builds are constantly timing out trying to download the (875MB) CocoaPods master spec repo. Circle could save themselves a lot of bandwidth (and Mac OS CPU cycles) by fixing this issue.

2 Likes

I’d like to add some info to the solution posted by boostworthy:

For this approach to work you need to have bundle exec pod install as an instruction in the override section of dependencies. I had a pod install step in my fastlane configuration which ended up not using the cache.

So if you’re using fastlane: remove the pod installation step from your lane and add it to your circleci config file :slight_smile: