簡體   English   中英

無法遠程構建Xcode項目

[英]Unable to remote build xcode project

我有一台jenkins服務器通過ssh連接到遠程Mac mini,以執行必須從統一項目構建IPA的外殼程序腳本。

當在Mac mini上本地執行shell腳本時,一切正常。 但是,當從jenkins(具有完全相同的參數和相同的用戶)運行shell腳本時,它將無法對存檔進行代碼簽名。

我將與您分享混淆的Shell腳本以及構建日志。

提前謝謝你的幫助。

shell腳本:

#!/bin/bash

# Consider directory paths initialized in parameter here
#
#
# Consider git cleaning / fetching commit here
#
#
# Consider environment / version and build name controls here
#
#
# Start Unity Build :

/Applications/Unity2017.4.10f1/Unity.app/Contents/MacOS/Unity -batchmode -quit -projectPath "$SOURCE_PATH" -executeMethod "BuildManager.BuildPlayer" -logFile "$BUILD_LOG_FILE" -buildEnvironment "$ENVIRONMENT" -buildPlatform "IOS" -buildPath "$TARGET_BUILD_DIR" -overrideVersion "$OVERRIDE_VERSION"

if [ ! -d "${TARGET_BUILD_DIR}/Unity-iPhone.xcodeproj" ]
then
    echo "[ERR]Exporting unity project to Xcode failed."
    exit 1
else
    echo "Build successfull"
fi
#
#
# Consider initializing a param for the provisioning profile file path
#
#
# Consider initializing a param for the plist file path

cd $TARGET_BUILD_DIR

# archive generated xcode project    
xcodebuild -scheme "Unity-iPhone" -archivePath "${DEPLOY_DIR_ROOT}/${BUILD_NAME}_${FILE_FORMAT_VERSION}/archive.xcarchive" -sdk iphoneos -configuration Release PROVISIONING_PROFILE="${PROVISIONING_PROFILE_PATH}" archive

if [ $? != 0 ]; then
    echo "FAILED ARCHIVING XCODE PROJECT"
    exit 1
fi

# export ipa from archive
xcodebuild -exportArchive -archivePath "${DEPLOY_DIR_ROOT}/${BUILD_NAME}_${FILE_FORMAT_VERSION}/archive.xcarchive" -exportOptionsPlist "${PLIST_PATH}" -exportPath "${DEPLOY_DIR_ROOT}/${BUILD_NAME}_${FILE_FORMAT_VERSION}"

if [ $? != 0 ]; then
    echo "FAILED EXPORTING IPA FROM ARCHIVE"
    exit 1
fi
#
# Section reserved for uploading the ipa to relevant remote storage
#
exit 0

因此,當從Mac mini的終端本地運行shell腳本時,一切工作都像一個魅力(甚至可以將構建版本安裝在設備上)。

通過ssh遠程運行shell腳本時,無法對歸檔文件進行代碼簽名。 在ssh上使用的用戶與在本地運行腳本的用戶相同。

這是錯誤:

CodeSign / ###### /庫/開發人員/Xcode/DerivedData/Unity-iPhone-########/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/InstallationBuildProducts位置/應用程序/ ## #######。app(位於目標:Unity-iPhone中)cd / ######### / xcodeProjPath export CODESIGN_ALLOCATE = / Applications / Xcode.app / Contents / Developer / Toolchains / XcodeDefault.xctoolchain / usr / bin / codesign_allocate

簽名身份:“ #########”配置文件:“ iOS Team配置文件:########”(#########)

/ usr / bin / codesign --force --sign ######### --entitlements / ########## / Library / Developer / Xcode / DerivedData / Unity-iPhone-### ###### / Build / Intermediates.noindex / ArchiveIntermediates / Unity-iPhone / IntermediateBuildFilesPath / Unity-iPhone.build / Release-iphoneos / Unity-iPhone.build / ##########。app.xcent --timestamp = none /#########/Library/Developer/Xcode/DerivedData/Unity-iPhone-########/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/ InstallationBuildProducts位置/應用程序/#########.app / ######### / Library / Developer / Xcode / DerivedData / Unity-iPhone-######## / Build / Intermediates.noindex / ArchiveIntermediates / Unity-iPhone / InstallationBuildProductsLocation / Applications / #########。app:errSecInternalComponent

命令CodeSign失敗,退出代碼非零

**歸檔失敗**

我現在有點卡住,因為我的所有嘗試都根本沒有用...預先感謝您的幫助。

編輯:

macOS High Sierra版本10.13.6(17G65)上的mac mini

xcode版本10.0(10A255)

好的,對於所有在這個棘手的主題上苦苦掙扎的人(如果我們對macOS不夠了解,這是完全不可見的),還有一種安全系統仍然可以在本地用戶和遠程訪問用戶之間發揮作用。

因此,遠程用戶無法使用開箱即用的用於處理您的密鑰和證書的密鑰鏈(由codesign用來對您的構建進行簽名)。 它需要首先解鎖!

要了解系統上可用的鑰匙串,只需在終端上輸入:

安全列表鑰匙串

您應該看到類似:

"/Users/'YOURUSER'/Library/Keychains/login.keychain-db"
"/Library/Keychains/System.keychain"

您就在這里猜對了,您必須解鎖用戶的鑰匙串! Juste運行此命令:

安全性解鎖鑰匙串-p'USER_PASSWORD''PATH_TO_USER_KEYCHAIN'

就是這樣。

NB:請讓我知道我是否理解所有這些錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM