hey24sheep / azure-flutter-tasks

Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
https://marketplace.visualstudio.com/items?itemName=Hey24sheep.flutter
MIT License
89 stars 22 forks source link

iOS Signing on macOS13 pipeline: error: exportArchive: No Accounts - exportArchive: No profiles for <bundleID> were found #119

Closed TobiasHanitsch closed 7 months ago

TobiasHanitsch commented 8 months ago

Hi! We are building an iOS Flutter app in an Azure DevOps Pipelines. The pipeline consists of: Using the Microsoft-provided tasks to install the signing certificate and provisioning profile after uploading these files into the DevOps project. Then, we insert their UUID and Signing identity into our configs (4 flutter environment variables, such as "FLUTTER_XCODE_CODE_SIGN_IDENTITY" and the exportOptions.plist file) and finally we install Flutter and build the app into an IPA file.

This used to work well and would generate a working IPA while we were working on Microsoft's MacOS12 pipeline agents. Now we upgraded to MacOS13 and because of this single change, the build fails with the following error:

Encountered error while creating the IPA:
error: exportArchive: No Accounts
error: exportArchive: No profiles for '<bundleID>' were found

I am aware that this seems similar to other common signing issues (that I had a ton of already too) but this is decidedly different in my eyes and I am unable to fix it. The fact that it works perfectly on macOS12 but not on macOS13 is also very curious.

Since we are using official Microsoft hosted agents, we can check their pre-installed software on their "Microsoft-hosted agents" documentation page. We tried using xCode 15.2 instead of the default 15.0.1 version, but it didn't change anything.

We are using an "Enterprise" apple developer account. The same certificate and other provisioning profiles that were generated in the exact same way work for other apps.

We tried generating a completely new cert and profile carefully, but it didn't change anything either.

The installation of both the cert and profile seems to work successfully and completely.

I also contacted Apple support about this in hopes of more details.

