【问题标题】:CodeSign error while build with fastlane in Jenkins在 Jenkins 中使用 fastlane 构建时出现 CodeSign 错误
【发布时间】:2022-01-27 21:24:12
【问题描述】:

这是一个常见问题,我已经搜索了很长时间,但没有找到解决方案。所以,如果你能帮助我,我非常感激,因为我几乎疯了。可能是 Xcode 13 的问题,或者是 MacOS 版本,我不知道了。

我在 Jenkins 的存档过程中遇到以下错误:

    ** ARCHIVE FAILED **
The following build commands failed:
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'lottie-ios' from project 'Pods')
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'lottie-ios' from project 'Pods')
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'CryptoSwift' from project 'Pods')
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'CryptoSwift' from project 'Pods')
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'Charts' from project 'Pods')
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Charts' from project 'Pods')
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'Socket.IO-Client-Swift' from project 'Pods')
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Socket.IO-Client-Swift' from project 'Pods')
    CodeSign /Users/ec2-user/Library/Developer/Xcode/DerivedData/Digital-gcckbpuniqjuffdycaxavadslfdj/Build/Intermediates.noindex/ArchiveIntermediates/Digital/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Digital-Push.appex (in target 'Digital-Push' from project 'Digital')
(9 failures)

这就是健身房日志中的内容:

/usr/bin/codesign --force --sign DB14DD2701DF6BB1D23A6A554C4FDBA1FE9C1A56 --entitlements /Users/ec2-user/Library/Developer/Xcode/DerivedData/Digital-gcckbpuniqjuffdycaxavadslfdj/Build/Intermediates.noindex/ArchiveIntermediates/Digital/IntermediateBuildFilesPath/Digital.build/Release-iphoneos/Digital-Push.build/Digital-Push.appex.xcent --generate-entitlement-der /Users/ec2-user/Library/Developer/Xcode/DerivedData/Digital-gcckbpuniqjuffdycaxavadslfdj/Build/Intermediates.noindex/ArchiveIntermediates/Digital/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Digital-Push.appex
Warning: unable to build chain to self-signed root for signer "Apple Distribution: Banco BTG Pactual S.A. (FU2YTD6J36)"
/Users/ec2-user/Library/Developer/Xcode/DerivedData/Digital-gcckbpuniqjuffdycaxavadslfdj/Build/Intermediates.noindex/ArchiveIntermediates/Digital/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Digital-Push.appex: errSecInternalComponent
Command CodeSign failed with a nonzero exit code

在跑健身房之前,我会通过两种方式解锁钥匙链,直接和通过 fastlane:

security -v unlock-keychain -p $PASSWORD /Users/ec2-user/Library/Keychains/login.keychain
desc "Unlock keychain so jenkins can get authencation infos"
lane :keychain do
    UI.success("✅✅✅ Unlock keychain so jenkins can get authencation infos ✅✅✅")
    unlock_keychain(
        path: "login",
        password: @keychain_password
    )
end

我的证书和密钥一切正常,如果我通过本地终端在 Xcode 和 Fastlane 中执行相同的过程,一切都运行顺利,它只是发生在 Jenkins 中。

最后一件事,如果确实有所不同,那就是 Jenkins 工作区不在用户目录中,它位于 /opt/jenkins/workspace。

【问题讨论】:

  • 你能解决这个问题吗?

标签: ios xcode jenkins code-signing fastlane


【解决方案1】:

万一其他人有这个问题,我遇到了类似的错误/场景,发现服务器(我们使用与 Jenkins 不同的产品)正在请求“签署”存档的权限,并且需要人工输入/密码的用户登录..我怀疑访问钥匙串。我们还从解锁钥匙串开始,所以我不能 100% 确定为什么它仍然要求手动输入密码。所以修复(至少在我的场景中)是登录服务器并尝试存档以提供请求的密码。在此之后,我没有任何问题。

【讨论】:

    【解决方案2】:

    打开钥匙串访问,双击正在使用的钥匙并转到访问控制选项卡。要么允许访问所有应用程序,要么只允许访问需要访问的应用程序,在你的情况下是 Jenkins。希望这可以帮助。 Refer this image

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-10
      • 1970-01-01
      • 1970-01-01
      • 2015-04-14
      • 1970-01-01
      • 2021-11-13
      • 1970-01-01
      相关资源
      最近更新 更多