Pod Install in Xcode Bots Trigger

Pod Install in Xcode Bots Trigger

I had the trigger run a script on the build server that did the pod install.

So make a shell script on your build server that has the following:

#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}"
pwd
~/.rvm/wrappers/ruby-2.2.3@global/pod install

Remember to use the 'sh' suffix when naming the script. And then in your bot trigger run the script like this

sh ~/Path/to/Scripts/podUpdateHack.sh

Kind of silly but it works, ¯\_(ツ)_/¯ Oh yeah all those dumb evals are there because the BS_SRCROOT is an environment variable on XCode bots, which references the environment variable $XCS_PRIMARY_REPO_DIR. You can just replace it with $XCS_PRIMARY_REPO_DIR and remove the eval. I don't remember who defines PODS_DIR that might be from the workspace and BS_EXECUTABLE_NAME is a redefinition of the executable name from the project since it doesn't exist at this point in time.

Hope that helps homie.

continuous integration with XCode bots and cocoapods

I made the xCode server work with cocoapods pretty seamlessly, have a look at my article, it may help you.

http://papaanton.com/setting-up-xcode-6-and-apple-server-4-0-for-continues-integration-with-cocoapods/

I do the clean build every time with Pod install.

It maybe the reason.

Xcode server bot: pre Scripts error Trigger Error: Trigger exited with non-zero status 1

Try adding a wait right after you call to pod install. You can add this as a Add Pre-Integration Triggers when you edit your Xcode Server Bot.

#!/bin/sh

# cd to where your Podfile is
cd "${XCS_PRIMARY_REPO_DIR}/ZHXShop/"

# add to the path, or explicitly add the path to your `pod` call
export PATH=/usr/local/bin:$PATH
pod install --verbose --no-repo-update

wait

Notes I found on wait

The wait() function suspends execution of its calling thread until status information is available for a child process or a signal is
received.

Xcode 7 Bot pod install

I needed to reset the Cocoapods repo that is utilized by user _xcsbuildd on my XcodeServer in order to get past the problem noted above. Here's how I did that:

1) On your OS X Server (running XcodeServer), select 'Users' from the Server Window, then right click on '_xcsbuildd' and select 'Advanced Options...'. Change the 'Login shell' from '/bin/false' to '/bin/bash'. (This will allow you to login as user '_xcsbuildd' from a terminal window.)

2) From a terminal window on OS X Server, login as any user. Then, to login as '_xcsbuildd', use sudo su - _xcsbuildd.

3) Remove the Cocoapods repo for user _xcsbuildd using rm -rf ~/.cocoapods.

4) Finally, integrate your BOT from your Xcode development client which will rebuild the Cocoapods repo as part of its before integration trigger step.

(My client environment is OS X 10.11 and Xcode 7.0.1, while my server environment is OS X 10.11, OS X Server 5.0.4, and Xcode 7.0.1. Cocoapods version is 0.38.2)

The following reference was helpful to me: http://honzadvorsky.com/articles/2015-08-17-17-30-xcode_server_tutorials_3_prebuild__postbuild_scripts/.

Xcode Server bot build error

The solution was related to incorrect Cocoapods pre trigger script. The pre trigger script should be

cd YOUR PROJECT FOLDER
/usr/local/bin/pod install
echo "Installing pods"


Related Topics



Leave a reply



Submit