jenkins持续集成iOS开发
Posted iOSGeniusDev
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jenkins持续集成iOS开发相关的知识,希望对你有一定的参考价值。
使用模式:master(用linux搭建主jenkins)+slave(mac作为从jenkins)
先搭建slave:
jdk最新版(1.8)
jenkins.war
通过终端启动jenkins:
cd users/bbk/Documents/jenkins
java -jar jenkins.war —httpPort=8888
主master连接从slave:
设置启动slave方式:比如,launch slave agents via java Web Start
在slave端配置:
slave-agent.jnlp
slave.jar
从slave终端启动:
java -jar slave.jar -jnlpUrl http://172.28.10.222:8080/computer/mac%20for%20ios/slave-agent.jnlp -secret 355dc5d3c9cf663b4a345889447867c5932ba02573793c1826f4b03ca320faea
jenkins 配置插件clang static analyser(v276)
在master中jenkins中系统管理安装Clang;
在slave中安装Clang;(如果需要在slave中静态扫描代码);
在master中的节点配置中设置添加
错误处理:
1. Code Sign error: No matching codesigning identity found: No codesigning identities
The core reason is Jenkins is running as daemon mode in Mac, just assume it is a different user - "Jenkins", so it will not have access to the keychain or provision profile as a you login using your credentials, which cause the code signing issue.
I found I have following 2 errors
2. "Code Sign error: There are no valid certificate/private key pairs in the default keychain"
Solution: Copy your iPhone developer certificate from "login" keychain to "System" keychain.
Detailed steps:
open the "Keychain Access" application, click the login tab, right click the certificate like "iPhone Developer: your_name (XXXXXXX)", choose copy, then click the "System" tab, right click mouse, choose "Paste 2 items"; you might need to do the same thing with the certificate like "iPhone Distribution: your_name".
使用这种方法之后,需要设置其他app可以访问
After doing this, you will get the second error.
3. "Code Sign error: Provisioning profile 'xxxxx-xxxx-xxxx-xxxxx' can't be found"
Solution: Copy the provision profile to Jenkins user folder.
The provision profile is under in the folder
/YourUserName/Library/MobileDevice/Provisioning Profiles,
for example in my machine, the provision profile files are under /Users/steve/Library/MobileDevice/Provisioning Profiles
In the mac, the Jenkins will be in /Users/Shared/Jenkins, create the following folder:
/Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profile, then copy the .mobileprovision file to this folder.
After doing this, the code signing issues will be fixed. Hope my finding will be helpful to other Jenkins users.
使用SSH连接Git服务器
添加生成的ssh 私有key和公有key到~/.ssh/路径下;
把ssh添加到钥匙串
ssh-add -K ~/.ssh/private-key-name
设置Credentials使用直接输入私钥方式
配置XCode中证书
安装插件:Keychains and Provisioning Profiles Management
以上是关于jenkins持续集成iOS开发的主要内容,如果未能解决你的问题,请参考以下文章
占坑!利用 JenKins 持续集成 iOS 项目时遇到的问题