如何在 azure devops 构建代理中修复“*pod* 不支持配置文件”
Posted
技术标签:
【中文标题】如何在 azure devops 构建代理中修复“*pod* 不支持配置文件”【英文标题】:How to fix ' *pod* does not support provisioning profiles' in azure devops build agent 【发布时间】:2019-03-29 14:46:21 【问题描述】:我目前在 Azure Devops 中的管道存在问题。自 3 月 27 日以来,我收到了错误:
错误:Alamofire 不支持配置文件。 Alamofire 不支持配置文件,但已手动指定配置文件 prov 配置文件名称。在构建设置编辑器中将配置文件值设置为“自动”。 (在目标“Alamofire”中)
我的所有 pod 都出现此错误。
代码: 完全相同的分支在前一天已正确构建。
Xcode 版本: 我知道代理仍在 Xcode 10.1 上,我还没有将我的项目更新到 10.2,所以它应该很好。
配置文件: 有效。
怀疑:Apple 在这一天发布了新版本的 Xcode 和 Swift。微软也在这一天更新了代理:github.com/Microsoft/azure-pipelines-tasks/commit/1b019b9f65202d65ac58150bff6514938b53ff78#diff-93b5db3773bba1013dce9d814869dffd
太好了,有人有想法吗?我的管道有什么问题?
【问题讨论】:
能否提供实际的相关代码? 错误:/usr/bin/xcodebuild 失败,返回码:65 你搞清楚了吗? 能否将我的答案标记为正确答案? 【参考方案1】:问题是最新版本的 Cocoapods 正在尝试对框架进行签名。
将以下代码添加到您的 podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
end
【讨论】:
我已经试过这个然后$pod install
再次,并提交新的 src 但它仍然无法正常工作。我的 pod 都在 repo 中。
谢谢你为我节省了很多时间!
有效!这应该被标记为答案并在社区中突出显示。这个答案帮助我解决了数小时的挣扎。
有谁知道将这个偶然放入 Ionic 应用程序的正确位置?
@willhess 有人知道它是如何与 ionic 应用程序一起工作的吗?【参考方案2】:
对于使用 NativeScript 和 macOS-11 的任何人,我发现您无法卸载 cocoapods 并将其降级到较低版本。所以你需要去更新 Podfile 的方法。在您至少运行一次构建之后才会配置 Podfile,因此您需要构建、替换为您自己的,然后再次构建。
Azure 管道
pool:
vmImage: 'macOS-11'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.16.1'
displayName: 'Install Node.js'
- task: DownloadSecureFile@1
name: releaseJksFile
displayName: 'download android keystore file'
inputs:
secureFile: 'release.jks'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: AppleCertificate.p12
certPwd: $(AppleCertificatePassword)
keychain: 'temp'
deleteCert: true
displayName: Install Apple Certificate
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'AppleReleaseProfile.mobileprovision'
removeProfile: true
displayName: 'Install Apple Provisioning Profile'
# Optional... was running into build issues with latest version
#downgrading cocoapods version
- script: |
$ANDROID_HOME/tools/bin/sdkmanager --uninstall 'build-tools;31.0.0'
displayName: 'Remove Android 31 SDK'
- script: |
pip install six
npm install -g @angular/cli nativescript
tns clean
npm install
mkdir $(Build.ArtifactStagingDirectory)/android
mkdir $(Build.ArtifactStagingDirectory)/iphoneos
sed -i -e 's/1.00000000.00/1.$(Build.BuildNumber)/g' App_Resources/ios/Info.plist
sed -i -e 's/1000000/10$(Build.BuildId)/g' App_Resources/Android/src/main/AndroidManifest.xml
sed -i -e 's/1.00000000.00/1.$(Build.BuildNumber)/g' App_Resources/Android/src/main/AndroidManifest.xml
tns build android --env.production --release --key-store-path '$(releaseJksFile.secureFilePath)' --key-store-password '$(KeyStorePassword)' --key-store-alias '$(KeyAlias)' --key-store-alias-password '$(KeyPassword)' --bundle
cp -rf "platforms/android/app/build/outputs/apk/release/" "$(Build.ArtifactStagingDirectory)/android"
echo "uninstalling all cocoapods versions"
sudo gem uninstall cocoapods -ax
echo "installing cocoapods version latest"
sudo gem install cocoapods
tns run ios --provision #see what provisioning profile and certificate are installed... helpful for debugging
tns build ios #creates podfile we are going to replace
cp -rf Podfile platforms/ios/Podfile
rm platforms/ios/Podfile.lock
cd platforms/ios
pod install
cd ../../
tns build ios --env.production --release --bundle #creates xcworkspace
displayName: 'Setup/Build'
- task: Xcode@5
inputs:
actions: 'build'
scheme: 's'
sdk: 'iphoneos'
configuration: 'Release'
exportPath: '$(Build.ArtifactStagingDirectory)/iphoneos/'
packageApp: true
xcWorkspacePath: 'platforms/ios/s.xcworkspace'
xcodeVersion: 'default' # Options: 8, 9, 10, default, specifyPath
signingOption: 'manual'
signingIdentity: '$(AppleCertificateSigningIdentity)'
provisioningProfileUuid: '$(AppleProvisioningProfileUuid)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop'
Podfile(放在项目目录的根目录)
use_frameworks!
target "s" do
# Begin Podfile - /Users/runner/work/1/s/node_modules/@nativescript/secure-storage/platforms/ios/Podfile
pod 'SAMKeychain', '~> 1.5.3'
# End Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
post_installNativeScript_CLI_Architecture_Exclusions_0 installer
end
# Begin Podfile - /Users/runner/work/1/s/platforms/ios/Podfile-exclusions
def post_installNativeScript_CLI_Architecture_Exclusions_0 (installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings.delete "VALID_ARCHS"
config.build_settings["EXCLUDED_ARCHS_x86_64"] = "arm64 arm64e"
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))"
config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "i386 armv6 armv7 armv7s armv8 x86_64"
end
end
# End Podfile
end
【讨论】:
以上是关于如何在 azure devops 构建代理中修复“*pod* 不支持配置文件”的主要内容,如果未能解决你的问题,请参考以下文章
如何修复 azure-devops 构建步骤中的““复制”任务不支持复制目录”?
Azure DevOps Pipeline构建代理:如何在程序集引用HintPath中使用或替换$(DevEnvDir)?
Azure Devops 私有构建代理在 nuget 还原任务中失败