Search code examples
azure-devops.net-7.0abp-frameworkmaui-blazor

Azure Pipeline, Mac runner and dotnet dev-cert task hang


First some context :

  • Azure Pipeline configured to use macos as VM Image
  • Trying to have a PR Pipeline for an ABO.io project (blazor maui, both web and mobile app for android, ios)
  • Trying to use macos based agent so we can build both ios and android version in the same PR pipeline.
  • Using .Net 7.0

By default with ABP.io, you need to generate a certificate that is used for signing. So I basically have a step in my pipeline that is the following:

- task: PowerShell@2
  displayName: 'Generate authserver.pfx'
  inputs:
    targetType: 'inline'
    script: |
      cd $(Build.SourcesDirectory)\src\projectname.HttpApi.Host
      dotnet dev-certs https -v -ep authserver.pfx -p $(passPhrase)

This works perfectly when running the pipeline on a Windows-based agent, but when I switch to a macos based runner, it partially works but hang forever on this before timing out :

[23] Saving certificate 'redacted - CN=localhost - Valid from 2023-10-25 17:28:04Z to 2024-10-25 17:28:04Z - IsHttpsDevelopmentCertificate: true - IsExportable: true' to authserver.pfx with private key.

What am I missing here? I've been struggling with that for hours without finding any solutions. Thanks a lot for anybody who can shed some light on that.


Solution

  • It seems that we cannot generate/export the development certificate with the command dotnet dev-certs https on MacOS machine, unless we remove the one that is already installed on the machine. (Haven't tested on my Mac yet).

    However, I used the clean option first to clean HTTPS development certificates from the MacOS agent machine and then generate the development certificate; it worked.

    Here are my steps for your refence.

      - task: PowerShell@2
        displayName: PowerShell Script
        inputs:
          targetType: inline
          script: dotnet dev-certs https --clean -v
      - task: PowerShell@2
        displayName: PowerShell Script
        inputs:
          targetType: inline
          script: |
            dotnet dev-certs https -ep authserver.pfx -p $(passPhrase) -v
          workingDirectory: $(Build.SourcesDirectory)/src/AbpIoAzureDevops.HttpApi.Host
    

    enter image description here

    See more details in the document. Hope the information may help resolve your issue.