HodorNV / ALOps

ALOps
56 stars 24 forks source link

ALOps App Publish - Timeout on Sync with Breaking Changes instead of an error #783

Open pri-kise opened 1 month ago

pri-kise commented 1 month ago

Describe the bug We publish in our CI first the previous version (if available) and afterwards the new version. We have a breaking change in this app and I would expect to get an error for the sync step, but instead we receive a timeout.

the used yaml This is our Template for this step:

parameters:
  alcodeanalyzer: 'NONE'
  alsourcepath: '$(System.DefaultWorkingDirectory)\MainApp'
  alternativeartifacturl: ''
  altestpath: '$(System.DefaultWorkingDirectory)\TestApp'
  appversiontemplate: ''
  artifactcountry: 'de'
  artifacttype: 'Sandbox'
  artifactversion: ''
  customerlicensefile: ''
  failonwarningsfortests: false
  imageprefix: 'cronus'
  install_microsoft_apps: ''
  licensefile: ''
  preprocessorsymbols: ''
  releaseBranchName: 'refs/heads/main'
  releasePipelineId: ''
  testSuiteContinueOnError: false
  testSuiteDisabledTestsJson: ''
  testSuites: ['DEFAULT']
  versionselect: ''

steps:
  - template: AutoCleanup.yml

  - task: ALOpsDockerCreate@1
    displayName: 'Create Docker Container'
    inputs:
      artifactversion: '${{parameters.artifactversion}}'
      artifacttype: '${{parameters.artifacttype}}'
      artifactcountry: '${{parameters.artifactcountry}}'
      versionselect: '${{parameters.versionselect}}'
      imageprefix: '${{parameters.imageprefix}}'
      dockerregistry: 'xxx'
      dockerusername: 'xxx'
      dockerpassword: '$(DockerRegistryPassword)'
      licensefile: '${{parameters.licensefile}}'
      accept_insider_eula: true
      alternativeartifacturl: '${{parameters.alternativeartifacturl}}'

  - task: ALOpsDockerStart@1
    displayName: 'Start Docker Container'
    inputs:
      memory_gb: '8'

  - task: ALOpsDockerWait@1
    displayName: 'Wait for Docker Container'
    inputs:
      search_string: 'Ready for connections!'

  - task: ALOpsAppPublish@1
    displayName: 'Install Microsoft Apps'
    condition: and(succeeded(), ne('${{parameters.install_microsoft_apps}}', ''))
    inputs:
      usedocker: true
      installaltesttool: true
      install_al_app_names: '${{parameters.install_microsoft_apps}}'
      strictappnames: true

  - task: ALOpsAppPublish@1
    displayName: 'Publish Dependencies'
    inputs:
      usedocker: true
      nav_artifact_app_filter: '*.app'
      batch_publish_folder: '$(System.ArtifactsDirectory)'

  - task: DownloadBuildArtifacts@0
    displayName: 'Download Previous Version'
    condition: and(succeeded(), ne('${{ parameters.releasePipelineId }}', ''))
    continueOnError: true
    inputs:
      buildType: 'specific'
      project: '$(System.TeamProjectId)'
      pipeline: '${{parameters.releasePipelineId}}'
      buildVersionToDownload: 'latestFromBranch'
      allowPartiallySucceededBuilds: true
      branchName: '${{parameters.releaseBranchName}}'
      downloadType: 'specific'
      itemPattern: '**/*.app'
      downloadPath: '$(System.ArtifactsDirectory)'

  - task: ALOpsAppPublish@1
    displayName: 'Publish Previous Version'
    condition: and(succeeded(), ne('${{ parameters.releasePipelineId }}', ''), in(variables['Agent.JobStatus'], 'Succeeded'))
    inputs:
      usedocker: true
      nav_artifact_app_filter: '*.app'

  - task: ALOpsAppCompiler@1
    displayName: 'Compile App'
    inputs:
      usedocker: true
      targetproject: '${{parameters.alsourcepath}}\app.json'
      al_analyzer: '${{parameters.alcodeanalyzer}}'
      nav_app_version: '${{parameters.appversiontemplate}}'
      publish_artifact: false
      preprocessorsymbols: '${{parameters.preprocessorsymbols}}'

  - task: ALOpsAppPublish@1
    displayName: 'Publish App'
    inputs:
      usedocker: true
      nav_artifact_app_filter: '*.app'

  # TestApp
  - task: ALOpsAppPublish@1
    displayName: 'Install AL TestTool'
    inputs:
      usedocker: true
      installaltesttool: true
      install_al_app_names: |
        System Application Test Library  
        Library Variable Storage  
        Permissions Mock  
        Library Assert  
        Any  
        Test Runner
        Business Foundation Test Libraries
        Tests-TestLibraries
      strictappnames: true

  - task: ALOpsAppCompiler@1
    displayName: 'Compile Test-App'
    inputs:
      usedocker: true
      targetproject: '${{parameters.altestpath}}\app.json'
      nav_app_version: '${{parameters.appversiontemplate}}'
      publish_artifact: false
      failed_on_warnings: ${{parameters.failonwarningsfortests}}
      preprocessorsymbols: '${{parameters.preprocessorsymbols}}'

  - task: ALOpsAppPublish@1
    displayName: 'Publish Test-App'
    inputs:
      usedocker: true
      nav_artifact_app_filter: '*.app'

  - ${{ each TestSuite in parameters.TestSuites }}:
      - task: ALOpsAppTest@1
        displayName: 'Run TestSuite ${{TestSuite}}'
        inputs:
          usedocker: true
          disabledtests: '${{parameters.testSuiteDisabledTestsJson}}'
          import_testtoolkit: false
          import_action: 'Skip'
          testpage: '130455'
          testsuite: '${{TestSuite}}'
          failed_test_action: 'Error'
          resultfilename: '${{TestSuite}}-TestResults.xml'
        continueOnError: ${{parameters.testSuiteContinueOnError}}

  - task: PublishTestResults@2
    displayName: 'Publish Test Results'
    inputs:
      testResultsFormat: 'XUnit'
      testResultsFiles: '**/*TestResults.xml'
      testRunTitle: 'BC Test Results: $(Build.BuildId)'

  - task: ALOpsDockerRemove@1
    displayName: 'Remove Docker Container'
    condition: always()

