Jump to content

Wikimedia Apps/Team/iOS/CI/ServerSetup

From mediawiki.org

Access Server

[edit]

You will need to access your server, of course. For Wikimedia you can get that information on the Server Access page.. 

For anyone else, you can just access it directly, use SSH, or the Apple Screen Sharing.app

Configure Server

[edit]

Once connected to the server, you need to install various tools to enable continuous integration. Most of the following steps can be performed either through screen sharing or ssh. 

Xcode

[edit]
  • Install Xcode from App Store (must be done via screen sharing)
  • Install the Xcode Command Line Tools by doing one of the following:
    • Launch Xcode app, go to the "Downloads" preference pane, and download the command line tools
    • Run xcode-select --install

Upgrading Xcode

[edit]

Xcode and Command Line Tools can be installed and upgrade through the App Store when using publicly-available versions. If you need a pre-release version of either, download them directly from the SDK section of Apple's developer website. When you upgrade Xcode or Command Line Tools, the machine will be required to restart. After restart occurs, you need to manually sign back in to the OS (via GUI) restore the Jenkins user session. Once signed in, you'll then need to launch Xcode and accept any new Terms and Conditions in order for builds to run without sudo permissions.

Allow remote connections in OS X

[edit]
  • Enable Remote Access
    1. Open the System Preferences > Sharing
    2. Enable Remote Management
    3. Enable File Sharing for directories you will need to access.

Note: AFTER installing OS X Server on the build server, you can also install the OS X Server app on your local machine and connect to it remotely over VPN or while on site.

Install Command Line Tools

[edit]

The following are used to by the build tools, or used to install build tools.

We had problems installing the nokogiri gem on OS X 10.10 Yosemite (required by fastlane), See these Stack Overflow posts for more info:

http://stackoverflow.com/questions/24091869/installing-nokogiri-on-osx-10-10-yosemite

http://stackoverflow.com/questions/26631482/gem-install-nokogiri-v-1-6-3-1-on-os-x-10-10-yosemite-not-installing

What's currently working on Jenkins is to install libxml et. al using Homebrew, then specify the following options:

--with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/libxml2

Install Jenkins

[edit]
  • Install Jenkins via homebrew: brew install jenkins
  • Edit the configuration (Note: If these values don’t exist in the file, add them in the Program Arguments array `<key>ProgramArguments</key>`)
    1. Open the configuration plist in a text editor ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
    2. Modify the http listening address to listen on all ports <string>--httpListenAddress=0.0.0.0</string>
    3. Modify the port (`8080` is recommended) <string>--httpPort=8080</string>
  • Setup as a launch process by running ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
  • Launch Jenkins by running launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
  • Test by opening http://localhost:8080/ in your browser.
  • HAX: (BG) I had to use EnvInject to set some environment variables, even though they're set in the user's shell. There's currently a stale Jenkins bug on this topic, but current hard-coded values are as follows:
    • HOME: /Users/jenkins
    • PATH: /usr/local/bin
    • TERM: xterm-256color
    • BUNDLE_BUILD_NOKOGIRI: --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/libxml2
    • BUNDLE_PATH: vendor/bundle
  • HAX: (BG) If a build is hanging for unclear reasons, VNC/Screenshare to the machine and ensure that the hanging process isn't visually prompting the user for access to the keychain. This might be mitigated by unlocking the keychain manually before jobs start executing.

Setup a Project

[edit]

After you complete the above steps you are ready to configure your project for continuous integration.