Run Bamboo 6.1 Agent on Mac OS X as a background service to build iOS IPA and Android APK
Bamboo Agent require Java 8 or later, follow the steps:
-
Install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Install Java 8:
brew update brew tap caskroom/versions brew cask install java8
-
Bamboo Agent will use the hostname as it's name to be displayed in Bamboo Server Agent Mangment insterface, to edit the hostname on you machine do the following:
- Apple -> System Prefrence -> Sharing -> Computer Name
- Set a uniqe name in your network, to make it easier to trak the agents later.
- Then execute the folllowing commands to edit the hostname:
scutil --set HostName new_hostname
-
If you need the agent to be always ready to build then you need to set you machine to never to sleep:
- Apple -> System Prefrence -> Energy Server -> Computer Sleep : Never
- Go to your Bamboo server settings -> System -> General Configureation: Make sure Broker client URL is not pointing to localhost, it shoud point to your server ip or hostname
- Make sure the ports 54663m, 443 and 80 in your Bamboo server are open, try to telnet it from the agent host:
telnet BAMBOO-SERVER-IP 54663 telnet BAMBOO-SERVER-IP 443 telnet BAMBOO-SERVER-IP 80
- If you would like to forse agent to use authentication token: Go to your Bamboo server settings -> Agents, click on Enable Authentication Token, then click on Install Remote Agent, copy the token after -t from the command
The app size on Github is larger than 100 MB, you need to use git lfs to clone it to your machine:
brew install git-lfs
git lfs install
git lfs clone https://github.com/Ismail-AlJubbah/mac-osx-service-bamboo-6.1-agent.git
The App contains a configuration file to save Bamboo Server URL and tocken
cd mac-osx-service-bamboo-6.1-agent
vi BambooAgent.app/Contents/Resources/BambooAgent.conf
now edit the value of the variables bamboo_url and bamboo_token to work with your Bamboo Server
On the Mac OSX which will host the agent, do the following:
- Install or Update Xcode from App Store or from Apple Developer Page here
- For each new build plan, install Apple development and release private keys on the Keychain manaully.
- For each new build plan, copy *.mobileprovision to "~/Library/MobileDevice/Provisioning\ Profiles/", if you keep the provisioning profiles in your GIT repo then you can do this step automatically by adding Command Task in the build plan in Bamboo Server.
On the Mac OSX which will host the agent, do the following:
- Install Android SDK:
brew tap caskroom/cask brew cask install android-sdk echo "export ANDROID_HOME=/usr/local/share/android-sdk" >> ~/.bash_profile echo "export PATH=$ANDROID_HOME/platform-tools:$PATH" >> ~/.bash_profile echo "export PATH=$ANDROID_HOME/tools:$PATH" >> ~/.bash_profile
Using Finder, go the repo folder, double click on BambooAgent, this will copy the App to your Application folder and set it to run automatically on login
- Go to LaunchPad and run BambooAgent
- After running the agent go to your Bamboo server settings -> Agents -> Agent authentication: and aprrove the agent request.
- Go to your Bamboo server settings -> Agents -> Online Remote Agent: and wait unit the agent register it self to the server, it may take 2 mins (you may need to refresh the page manually).
- Go to Configure Plan in your plan settings, in Task, click Add task, select Command, and enter the following values:
- Task description: Build APK
- Executable: gradelw
- Argument to build a relase APK: clean assembleRelease
- Environment variables: ANDROID_HOME="/usr/local/share/android-sdk"
- Go to Configure Plan in your plan settings, in Task, click Add task, select XCode, and enter the following values:
- Task description: Build IPA
- Apple SDK: iOS 10.3, run the command xcodebuild -showsdks to get the SDK name in your machine.
- Make sure to enter the values of: Workspace and Scheme.
- Check Build an .ipa for iOS Application Distribution, and fill the values: iOS application path, Development Team and Distribution Method: Application Store.
Run the following commmand to check the agent logs:
tail -f ~/bamboo-agent-home/BambooAgent.log
More information can be found on the following links: