Xcodebuild 在存档签名期间使用 Jenkins CI 构建时抛出“写入权限错误”

问题描述 投票:0回答:0

代码:
...

def archive(xcode_path, archive_path):
    if os.path.exists(archive_path):
        shutil.rmtree(archive_path)
    subprocess.run([
        'xcodebuild',

        '-project',
        xcode_path,

        '-scheme',
        'Unity-iPhone',

        '-allowProvisioningUpdates',

        '-destination',
        'generic/platform=iOS',

        '-archivePath',
        archive_path,

        'archive',
    ])
cd $PROJ_PATH
/usr/bin/python3 ../ci/archive.py

...

错误:
...

error: Certificate installation failed: Installing a certificate in the keychain failed (Error Domain=DVTSecErrorDomain Code=-61 "Write permissions error." UserInfo={NSLocalizedDescription=Write permissions error.}) (在项目的目标'Unity-iPhone'中'Unity-iPhone')

error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "*********" with a private key was found. (在项目“Unity-iPhone”的目标“Unity-iPhone”中)

...

我认为相关的语境:
...
Xcode 项目是用 unity2021.3.15 构建的。 Xcode 项目供应配置文件与“自动”切换。
机器版本:macOS Ventura 13.0.
Xcode 版本:版本 14.1 (14B47b)。
...

问题:
我其实有2个问题:

  1. 为什么会抛出这个错误?我的猜测是 xcodebuild 正在尝试更新系统钥匙串,但执行用户没有权限。
  2. 为什么我可以从我的终端执行这段代码,但是从 Jenkins 脚本执行时会抛出错误。即使我检查了“whoami”和“echo $USER”,Jenkins 用来执行此 python 脚本的用户与我的终端相同。如果用户是同一个人,结果不应该完全一样吗?

跟进: 我确实知道很多人使用手动签名并且没有所有这些问题。但我确实想使用自动签名,因为,为什么不呢?应该一次完成就永远完成吗?

感谢上一篇

我尝试在整个互联网上搜索,但许多答案建议我转而使用手动签名。

ios xcode macos jenkins provisioning-profile
© www.soinside.com 2019 - 2024. All rights reserved.