學習 Jenkins 時遇到很多的坑异雁。。恭取。把這些問題記錄下來钞瀑,避免再犯。
Q1
No iOS profile matching '8xxxxxx3@qq.com/yoxxxhu_Distribution' found: Xcode couldn't find a profile
matching '8xxxxxx3@qq.com/yoxxxhu_Distribution'. Install the profile (by dragging and dropping it onto
Xcode's dock item) or select a different one in the General tab of the target editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
A1
- 1.用 Xcode 打開 iOS 項目励幼,在 【TARGETS】 - 【General】 中不勾選
Automatically manage signing
- 2.如圖配置開發(fā)證書:
WX20170602-174826@2x.png
WX20170602-174713@2x.png
- 3.配置完證書之后汰寓,需提交代碼到 Git 遠程倉庫,確保 Jenkins 構建時能獲取最新的證書配置
還要確保已經將 /Users/管理員用戶名/Library 的 MobileDevice 文件夾拷貝到了 /Users/Shared/Jenkins/Library 下面
Q2
FATAL: No global development team or local team ID was configured.
A2
- Team ID 在這里填寫苹粟,如圖:
WX20170602-181236.png
Team ID 應填寫這串字符有滑,如圖:
WX20170602-181556@2x.png
Q3
error: exportArchive: No valid iOS Development signing identities belonging to team CxxxxxxxxF were found.
Error Domain=IDEDistributionErrorDomain Code=1 "No valid iOS Development signing identities
belonging to team CxxxxxxxxF were found."
UserInfo={NSLocalizedDescription=No valid iOS Development signing identities
belonging to team CxxxxxxxxF were found.}
A3
- 1.在 Jenkins - 【系統(tǒng)管理】 - 【Keychains and Provisioning Profiles Management】中重新上傳 login.keychain :
WX20170605-103630@2x.png
- 2.填寫 Code Signing Identity :
WX20170605-104534@2x.png
- 3.重新上傳 mobileprovision 文件并填寫 Provisioning Profiles Directory Path :
WX20170605-103525@2x.png
- 4.點擊 Save 按鈕
Password 是 Mac 開機時輸入的密碼
- 5.重新配置項目,如圖:
WX20170605-105813@2x.png
WX20170605-105837@2x.png
WX20170605-105928@2x.png
WX20170605-105955@2x.png
Q4
No profiles for 'com.Gxxxxxc.SxxxM' were found: Xcode couldn't find a
provisioning profile matching 'com.Gxxxxxc.SxxxM'.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
A4
將 /Users/管理員用戶名/Library 的 MobileDevice 文件夾拷貝到 /Users/Shared/Jenkins/Library 下面
Q5
執(zhí)行自動上傳IPA到蒲公英的腳本時出錯 fastlane: command not found
[H20170531_OCUnit] $ /bin/sh -xe /var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson4176251309376324428.sh
+ IPANAME=H20170531_OCUnit
+ fastlane gym --export_method ad-hoc --output_name H20170531_OCUnit
/var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson4176251309376324428.sh:
line 3: fastlane: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
A5
蒲公英 - 文檔中心的解答:
這個情況一般是由于 jenkins 沒有設置正確的 $PATH 環(huán)境變量導致的嵌削。正確設置的方法為:
- 1.在命令行下執(zhí)行 echo $PATH毛好,記錄下輸出的結果
- 2.在 jenkins 中系統(tǒng)管理-系統(tǒng)設置中,找到 環(huán)境變量(Environment variables)
- 3.在 key 中填寫 $PATH苛秕,在 value 中填寫第一步中輸出的結果
- 4.保存即可
蒲公英 - 文檔中心鏈接: https://www.pgyer.com/doc/view/jenkins_ios
- 但是我按照蒲公英的方法操作之后肌访,還是報這個錯誤 fastlane: command not found
- 待解決 ...
Q6
Check dependencies
The file “Pods-Swarm_swift.release.xcconfig” couldn’t be opened because there is no such file.
(/Users/HW/.jenkins/workspace/SWARM/Pods/Target Support Files/Pods-Swarm_swift/Pods-Swarm_swift.release.xcconfig)
------
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock.
Run 'pod install' or update your CocoaPods installation.
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/HW/Library/Developer/Xcode/
DerivedData/Swarm_swift-gttgnsxyltckdlfnjucunmsdhnyx/Build/Intermediates/ArchiveIntermediates/
Swarm_swift/IntermediateBuildFilesPath/Swarm_swift.build/Release-iphoneos/Swarm_swift.build/
Script-E66BF0AC51C3B26C2CF625AA.sh
A6
- 在構建中添加 pod install 腳本:
#!/bin/bash -l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
pod install --verbose --no-repo-update
此 shell 腳本要放在 Xcode 之前,如圖:
WX20170605-170913.png
Q7
iOS 項目使用了 Cocoapods 時艇劫,執(zhí)行 pod install
腳本報錯:pod: command not found
+ pod install --verbose --no-repo-update
/var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson943803671821413828.sh: line 5:
pod: command not found
Build step 'Execute shell' marked build as failure
A7
修改 shell 腳本如下:
#!/bin/bash -l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
pod install --verbose --no-repo-update
export 語句將控制臺語言環(huán)境設置為 UTF-8 格式吼驶,避免出現(xiàn) Podfile 文件打開錯誤。
Q8
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
A8
如圖:
WX20170605-173713@2x.png
Q9
FATAL: Failed to copy /Users/Shared/Jenkins/Home/kpp_upload/SWARM_Development.mobileprovision to
/Users/HW/Library/MobileDevice/Provisioning Profiles/54xxxxxxxxxxd4.mobileprovision
java.io.FileNotFoundException:
/Users/HW/Library/MobileDevice/Provisioning Profiles/54xxxxxxxxxxd4.mobileprovision
A9
- 開放
/Users/HW/Library/MobileDevice/Provisioning\ Profiles
文件夾的讀寫權限
WX20170606-151737@2x.png
研究 Jenkins 大約 3天店煞,構建項目失敗了40多次