详细的安装过程网上很多教程,这里就不在叙述,只记录一点遇到的问题。
问题一:拉取git源码提示的错误
ERROR: Error fetching remote repo 'origin'
-
关于源码,我用的gitlab的,gitlab上面ssh处添加.ssh/id_rsa的公钥
- jenkins写完仓库地址后
git@111.11.11.11:ixxxx.git
点击下面Credentials的Add添加如下格式,然后Credentials选择刚才的配置
问题二:钥匙串keychain和描述文件 Provisioning profile错误
安装插件
到Jenkins系统管理中找到它
到
/Users/用户名/Library/Keychains/login.keychain
找到login.keychain
或者login.keychain-db
上传,如果是login.keychain-db
建议复制一份为login.keychain
然后上传,因为上传要求的文件后缀为keychain
或者描述文件。
如果还有keychain错误就到
/Users/用户名/Library/Keychains/login.keychain
拷贝到
/Users/Shared/Jenkins/Library/Keychains
目录下,没有就一级级创建出来。
如果报描述文件不匹配找不到之类的就到
/Users/用户名/Library/MobileDevice/Provisioning\ Profiles
拷贝里面的描述文件到
/Users/Shared/Jenkins/Library/MobileDevice/Provisioning\ Profiles
目录下,没有就一级级创建出来。
还不懂的话可以参考此插件的一些
Keychains and Provisioning Profiles使用说明
问题三:CopyPNGFile failed或者Can't exec Usage: xcscontrol
具体错误如下
CopyPNGFile build/Debug-iphoneos/CloudShop.app/Menu_MyEarnings@3x.png Resources/Images/Menu_MyEarnings@3x.png
cd /Users/Shared/Jenkins/Home/jobs/test/workspace
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/usr/bin/copypng -compress -strip-PNG-text /Users/Shared/Jenkins/Home/jobs/test/workspace/Resources/Images/Menu_MyEarnings@3x.png /Users/Shared/Jenkins/Home/jobs/test/workspace/build/Debug-iphoneos/CloudShop.app/Menu_MyEarnings@3x.png
execvP: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin: path too long
execvP: /Applications/Xcode.app/Contents/Developer/usr/bin: path too long
execvP: /usr/bin: path too long
execvP: /bin: path too long
execvP: /usr/sbin: path too long
execvP: /sbin: path too long
Can't exec "Usage: xcscontrol
-h, --help, --usage Prints usage information for xcscontrol
--version Displays version information
--preflight
The following build commands failed:
CopyPNGFile build/Debug-iphoneos/CloudShop.app/Menu_MyEarnings@3x.png Resources/Images/Menu_MyEarnings@3x.png
CopyPNGFile build/Debug-iphoneos/CloudShop.app/Menu_Recommend_Add@2x.png Resources/Images/Menu_Recommend_Add@2x.png
CopyPNGFile build/Debug-iphoneos/CloudShop.app/Menu_Settings@2x.png Resources/Images/Menu_Settings@2x.png
CopyPNGFile build/Debug-iphoneos/CloudShop.app/tabBarItemNoticeSel@3x.png Resources/Images/tabBarItemNoticeSel@3x.png
删除Xcode目录下的xcscontrol
/Applications/Xcode.app/Contents/Developer/usr/bin/xcscontrol
问题四:xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
Xcode升级到8.3后 用命令进行打包 提示下面这个错误。后面根据对比发现新版的Xcode少了这个PackageApplication
先去找个旧版的Xcode里面copy一份过来
放到下面这个目录:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
然后执行命令
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
chmod +x /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication
最后附上PackageApplication下载地址PackageApplication下载地址
问题五:Jenkins上git出现Timeout的问题
jenkins上现有的git插件并没有配置超时的选项,因此在clone项目时如果网络差会出现“ERROR: Timeout after 10 minutes”,导致无法继续构建。
网上找到一个解决方法:http://jenkins-ci.361315.n4.nabble.com/Windows-git-plugin-git-client-plugin-problems-td4690288.html
启动Jenkins的时候加上
-Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60
java -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 -jar /usr/local/Cellar/jenkins/2.70/libexec/jenkins.war
war版的,改下tomcat的启动配置。
对于安装版,需要修改Jenkins安装目录下的jenkins.xml,在arguments中增加该参数。例如:
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
配置后重启Jenkins,再次进行构建,超时设置便为60。
问题五:keys_to_symbols':[31m[!] undefined method `each_with_object' for nil:NilClass[0m (NoMethodError)
Xcode打包生成的ExportOptions.plist 拷贝到
~/.jenkins/workspace/工程名/