Azure Devops macOS Pipeline 在托管时失败,且缺少配置文件

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

我正在运行 Azure DevOps Pipeline,它会生成 .ipa 文件。它在我的本地代理上运行没有任何问题,但是当我在托管的 macOS 10.15 计算机上运行它时,我会收到一个错误,提示配置文件丢失

❌  error: No profiles for 'app.zookeeper.platypus' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'app.zookeeper.platypus'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner') 

- task: InstallAppleProvisioningProfile@1
  displayName: 'Install an Apple provisioning profile'
  inputs:
    provProfileSecureFile: App.mobileprovision

- task: InstallAppleCertificate@2
  displayName: 'Install an Apple certificate'
  inputs:
    certSecureFile: 'Certs.p12'
    certPwd: xxx

- task: Xcode@5
  displayName: 'Xcode archive'
  inputs:
    actions: archive
    xcWorkspacePath: 'src/Apps/App/ios/Runner.xcworkspace'
    scheme: Runner
    packageApp: true
    archivePath: 'src/Apps/App/ios/Runner.xcarchive'
    exportPath: '$(build.artifactstagingdirectory)'
    signingOption: auto

这是安装配置文件任务的输出

Starting: Install an Apple provisioning profile
==============================================================================
Task         : Install Apple provisioning profile
Description  : Install an Apple provisioning profile required to build on a macOS agent machine
Version      : 1.171.0
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/install-apple-provisioning-profile
==============================================================================
/usr/bin/security cms -D -i /Users/runner/work/_temp/platypus.mobileprovision
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AppIDName</key>
    <string>Platypus identifier</string>
    <key>ApplicationIdentifierPrefix</key>
    <array>
    <string>UM3UVMPGY5</string>
    </array>
    <key>CreationDate</key>
    <date>2020-07-31T14:08:38Z</date>
    <key>Platform</key>
    <array>
        <string>iOS</string>
    </array>
    <key>IsXcodeManaged</key>
    <false/>
    <key>DeveloperCertificates</key>
    <array>
        <data>MIIF...</data> <- shortened for better reading
        <data>MIIF...</data> <- shortened for better reading
        <data>MIIF...</data> <- shortened for better reading
    </array>

                                        
    <key>Entitlements</key>
    <dict>
                
                <key>application-identifier</key>
        <string>UM3UVMPGY5.app.zookeeper.platypus</string>
                <key>keychain-access-groups</key>
        <array>
                <string>UM3UVMPGY5.*</string>
                <string>com.apple.token</string>
        </array>
                
                <key>get-task-allow</key>
        <true/>
                
                <key>com.apple.developer.team-identifier</key>
        <string>UM3UVMPGY5</string>
                <key>com.apple.developer.authentication-services.autofill-credential-provider</key>
        <true/>

    </dict>
    <key>ExpirationDate</key>
    <date>2021-07-31T14:08:38Z</date>
    <key>Name</key>
    <string>platypus</string>
    <key>ProvisionedDevices</key>
    <array>
        <string>00008030-0011193A11D8802E</string>
    </array>
    <key>TeamIdentifier</key>
    <array>
        <string>UM3UVMPGY5</string>
    </array>
    <key>TeamName</key>
    <string>Daniel Martin</string>
    <key>TimeToLive</key>
    <integer>365</integer>
    <key>UUID</key>
    <string>19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7</string>
    <key>Version</key>
    <integer>1</integer>
</dict>
/usr/libexec/PlistBuddy -c Print UUID _xcodetasktmp.plist
19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7
/usr/libexec/PlistBuddy -c Print Name _xcodetasktmp.plist
platypus
/bin/rm -f _xcodetasktmp.plist
/bin/cp -f /Users/runner/work/_temp/platypus.mobileprovision /Users/runner/Library/MobileDevice/Provisioning Profiles/19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7.mobileprovision
Finishing: Install an Apple provisioning profile

以及失败的 XCOde 存档任务:

Starting: Xcode archive
==============================================================================
Task         : Xcode
Description  : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Version      : 5.170.2
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/xcode
==============================================================================
/usr/bin/xcodebuild -version
Xcode 11.3.1
Build version 11C505
/usr/bin/xcodebuild -configuration $(Configuration) -workspace /Users/runner/work/1/s/src/Apps/platypus_app/ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Automatic | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

❌  error: No profiles for 'app.zookeeper.platypus' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'app.zookeeper.platypus'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')


** ARCHIVE FAILED **

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
Finishing: Xcode archive

我是一个拥有苹果证书的初学者,所以我想我在这里遗漏了一些东西 感谢您的帮助!

编辑

设定后

signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'

我会收到一堆新错误。

❌  error: image_picker does not support provisioning profiles. image_picker does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'image_picker' from project 'Pods')

❌  error: flutter_secure_storage does not support provisioning profiles. flutter_secure_storage does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'flutter_secure_storage' from project 'Pods')

❌  error: MTBBarcodeScanner does not support provisioning profiles. MTBBarcodeScanner does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'MTBBarcodeScanner' from project 'Pods')

❌  error: sqflite does not support provisioning profiles. sqflite does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'sqflite' from project 'Pods')

❌  error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')

❌  error: Provisioning profile "platypus" doesn't include signing certificate "iPhone Distribution: Daniel Martin (UM3UVMPGY5)". (in target 'Runner' from project 'Runner')

❌  error: path_provider does not support provisioning profiles. path_provider does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'path_provider' from project 'Pods')

这些都是我包含在我的 flutter 应用程序中的包。

ios xcode azure azure-devops azure-pipelines
4个回答
4
投票

确保您已将配置文件和 .p12 文件上传到管道库。之后,您可以将其包含在

Podfile
的末尾:

post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
        config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
    end
end

欲了解更多信息,请参阅这篇文章


1
投票

您可以检查InstallAppleProvisioningProfile任务的任务日志,以查看配置文件是否已成功下载到代理中。确保将正确的配置文件上传到安全文件(管道-->库--安全文件>)并在运行时下载到代理。

如果配置配置文件已成功下载。可能是因为xcode版本不同。

您可以检查构建日志,看看云托管代理中的 xcode 任务使用的 xcode 版本是否与本地代理相同。

您可以使用

xcodeVersion
属性为 Xcode 任务指定 Xcode 的目标版本。

- task: Xcode@5
  displayName: 'Xcode task'
  inputs:
    xcodeVersion: 11
    packageApp: true
    signingOption: auto

更新:

如果不是xcode版本问题。您可以尝试将

provisioningProfileUuid
属性设置为
$(APPLE_PROV_PROFILE_UUID)
:见下文:

- task: Xcode@5
  inputs:
    signingOption: 'manual'
    signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
    provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'

查看此处了解更多信息。


0
投票

写此评论是为了防止有人遇到类似的问题。 就我而言,问题在于证书是 Development 而不是 Adhoc ,因此当我创建一个 Adhoc 证书并将其添加而不是开发证书时,它就起作用了。


0
投票

如果您使用的是 SMP 而不是 CocoaPods,则应该将参数添加到 Xcode 构建任务中。

- task: Xcode@5
    inputs:
        actions: build
        ...
        args: 'CODE_SIGNING_REQUIRED=No'
© www.soinside.com 2019 - 2024. All rights reserved.