This is our exportOptions.plist file:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "[http://www.apple.com/DTDs/PropertyList-1.0.dtd">](http://www.apple.com/DTDs/PropertyList-1.0.dtd%22%3E)
<plist version="1.0">
<dict>
    <key>compileBitcode</key>
    <true/>
    <key>method</key>
    <string>enterprise</string>
    <key>signingStyle</key>
    <string>automatic</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>XXXXX</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>XXXX</key>
        <string>XXXX</string>
    </dict>
</dict>

This is our pipeline:

  name: Azure Pipelines
  demands: xcode

steps:
- task: InstallAppleCertificate@2
  displayName: 'Install an Apple certificate'
  inputs:
    certSecureFile: 'XXXX'
    certPwd: 'XXXX'
    setUpPartitionIdACLForPrivateKey: false

- task: InstallAppleProvisioningProfile@1
  displayName: 'Install an Apple provisioning profile'
  inputs:
    provProfileSecureFile: 'XXXX'

- bash: |
   echo "##vso[task.setvariable variable=FLUTTER_XCODE_DEVELOPMENT_TEAM]XXXX"
   echo "##vso[task.setvariable variable=FLUTTER_XCODE_CODE_SIGN_IDENTITY]XXXX"
   echo "##vso[task.setvariable variable=FLUTTER_XCODE_PROVISIONING_PROFILE]XXXX"
   echo "##vso[task.setvariable variable=FLUTTER_XCODE_CODE_SIGN_STYLE]Manual"

   sed -i -e 's,teamIDPlaceholder,XXXX,g' 'ios/Runner/ExportOptions/exportOptions.plist'
   sed -i -e 's,provisioningProfilesPlaceholder,XXXXX,g' 'ios/Runner/ExportOptions/exportOptions.plist'
   sed -i -e 's,appIdPlaceholder,XXXX,g' 'ios/Runner/ExportOptions/exportOptions.plist'
   cat ios/Runner/ExportOptions/exportOptions.plist
  displayName: 'Bash Script IOS APPLE'

- task: Hey24sheep.flutter.flutter-install.FlutterInstall@0
  displayName: 'Flutter Install'

- task: Hey24sheep.flutter.flutter-build.FlutterBuild@0
  displayName: 'Flutter Build ipa'
  inputs:
    target: ipa
    projectDirectory: '$(Build.SourcesDirectory)'
    entryPoint: 'lib/main_staging.dart'
    exportOptionsPlist: '$(build.sourcesDirectory)/ios/Runner/ExportOptions/ExportOptions.plist'
    dartDefineMultiArgSeparator: 'APP_ID=XXXXX SENTRY_DSN=$(sentry_dsn) SERVICE_BASE_URL=$(SERVICE_BASE_URL)'

Let me know if you require any more details.

Thank you in advance.

EDIT 21.03.2024: I also contacted Microsoft support now. No response from apple yet...

Soap-141 commented 8 months ago

Also having issues on my side, on both 12 and 13 at the moment I think, if it's really 13 related, it's bad because I think it's required to target iOS 17.

hey24sheep commented 8 months ago

Hi @TobiasHanitsch @Soap-141 can you please go through these links. I can't help much here as I do not have access to a devops account and neither to a Mac. It could be that there might be a version mismatch on the hosted agents in XCode or MacOS. Could you verify that with your local versions where you could build the IPA.

Usually the profile not found comes when the pipeline for some reason can't find the downloaded profile. But, if you say you had those and this error is different it could be the reason

sarinupreti2021 commented 8 months ago

+1. I have repeated the whole process of creating the certificates a few times and still the same issue.

hey24sheep commented 8 months ago

Can anyone of you check if the XCode, MacOS and related versions are same on the hosted pipeline and your local machines?

TyBarthel commented 8 months ago

We started seeing issues with the provisioning profile in our pipeline after going from Flutter 3.16 to 3.19.

What versions of Flutter are you all using that are seeing issues?

hey24sheep commented 8 months ago

Does it build on previous Flutter versions on the hosted agents for you? If that's the case I will recommend you to create an issue on Flutter's Repo and tag this issue over there for reference.

zach-freeman commented 8 months ago

I am also experiencing this issue. I tried downgrading the flutter version to 3.16.9 to see if that resolved the issue. It does not. I am now seeing this with Flutter 3.19.5 and 3.16.9. Started happening when going from macOS-12 to macOS-13.

zach-freeman commented 8 months ago

Adding this here to see if it helps for debugging. Locally, I am running Xcode 15.3. On Azure VM macOS-13 the highest Xcode version available is Xcode 15.2 as shown here: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md. Could this be an Xcode issue that was subsequently resolved in Xcode 15.3?

TobiasHanitsch commented 7 months ago

We had the issue in multiple flutter projects and were able to resolve it in both by doing the following changes:

File: project.pbxproj (note the quotes) "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "CODE_SIGN_IDENTITY_PLACEHOLDER"; CODE_SIGN_STYLE = Manual; PROVISIONING_PROFILE_SPECIFIER = "PROVISIONING_PROFILE_UUID_ENTERPRISE";

File: ExportOptions.plist

signingStyle manual

File: azure-pipelines.yaml Insert the placedholders according to the current signing cert/profile.

Soap-141 commented 7 months ago

Hi @TobiasHanitsch @Soap-141 can you please go through these links. I can't help much here as I do not have access to a devops account and neither to a Mac. It could be that there might be a version mismatch on the hosted agents in XCode or MacOS. Could you verify that with your local versions where you could build the IPA.

Usually the profile not found comes when the pipeline for some reason can't find the downloaded profile. But, if you say you had those and this error is different it could be the reason

I got it, I don't remember exactly what it was but it's not your package.

hey24sheep commented 6 months ago

Thanks everyone 👍🏼

otiv33 commented 5 months ago

In my case I had a line in my project.pbxproj. Under release XCBuildConfiguration I had a line defined "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";. I just replaced "iPhone Developer" with "" (empty string) and then it worked. Because the signing identity was development and the config was run on distribution it conflicted in the build.