Xcode 12, Mac OS 10.15, Xcode server pre-integration scripts for install cocoapods

263 views Asked by At

I'm new to Xcode server CI, and this is what my pre-integrate script looks like:

#!/bin/sh
#make sure the encoding is correct
export LANG=en_US.UTF-8

# fix the path so Ruby can find it's binaries
export PATH=/usr/local/bin:$PATH
echo "PATH: $PATH"

# update or install depending on what we got
if [ -d ${PODS_DIR} ]; then 
    # pods directory exist
    echo "=================="
    echo "   Delete Pods"
    echo "=================="

    # delete cocoapods files if they exist
    rm -rf "${PODS_DIR}"
    eval rm "${BS_SRCROOT}/Podfile.lock"
    eval rm -rf "${BS_SRCROOT}/${BS_EXECUTABLE_NAME}.workspace"
    echo "Deleted Pods directory ${PODS_DIR}"
    echo "Deleted ${BS_EXECUTABLE_NAME}.workspace"
    echo "Deleted Podfile.lock"
else 
    # no need to delete pod files
    echo "Pods NOT detected at ${PODS_DIR}"
fi

echo "=================="
echo "   Install Pods"
echo "=================="

# make sure we are where we need to be
eval cd "${BS_SRCROOT}"
/usr/local/bin/pod install

After I trigger the integrate, the follow problem show up in the integrate logs:

PATH: /usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
==================
   Delete Pods
==================
rm: /Podfile.lock: No such file or directory
Deleted Pods directory 
Deleted .workspace
Deleted Podfile.lock
==================
   Install Pods
==================
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
    from /usr/local/bin/pod:23:in `<main>'
    from /usr/local/bin/ruby_executable_hooks:24:in `eval'
    from /usr/local/bin/ruby_executable_hooks:24:in `<main>'

I've re-installed the ruby, update rvm to stable, re-installed the cocoapods, none of these move helps

Please, kindly help, thanks in advance

1

There are 1 answers

0
Dung Vu On

you have to install:

gem update --system
gem install bundler
gem install cocoapods
rvm install 2.6.3
rvm --default use 2.6.3

run Xcode Server again :) reference: https://github.com/fastlane/fastlane/issues/15183