the output I replaced some names with xxx.

*** Published App:

ServerInstance                        : MicrosoftDynamicsNavServer$BC
ExtensionDataVersion                  : 1.0.57343.0
IsInstalled                           : False
SyncState                             : NotSynced
NeedsUpgrade                          : False
IsPublished                           : True
Brief                                 : xxx
Description                           : xxx
CompatibilityId                       : 1.0.0.0
PrivacyStatement                      : xxx
Eula                                  : xxx
Help                                  : xxx
Url                                   : xxx
Logo                                  : 
DeveloperTenantId                     : 
ScreenShots                           : {}
Dependencies                          : {}
Capabilities                          : {}
PackageId                             : 9005e6c5-d24a-4024-979b-67face958d14
PublisherAzureActiveDirectoryTenantId : 
AppId                                 : 00000000-0000-0000-0000-000000000000
Name                                  : xxx
Publisher                             : xxx
Version                               : 1.0.58167.0
ExtensionType                         : ModernDev
Scope                                 : Global
Tenant                                : 

*** Sync Tenant default
*** Sync App [xxx] on tenant [default]
##[error]The Operation will be canceled. The next steps may not contain expected logs.
##[error]The operation was canceled.

Expected behavior I would expect an error in the pipeline as reason of the breaking changes.

Additional context This has been working in the past.

PeterConijn commented 4 weeks ago

Could this be related to the timeouts we experience(d) in #775?

waldo1001 commented 3 weeks ago

Yeah - we have seen the publish and sync cmdlets time out in some cases .. will sync with the developer to see if we can do anything about it.. .

waldo1001 commented 3 weeks ago

This seems to be a bug in the Business Central CmdLet (since v24). I'll see if I can get someone's attention at Microsoft.

joandrsn commented 2 weeks ago

Am I correct in saying this is related to https://github.com/microsoft/AL/issues/7750?

waldo1001 commented 2 weeks ago

That is indeed the issue...

freddydk commented 2 weeks ago

This is related to PS5 / PS7. If you run PS7 - it works correctly.

We will look at fixing the bug, but please be aware that the PS5 bridge will be going away in v26 and you will have to run PS7.

https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/deprecated-features-platform#support-for-powershell-50-removal

PeterConijn commented 1 week ago

I think the question posed in #791 is related to this.