DEV Community

Khoa Pham
Khoa Pham

Posted on

Dealing with updated pod in BuddyBuild

Original post https://github.com/onmyway133/blog/issues/149

We're using BuddyBuild as our CI. Today one of our dependencies gets a sweat update https://github.com/hyperoslo/BarcodeScanner/releases/tag/4.1.1. So we pod update BarcodeScanner in one of our projects that depends on it. All is fine when running locally. So I make a Pull Request and wait for the build to kick off in BuddyBuild.

For some reason, BuddyBuild can't pick up the right version of Cocoapods, hence can't update the new pods.

[!] The version of CocoaPods used to generate the lockfile (1.3.1) is higher than the version of the current executable (1.1.1). Incompatibility issues may arise.

=== CocoaPods ===
104
    Switching CocoaPods version to 1.1.1
105
    Using Command Line: gem cleanup "cocoapods"
106
    Using Command Line: gem uninstall "cocoapods" --all --executables --force
107
    Using Command Line: gem install "cocoapods" --no-rdoc --no-ri --version "1.1.1"
108
    Unpacking caches - cocoapods pod specs
109
    Using Command Line: pod install --no-repo-update
110
    Analyzing dependencies
111
    Pre-downloading: `Tailor` from `https://github.com/zenangst/Tailor`, tag `3.0.0`
112
    [!] Unable to satisfy the following requirements:
113
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
114
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
115
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
116
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
117
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
118
    - `BarcodeScanner (~> 4.0)` required by `Podfile`
119
    - `BarcodeScanner (= 4.1.1)` required by `Podfile.lock`
120
    None of your spec sources contain a spec satisfying the dependencies: `BarcodeScanner (~> 4.0), BarcodeScanner (= 4.1.1)`.
121
    You have either:
122
     * out-of-date source repos which you can update with `pod repo update`.
123
     * mistyped the name or version.
124
     * not added the source repo that hosts the Podspec to your Podfile.
125
    Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
Enter fullscreen mode Exit fullscreen mode

Trying script

So I thought I could run some custom script to force BuddyBuild to update the pods. Start with https://docs.buddybuild.com/builds/custom_build_steps.html

I commit the file buddybuild_postclone.sh with

#!/usr/bin/env bash

pod repo update
pod update BarcodeScanner
Enter fullscreen mode Exit fullscreen mode

Didn't work. I then update the script with

#!/usr/bin/env bash

pod repo remove master
pod setup
pod install
Enter fullscreen mode Exit fullscreen mode

Didn't work. Taking a closer look at the log. I see

Switching CocoaPods version to 1.1.1
Enter fullscreen mode Exit fullscreen mode

It seems BuddyBuild is using cocoapods 1.1.1. Mine is 1.4.0.

Specifying cocoapods version

So I need to specify the correct cocoapods version to make sure I and BuddyBuild are on the same page

gem install bundler
bundler init
Enter fullscreen mode Exit fullscreen mode

And in my Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "cocoapods", '~> 1.0'
Enter fullscreen mode Exit fullscreen mode

Then run

bundler install
Enter fullscreen mode Exit fullscreen mode

And check Gemfile.lock to make sure everything is OK

Finally

Commit the changes, and now BuddyBuild is picking up the right cocoapods version, hence using the new pods



=== CocoaPods ===
45
    Switching CocoaPods version to 1.4.0
46
    Using Command Line: gem cleanup "cocoapods"
47
    Using Command Line: gem uninstall "cocoapods" --all --executables --force
48
    Using Command Line: gem install "cocoapods" --no-rdoc --no-ri --version "1.4.0"
49
    Unpacking caches - cocoapods pod specs
50
    Using Command Line: pod install --no-repo-update
Enter fullscreen mode Exit fullscreen mode

Discussion (0)