Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Devops macOS Pipeline fails on hosted with missing provisioning profile

I am running a Azure DevOps Pipeline which generates an .ipa file. This runs on my local agent without any issues, but when I run it on a hosted macOS 10.15 machine, i'll get an error, that the provisioning profile is missing

❌ 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

Here's the output of the install provisioning profile task

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

And the failing XCOde archive task:

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

I am a beginner with Apple certificates, so I think I am missing something here Thanks for any help!

EDIT

After setting

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

I'll get a bunch of new errors coming up.

❌  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')

These are all packages I included into my flutter application.

like image 821
DirtyNative Avatar asked Oct 15 '22 01:10

DirtyNative


2 Answers

Make sure you have uploaded provisioning profile & .p12 file to the pipeline library. After that you can include this at the end of your 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

For more information, refer to this article

like image 166
Linh Ta Avatar answered Oct 18 '22 23:10

Linh Ta


You can check the task log of InstallAppleProvisioningProfile task to see if the provisioning profiles is successfully downloaded in the agent. Make sure the right provisioning profiles is uploaded to the secure file(Pipeline-->Library--Secure files>) and is downloaded to the agent in the runtime.

If the provisioning profiles is successfully downloaded. It might be because the different version of xcode.

You can check the build log to see if the xcode version used by the xcode task in cloud hosted agent is the same with your local agent.

You can use xcodeVersion attribute specify the target version of Xcode for Xcode task.

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

Update:

If it is not the xcode version issue. You can try setting the provisioningProfileUuid attribute to $(APPLE_PROV_PROFILE_UUID): See below:

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

Check here for more information.

like image 36
Levi Lu-MSFT Avatar answered Oct 19 '22 00:10

Levi Lu-MSFT