我正在尝试使用 Jenkins 和 Fastlane 构建 iOS 应用程序。Jenkins master 是一台 Linux 机器,slave 是一台 macOS 机器,两者都在 AWS 上运行。
项目存储库托管在 Gitlab 上。
当管道通过 Jenkins 运行时,会出现以下错误:
以下构建命令失败:CompileSwift normal arm64 CodeSign /Users/ec2-user/Library/Developer/Xcode/DerivedData/AssociatedPress-fccudiwnsqoxlobymusvrmoonnxe/Build/Intermediates.noindex/ArchiveIntermediates/AssociatedPress/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AssociatedPress\ Notification\ Extension .appex
我的 fsyfile 的内容是:
node('macos') {
{
stage('Checkout') {
checkout scm
}
stage('Resolve packages') {
sh 'bash resolvePackages'
}
stage('Build Store') {
sh 'fastlane store'
}
}
}
Fastfile如下:-
default_platform :ios
platform :ios do
desc "Build Store"
lane :store do
gym(workspace: "AssociatedPress.xcworkspace",
scheme: "AssociatedPress",
clean: true,
output_directory: "./fastlane/Store",
archive_path: "./fastlane/Store/AssociatedPressStore.xcarchive",
buildlog_path: "./fastlane/Store/build_log",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.apnews.ipad.mobilenewsdevel" => "AP News Store",
"com.apnews.ipad.mobilenewsdevel.watchkitapp" => "AP News WatchApp Store",
"com.apnews.ipad.mobilenewsdevel.watchkitapp.watchkitextension" => "AP News WatchExtension Store",
"com.apnews.ipad.mobilenewsdevel.notificationextension" => "AP News Notification Store",
},
uploadBitcode: false,
compileBitcode: false
})
end
end
只有在通过 Jenkins 运行 CodeSign 时,构建才会失败。在 macOS 从节点上本地运行 fastlane 命令时,构建成功。
版本:-
- macOS:11.5.1
- xocde 版本:12.5.1
- 快车道:2.192.0
我已经尝试了一些解决方案,例如在健身房之前解锁钥匙串,运行 set-key-partition-list 命令,但都没有解决问题。