Skip to content

Instantly share code, notes, and snippets.

@atakigawa
Last active December 22, 2015 12:29
Show Gist options
  • Select an option

  • Save atakigawa/6472764 to your computer and use it in GitHub Desktop.

Select an option

Save atakigawa/6472764 to your computer and use it in GitHub Desktop.
jenkins ios build setup memo
Jenkins on Mac OS X, git, github接続あたりの基本的なセットアップ
install xcode
install git
install jenkins
install git plugin, github plugin, xcode plugin
http://colonelpanic.net/2011/06/jenkins-on-mac-os-x-git-w-ssh-public-key/
http://jiska.hatenablog.jp/entry/2011/11/15/001049
http://megadreams14.com/?p=27
http://sonson.jp/?p=2557
configure jenkins's home directory
sudo dscl . create /Users/jenkins home /Users/Shared/Jenkins/Home/
setup ssh to work with jenkins user
check cmd -> sudo -u jenkins ssh -T hoge@hogehoge.github.com
agree to xcode license agreement
sudo -u jenkins xcodebuild:qa
コンソール出力でダブルバイトが文字化けする
/Library/LaunchDaemons/org.jenkins-ci.plist を見て、
/Library/Application\ Support/Jenkins/jenkins-runner.sh で起動時にargsという変数名で
色々渡してるので、適当なところでargs="$args -Dfile.encoding=UTF-8"を追加してやる. あとは
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
直ってない…
agvtoolが見つからないと言われる
xcrun: error: unable to find utility "agvtool", not a developer tool or in PATH
http://stackoverflow.com/questions/11977648/xcrun-error-failed-to-exec-real-xcrun-no-such-file-or-directory
http://stackoverflow.com/questions/13041525/osx-10-8-xcrun-no-such-file-or-directory
と思いきや、上記は問題なく、jenkinsのxcode pluginのパスを/Applications/Xcode.app/Contents/Developer/usr/bin/xxx
に変えてあげたらいけた
プロジェクトファイルがないと言われる
There are no Xcode project files in this directory. agvtool needs a project to operate.
workspace/job_nameの中身見てプロジェクトファイルがあるとこまでのパスを設定
ジョブの設定で Xcode Project Directory をappに設定
ライセンスを承諾しろと言われる
さっきやったはずだが、もしかするとこれも /Applications/Xcode.app 以下のxcodebuildを呼ばないといけないようだ
You have not agreed to the Xcode license agreements, please run 'xcodebuild -license'''
sudo /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license
code signに失敗する
Code Sign error: The identity 'your code signing identity' doesn't match any valid,
non-expired certificate/private key pair in your keychains
ジョブの設定でUnlock Keychain?にチェックをつける
keychainファイルがないよと言われる
security: SecKeychainUnlock /Users/Shared/Jenkins/Home//Library/Keychains/login.keychain: The specified keychain could not be found.
下記のような感じでファイルを作ってやり、そいつをジョブのKeychain pathとKeychain passwordに設定する
作業はjenkinsユーザで行う
なお、最初リンク先の通りios_devという名前で作ったがjenkinsのジョブのxcodeの設定でkeychainのパス名を変えると
エラったのでおとなしく設定してある名前の通りのファイルを作り直した
http://ankitthakur.wordpress.com/2012/07/02/jenkins-ci-configuration-for-ios-development-with-xcode/
security create-keychain -p login.keychain login.keychain
security default-keychain -s login.keychain
security import /Users/Shared/Jenkins/Home/Library/MobileDevice/ios_development.p12 -k login.keychain -f pkcs12 -A -P yourpassphrase
security import /Users/Shared/Jenkins/Home/Library/MobileDevice/ios_distribution.p12 -k login.keychain -f pkcs12 -A -P yourpassphrase
(/Users/Shared/Jenkins/Home/Library/Keychains/login.keychainが出来上がる)
Provisioning ファイルがないよと言われる
Code Sign error: Provisioning profile 'xxxx-xxxx-xxxx-xxxx-xxxxxxx' can't be found
Custom xcodebuild argumentsに PROVISIONING_PROFILE=xxxx-xxxx-xxxx-xxxx-xxxxxxx とか入力
これでビルド時のprovisioning番号を指定できるっぽい
Code Signing Identityに "your code signing identity" とか入力
ここを入れるとビルドパラメータでCODE_SIGN_IDENTITYとして渡る
Embedded profileに.mobileprovisionファイルの絶対パスを入力
ここ指定してあげないとipaの中に入れる.mobileprovisionがどこにあるか分からない模様
ここを入れてもビルドパラメータでPROVISIONING_PROFILEは指定してくれない
ビルドは成功するが、ipaの出力に失敗する
なんかDebugモードだからかしらんが、存在しないディレクトリに出力しようとしてこけている
ビルド手順でxcodeの前に強引にmkdirを入れてみた
xcodeでclean before buildがついてるとmkdirしても消えるので外してみた
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment