1. iOS编译签名文件找不到
Check dependencies
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “75025357-245d-448b-9343-96148a0xxxxx”, however, no such provisioning profile was found.
原因是jenkins以jenkins用户身份运行,iOS项目编译用的签名文件要从安装证书时的用户目录
~/Library/MobileDevice/Provisioning\ Profiles/75025357-245d-448b-9343-96148a0xxxxx.mobileprovision
拷贝到
/Users/Shared/Jenkins/Library/MobileDevice/Provisioning\ Profiles/75025357-245d-448b-9343-96148a0xxxxx.mobileprovision
2. iOS编译证书找不到
Check dependencies
Code Sign error: No codesigning identities found: No codesigning identities (i.e. certificate and private key pairs) that match the provisioning profile specified in your build settings
(“testxxxxx_Distribution_inhouse_01”) were found.
没找到证书,打开“钥匙串访问”,从“登录”拷贝安装的证书到“系统”下
3.User interaction is not allowed.
Signing Identity: “iPhone Distribution: ****************** Co., Ltd.”
Provisioning Profile: “************”
(************-****-****-****-************)
/usr/bin/codesign –force –sign ************************************ –entitlements /Users/Shared/Jenkins/Home/workspace/****/build/**************.build/Release-iphoneos/*************.build/****.***.****–timestamp=none /Users/Shared/Jenkins/Home/workspace/********/build/Release-iphoneos/****.app
/Users/Shared/Jenkins/Home/workspace/*****/build/Release-iphoneos/****.app: User interaction is not allowed.
Command /usr/bin/codesign failed with exit code 1�[0m�[2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━�[0m
�[1m�[31m** BUILD FAILED **�[0m �[2m(89065 ms)�[0m
Build step ‘Execute shell’ marked build as failure
Finished: FAILURE
拷贝~/Library/Keychains/login.keychain到
Users/Shared/Jenkins/Library/Keychains/login.keychain
在jenkins执行编译的脚本中加入命令解锁jenkins的钥匙串
/usr/bin/security unlock-keychain -p pwd ~/Library/Keychains/login.keychain
(执行一次后可将这行代码删除)
4. ssh连接git问题
jenkins连接gitlab需要ssh key
通过命令 ssh-keygen -t rsa -C "xxx@xxx"
生成key
将公钥(~/.ssh/id_rsa.pub)内容拷贝到gitlab-profile setting的SSH KEYS字段
jenkins连接需要私钥(~/.ssh/id_rsa),有两个地方可以添加
a.jenkins用户的Private Key字段(在项目配置-源码管理-Credentials-add中选择SSH Username with private key
b.或者在全局菜单Credentials-Global credentials (unrestricted)中进行管理)