HodorNV / ALOps

ALOps
59 stars 24 forks source link

Issue downloading test dependency #563

Closed Brunoalves5 closed 2 years ago

Brunoalves5 commented 2 years ago

Hi,

I'm trying to setup a very simple build pipeline that just compiles and runs tests on an app. I was following the SettingUpYourFirstBuild tutorial.

But it keeps failing when trying to download the test dependency. Am I supposed to change anything on the app.json? It looks fine to me.

The error: image

My app.json:

{
  "id": "9be7dc95-afe3-46a4-97df-e04ff5de548f",
  "name": "ALOps test",
  "publisher": "bfalves",
  "version": "1.0.0.0",
  "brief": "",
  "description": "",
  "privacyStatement": "",
  "EULA": "",
  "help": "",
  "url": "",
  "logo": "",
  "dependencies": [

  ],
  "screenshots": [],
  "platform":  "14.0.0.0",
  "application":  "14.0.0.0",
  "test": "14.0.0.0",
  "idRanges": [
    {
      "from": 50100,
      "to": 50149
    }
  ],
  "contextSensitiveHelpUrl": "https://BaseALApp.com/help/",
  "showMyCode": true,
  "runtime": "3.0",
  "features": ["TranslationFile"],
  "target": "Extension"
}

Here's the yaml file:

name: $(Build.BuildId)

variables:
- name: 'AppVersion'
  value: '1.0.0.0'
- name: 'dockerimage'
  value: 'mcr.microsoft.com/businesscentral/sandbox'
- name: 'TestFilter'
  value: '50000..55555'
- name: 'bc_license'
  value: 'C:\myPartner\5159525_-_2022_1.flf'

pool:
  name: MyAgentPool

steps:
- checkout: self
  clean: true

- task: ALOpsDockerCreate@1
  displayName: 'ALOPS - Create Docker Image' # It will reuse the image if already exists, or build one if it doesn't.
  inputs:
    artifacttype: Sandbox

- task: ALOpsDockerStart@1
  displayName: 'ALOPS - Start Docker Container' # No need to provide any details - it will get the details from previous step

- task: ALOpsDockerWait@1
  inputs:
    search_string: 'Ready for connections!'

- task: ALOpsLicenseImport@1
  inputs:
    usedocker: true
    license_path: $(bc_license)

 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

- task: ALOpsAppPublish@1
  displayName: 'ALOPS - Install AL TestTool' # install necessary dependent apps for testability
  inputs:
    usedocker: true
    installaltesttool: true
    skip_verification: true
    install_al_app_names: |
     Tests-TestLibraries
     System Application Test
     System Application Test Library
     Any
     Library Assert
     Test Runner
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

- task: ALOpsAppCompiler@1
  displayName: 'ALOPS - Compile Extension: App'
  inputs:
    usedocker: true
    nav_app_version: '1.0.[yyyyWW].*'
    targetproject: 'app.json'                           # The App
    failed_on_warnings: true
    app_file_suffix: '_APP'                                 # A trick to uniquely identify the APP (from the TEST-app)

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

#- task: ALOpsAppCompiler@1
#  displayName: 'ALOPS - Compile Extension: Test-App'
#  inputs:
#    usedocker: true
#    nav_app_version: '1.0.[yyyyWW].*'
#    targetproject: 'app.json'                           # The Test-App
#    failed_on_warnings: true    
#    app_file_suffix: '_TEST'                                 # A trick to uniquely identify the Test-App (from the App)

#- task: ALOpsAppPublish@1
#  displayName: 'ALOPS - Publish Extension'
#  inputs:
#    usedocker: true
#    nav_artifact_app_filter: '*.app'
#    skip_verification: true   

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

- task: ALOpsAppTest@1
  displayName: 'ALOPS - Run TestSuite'
  inputs:
    usedocker: true
    import_action: "Skip"
    import_testtoolkit: false
    testpage: '50132'
    testsuite: 'DEFAULT'
    failed_test_action: 'Ignore'
  continueOnError: true   

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

#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

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

Here's the complete output of the step :

2022-08-27T23:39:08.7268817Z ##[section]Starting: ALOPS - Compile Extension: App
2022-08-27T23:39:08.7503548Z ==============================================================================
2022-08-27T23:39:08.7504065Z Task         : ALOps App Compiler
2022-08-27T23:39:08.7504856Z Description  : Compile AL Extensions for Business Central
2022-08-27T23:39:08.7505268Z Version      : 1.451.3127
2022-08-27T23:39:08.7505569Z Author       : Hodor
2022-08-27T23:39:08.7505924Z Help         : Compile a Business Central extension from AL code.
2022-08-27T23:39:08.7506420Z ==============================================================================
2022-08-27T23:39:12.1927381Z *** Validate configuration
2022-08-27T23:39:12.5703076Z *** Task Inputs:
2022-08-27T23:39:12.5827954Z 
2022-08-27T23:39:12.5993641Z name                                                                   value
2022-08-27T23:39:12.5996708Z ----                                                                   -----
2022-08-27T23:39:12.5999493Z usedocker                                                               True
2022-08-27T23:39:12.6002139Z fixed_tag                                                                   
2022-08-27T23:39:12.6005285Z targetproject                                    C:\agent\_work\5\s\app.json
2022-08-27T23:39:12.6007640Z nav_computername                                                            
2022-08-27T23:39:12.6010025Z nav_serverinstance                                                     BC140
2022-08-27T23:39:12.6013125Z nav_tenant                                                           default
2022-08-27T23:39:12.6015170Z nav_ports_dev                                                           7049
2022-08-27T23:39:12.6017929Z bc_username                                                                 
2022-08-27T23:39:12.6021143Z bc_password                                                                 
2022-08-27T23:39:12.6023246Z al_compiler_version                                               0.12.15355
2022-08-27T23:39:12.6026102Z ruleset                                                                     
2022-08-27T23:39:12.6028672Z suppresswarnings                                                        KEEP
2022-08-27T23:39:12.6031669Z al_analyzer                                                                 
2022-08-27T23:39:12.6033362Z nav_app_version                                               1.0.[yyyyWW].*
2022-08-27T23:39:12.6035205Z vsix_download_path                                                          
2022-08-27T23:39:12.6040390Z use_ssl                                                                False
2022-08-27T23:39:12.6042500Z download_test_symbols                                                  False
2022-08-27T23:39:12.6043781Z usecompression                                                          True
2022-08-27T23:39:12.6045778Z publish_artifact                                                        True
2022-08-27T23:39:12.6070337Z publishxlif                                                            False
2022-08-27T23:39:12.6073355Z failed_on_warnings                                                      True
2022-08-27T23:39:12.6076149Z app_file_suffix                                                         _APP
2022-08-27T23:39:12.6078568Z updatebuildnumber                                                       True
2022-08-27T23:39:12.6081502Z setup_working_folder                                                   False
2022-08-27T23:39:12.6083658Z showmycode                                                              Keep
2022-08-27T23:39:12.6086609Z resourceexposurepolicy_allowdebugging                                   Keep
2022-08-27T23:39:12.6089300Z resourceexposurepolicy_allowdownloadingsource                           Keep
2022-08-27T23:39:12.6092946Z resourceexposurepolicy_includesourceinsymbolfile                        Keep
2022-08-27T23:39:12.6096021Z applicationinsightskey                                                      
2022-08-27T23:39:12.6099235Z printappmanifest                                                        True
2022-08-27T23:39:12.6101432Z output_alc_logs                                                         True
2022-08-27T23:39:12.6103913Z additionalprobingpaths                                                      
2022-08-27T23:39:12.6104520Z 
2022-08-27T23:39:12.6132308Z 
2022-08-27T23:39:12.6145937Z 
2022-08-27T23:39:12.6409596Z 
2022-08-27T23:39:12.6421843Z *** No ALOps License found. Set License with the [alops-licenseid] or [alops_licenseid] variables.
2022-08-27T23:39:12.6433430Z *** To acquire a license, please visit: https://www.alops.be/getlicense
2022-08-27T23:39:12.6444180Z *** For pricing options, please visit : https://www.alops.be/pricing
2022-08-27T23:39:12.6455288Z *** For documentation, please visit   : https://www.alops.be/documentation
2022-08-27T23:39:12.6460096Z 
2022-08-27T23:39:12.9369607Z *** ALOps License:
2022-08-27T23:39:12.9410781Z   * Trial Key  : 1fdb7f4c-2836-436c-9b1f-c9f693b1b456
2022-08-27T23:39:12.9440637Z   * Licensed To: ALOps Trial [30/31] days remaining. Trial ends: Tuesday, 27 September 2022
2022-08-27T23:39:12.9446324Z 
2022-08-27T23:39:12.9566055Z *** Importing required PS-Functions
2022-08-27T23:39:13.5321013Z *** Initiate Docker Session
2022-08-27T23:39:13.9691427Z *** Set Docker Container ErrorActionPreference = Stop
2022-08-27T23:39:14.6261849Z *** Import NAV/BC Management DLL's
2022-08-27T23:39:14.6349726Z *** Loading assemblies for ServiceTier [BC].
2022-08-27T23:39:14.9335751Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\200\service]
2022-08-27T23:39:14.9486203Z *** Selected module: [C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2022-08-27T23:39:14.9495968Z *** Loading module: [C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2022-08-27T23:39:14.9833792Z *** Selected module: [C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Management.dll]
2022-08-27T23:39:14.9841967Z *** Loading module: [C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Management.dll]
2022-08-27T23:39:15.0199075Z *** BC NCL Management DLL: C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Ncl.dll
2022-08-27T23:39:15.4239347Z *** BC Types DLL: C:\program files\microsoft dynamics nav\200\service\Microsoft.Dynamics.Nav.Types.dll
2022-08-27T23:39:15.7791060Z *** Setting up AL Compiler [ALLanguage]
2022-08-27T23:39:16.0725317Z *** Downloading AL Compiler [ALLanguage]
2022-08-27T23:39:16.0874371Z *** Get Extension from Local-Disk...[C:\Run\ALLanguage.vsix]
2022-08-27T23:39:16.0880540Z *** Resolving Path [C:\Run\ALLanguage.vsix]
2022-08-27T23:39:16.1960904Z *** VSIX Path Resolved: [C:\Run\ALLanguage.vsix]
2022-08-27T23:39:16.2003669Z *** Unpacking Extension to folder...
2022-08-27T23:39:32.3404104Z *** Loading Json Object: [c:\Run\Microsoft.al\al-ALLanguage\extension\package.json]
2022-08-27T23:39:32.5679034Z *** Using AL Compiler [vALLanguage] located [C:\Run\Microsoft.al\al-ALLanguage\extension\bin\win32\alc.exe]
2022-08-27T23:39:32.7517456Z ***
2022-08-27T23:39:32.8376135Z *** Working folder: C:\agent\_work\5\s
2022-08-27T23:39:33.0403137Z ***
2022-08-27T23:39:33.0746651Z *** Copy Working folder to Docker Container: 6270bf41c35c37ef8a4199c46e7d3afdb3515268cd6d0e02b4b94732b661be1f
2022-08-27T23:39:33.3076879Z *** Docker Working Folder: c:\Run\DevOps\
2022-08-27T23:39:33.4685674Z *** Copy from [C:\agent\_work\5\s] to [c:\Run\DevOps\]
2022-08-27T23:39:33.7115133Z *** Source File setup completed
2022-08-27T23:39:34.6273437Z *** Target Project: \app.json
2022-08-27T23:39:34.8423564Z *** Check for app.json files: c:\Run\DevOps\
2022-08-27T23:39:35.0601249Z *** Project found:
2022-08-27T23:39:35.3512523Z    - C:\Run\DevOps
2022-08-27T23:39:35.5533131Z *** Retrieving App-Info [\app.json]
2022-08-27T23:39:35.6965096Z *** Loading Json Object: [c:\Run\DevOps\app.json]
2022-08-27T23:39:35.8083168Z   * App.ID          = 9be7dc95-afe3-46a4-97df-e04ff5de548f
2022-08-27T23:39:35.9295452Z   * App.Name        = ALOps test
2022-08-27T23:39:36.1550266Z   * App.Publisher   = bfalves
2022-08-27T23:39:36.2725456Z   * App.Version     = 1.0.0.0
2022-08-27T23:39:36.6074804Z   * App.Platform    = 14.0.0.0
2022-08-27T23:39:36.7691702Z   * App.Application = 14.0.0.0
2022-08-27T23:39:36.7748560Z   * App.Test        = 14.0.0.0
2022-08-27T23:39:36.7761018Z *** Check Runtime: [3.0]
2022-08-27T23:39:36.7765426Z *** Removing ResourceExposurePolicy
2022-08-27T23:39:36.7769115Z ***
2022-08-27T23:39:36.7774368Z *** Match: yyyyWW
2022-08-27T23:39:36.7779958Z *** Setting Managed App Version [c:\Run\DevOps\app.json] =>  1.0.202236.68
2022-08-27T23:39:36.8599263Z *** Final app.json:
2022-08-27T23:39:36.8599632Z {
2022-08-27T23:39:36.8600002Z     "id":  "9be7dc95-afe3-46a4-97df-e04ff5de548f",
2022-08-27T23:39:36.8600422Z     "name":  "ALOps test",
2022-08-27T23:39:36.8600920Z     "publisher":  "bfalves",
2022-08-27T23:39:36.8601366Z     "version":  "1.0.202236.68",
2022-08-27T23:39:36.8601662Z     "brief":  "",
2022-08-27T23:39:36.8601927Z     "description":  "",
2022-08-27T23:39:36.8602289Z     "privacyStatement":  "",
2022-08-27T23:39:36.8602607Z     "EULA":  "",
2022-08-27T23:39:36.8602909Z     "help":  "",
2022-08-27T23:39:36.8603198Z     "url":  "",
2022-08-27T23:39:36.8603489Z     "logo":  "",
2022-08-27T23:39:36.8603800Z     "dependencies":  [
2022-08-27T23:39:36.8603945Z 
2022-08-27T23:39:36.8604196Z                      ],
2022-08-27T23:39:36.8604537Z     "screenshots":  [
2022-08-27T23:39:36.8604690Z 
2022-08-27T23:39:36.8604959Z                     ],
2022-08-27T23:39:36.8605311Z     "platform":  "14.0.0.0",
2022-08-27T23:39:36.8605967Z     "application":  "14.0.0.0",
2022-08-27T23:39:36.8606315Z     "test":  "14.0.0.0",
2022-08-27T23:39:36.8606641Z     "idRanges":  [
2022-08-27T23:39:36.8606930Z                      {
2022-08-27T23:39:36.8607271Z                          "from":  50100,
2022-08-27T23:39:36.8607634Z                          "to":  50149
2022-08-27T23:39:36.8607935Z                      }
2022-08-27T23:39:36.8608223Z                  ],
2022-08-27T23:39:36.8608633Z     "contextSensitiveHelpUrl":  "https://BaseALApp.com/help/",
2022-08-27T23:39:36.8609092Z     "showMyCode":  true,
2022-08-27T23:39:36.8609423Z     "runtime":  "3.0",
2022-08-27T23:39:36.8609740Z     "features":  [
2022-08-27T23:39:36.8610094Z                      "TranslationFile"
2022-08-27T23:39:36.8610419Z                  ],
2022-08-27T23:39:36.8610921Z     "target":  "Extension"
2022-08-27T23:39:36.8611230Z }
2022-08-27T23:39:36.8611338Z 
2022-08-27T23:39:36.8611585Z ***
2022-08-27T23:39:36.9086399Z *** Working Direcotry: [c:\Run\DevOps\]
2022-08-27T23:39:36.9135421Z *** Target Project: [\app.json]
2022-08-27T23:39:36.9136964Z *** Project Directory: [c:\Run\DevOps]
2022-08-27T23:39:36.9176061Z *** VSCode Settings: [c:\Run\DevOps\.vscode\settings.json]
2022-08-27T23:39:36.9267335Z *** VSCode-Settings json found.
2022-08-27T23:39:36.9271709Z *** Loading Json Object: [c:\Run\DevOps\.vscode\settings.json]
2022-08-27T23:39:36.9313053Z *** No AL-RuleSet json found.
2022-08-27T23:39:36.9323639Z ***
2022-08-27T23:39:37.0782322Z *** Resolve Docker Credentials
2022-08-27T23:39:37.0875984Z *** Setup BC Username/Password from Container info
2022-08-27T23:39:37.0954969Z *** Download Symbols
2022-08-27T23:39:37.4690900Z *** Working Dir: c:\Run\DevOps\
2022-08-27T23:39:37.6714030Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\200\service]
2022-08-27T23:39:37.7512323Z *** PackageCache path created [c:\Run\DevOps\PackageCache]
2022-08-27T23:39:37.7525354Z ***
2022-08-27T23:39:37.7551897Z *** Download System-Symbols for [14.0.0.0]
2022-08-27T23:39:37.8035256Z *** Downloading NAV Symbols for [System v14.0.0.0]
2022-08-27T23:39:37.8054077Z *** Downloading NAV Symbols from [https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=System&versionText=14.0.0.0&tenant=default]
2022-08-27T23:39:37.8502845Z *** Downloading NAV Symbols with BasicAuthentication [admin]
2022-08-27T23:39:37.8535017Z ##[command]Invoke-RestMethod -Method Get -Uri https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=System&versionText=14.0.0.0&tenant=default
2022-08-27T23:39:40.0419886Z *** Content-Disposition: attachment; filename=Microsoft_System_20.0.44266.45589.app; filename*=UTF-8''Microsoft_System_20.0.44266.45589.app
2022-08-27T23:39:40.0645133Z *** Saving symbol file [Microsoft_System_20.0.44266.45589.app] to [c:\Run\DevOps\PackageCache]
2022-08-27T23:39:40.0945829Z *** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_System_20.0.44266.45589.app].
2022-08-27T23:39:40.1894809Z ***
2022-08-27T23:39:40.1913359Z *** Download Application-Symbols for [14.0.0.0]
2022-08-27T23:39:40.1934979Z *** Downloading NAV Symbols for [Application v14.0.0.0]
2022-08-27T23:39:40.1948708Z *** Downloading NAV Symbols from [https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=Application&versionText=14.0.0.0&tenant=default]
2022-08-27T23:39:40.1965926Z *** Downloading NAV Symbols with BasicAuthentication [admin]
2022-08-27T23:39:40.1978692Z ##[command]Invoke-RestMethod -Method Get -Uri https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=Application&versionText=14.0.0.0&tenant=default
2022-08-27T23:39:40.6855281Z *** Content-Disposition: attachment; filename=Microsoft_Application_20.4.44313.45604.app; filename*=UTF-8''Microsoft_Application_20.4.44313.45604.app
2022-08-27T23:39:40.6894802Z *** Saving symbol file [Microsoft_Application_20.4.44313.45604.app] to [c:\Run\DevOps\PackageCache]
2022-08-27T23:39:40.6924226Z *** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_Application_20.4.44313.45604.app].
2022-08-27T23:39:40.7270635Z *** Propagated Dependency: Microsoft - System Application - 20.4.0.0
2022-08-27T23:39:40.7446054Z *** Propagated Dependency: Microsoft - Base Application - 20.4.0.0
2022-08-27T23:39:40.7465112Z ***
2022-08-27T23:39:40.7690015Z *** Download Test-Symbols for [14.0.0.0]
2022-08-27T23:39:40.7717632Z *** Downloading NAV Symbols for [Test v14.0.0.0]
2022-08-27T23:39:40.7730531Z *** Downloading NAV Symbols from [https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=Test&versionText=14.0.0.0&tenant=default]
2022-08-27T23:39:40.7745007Z *** Downloading NAV Symbols with BasicAuthentication [admin]
2022-08-27T23:39:40.7758992Z ##[command]Invoke-RestMethod -Method Get -Uri https://6270bf41c35c:7049/BC/dev/packages?publisher=Microsoft&appName=Test&versionText=14.0.0.0&tenant=default
2022-08-27T23:39:41.5090658Z ##[error]Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (404) Not Found."
2022-08-27T23:39:41.5572554Z ##[section]Async Command Start: Add Build Tag
2022-08-27T23:39:41.5573167Z Build '68' has following tags now: myimage-sandbox-20.4.44313.45604-w1-10.0.17763.3287-ltsc2019, BC.Version.20.4.44313.45604, BC.Platform.20.0.44266.45589, AL.Compiler.ALLanguage
2022-08-27T23:39:41.5573620Z ##[section]Async Command End: Add Build Tag
2022-08-27T23:39:41.5574293Z ##[section]Async Command Start: Update Build Number
2022-08-27T23:39:41.5574651Z Update build number to 1.0.202236.68 for build 68
2022-08-27T23:39:41.5574903Z ##[section]Async Command End: Update Build Number
2022-08-27T23:39:41.5575871Z ##[section]Finishing: ALOPS - Compile Extension: App
waldo1001 commented 2 years ago

What version?

in you app.json, I see that you seem to be using a v14 app. App-testability is very different in an v14 app.

This is a working pipeline on our end on a v14 app - compare it with yours

name: $(Build.BuildId)

# trigger:
#  branches:
#    include:
#      - master

variables:
  - group: "Secrets" # link to a variable group that has secret variables, like URL to license file, or sasToken for insider builds

pool: HOD-DOCKER

steps:
  - checkout: self
    clean: true

  - task: ALOpsDockerCreate@1
    displayName: "ALOPS - Create Docker Image" # It will reuse the image if already exists, or build one if it doesn't.
    inputs:
      artifacttype: OnPrem
      artifactversion: 14

  - task: ALOpsDockerStart@1
    displayName: "ALOPS - Start Docker Container" # No need to provide any details - it will get the details from previous step

  - task: ALOpsDockerWait@1
    displayName: "ALOPS - Wait for Docker Container to start"
    inputs:
      search_string: "Ready for connections!"

  #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  - task: ALOpsLicenseImport@1
    displayName: "ALOPS - License Import"
    inputs:
      usedocker: true
      license_path: "$(bc.license)" # more info: https://www.youtube.com/watch?v=iVLOerdCuwA&t=3078s

  - task: ALOpsAppCompiler@1
    displayName: "ALOPS - Compile Extension"
    inputs:
      usedocker: true
      nav_app_version: "1.0.[yyyyWW].*"
      failed_on_warnings: true
      targetproject: "app.json"

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

  - task: ALOpsAppTest@1
    displayName: "ALOPS - Run TestSuite"
    inputs:
      usedocker: true
      import_action: "Skip"
      show_available_tests: true
      import_testtoolkit: true
      failed_test_action: "Ignore"
      testfilter: 50100
    continueOnError: true

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

  #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

  - task: ALOpsDockerRemove@1
    displayName: "ALOPS - Remove Docker Container"
    enabled: true
    condition: always()

What I can see:

The above yaml is for a big part a copy of this example-pipeline: https://github.com/HodorNV/ALOps/blob/master/Examples/05_UseDocker_TestTool_v14.yml

as you see in the name, it's a v14 pipeline.

hope that helps..

Brunoalves5 commented 2 years ago

I adapted your yaml file and now it works fine. Thank you. I will now try to tweek and play around it :)

Brunoalves5 commented 2 years ago

Sorry for following up on this closed issue, @waldo1001. But I'm trying to upgrade the version used to BC 20, I'm again having trouble getting the pipeline to download the symbols with respect to the test toolkit.

image

This is how I've changed my app.json:

{
  "id": "9be7dc95-afe3-46a4-97df-e04ff5de548f",
  "name": "Bfalves Thesis",
  "publisher": "bfalves",
  "version": "1.0.0.0",
  "brief": "",
  "description": "",
  "privacyStatement": "",
  "EULA": "",
  "help": "",
  "url": "",
  "logo": "",
  "dependencies": [
      {
        "id": "9856ae4f-d1a7-46ef-89bb-6ef056398228",
        "publisher": "Microsoft",
        "name": "System Application Test Library",
        "version": "20.0.0.0"
    },
    {
        "id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14",
        "publisher": "Microsoft",
        "name": "Library Assert",
        "version": "20.0.0.0"
    },
    {
        "id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
        "publisher": "Microsoft",
        "name": "Tests-TestLibraries",
        "version": "20.0.0.0"
    },
    {
        "id": "5095f467-0a01-4b99-99d1-9ff1237d286f",
        "publisher": "Microsoft",
        "name": "Library Variable Storage",
        "version": "20.0.0.0"
    }   
  ],
  "screenshots": [],
  "platform":  "20.0.0.0",
  "application":  "20.0.0.0",
  "test": "20.0.0.0", // is this necessary?
  "idRanges": [
    {
      "from": 50000,
      "to": 50149
    }
  ],
  "contextSensitiveHelpUrl": "https://BaseALApp.com/help/",
  "runtime": "9.0",
  "features": ["TranslationFile"],
  "target": "Cloud"
}

And this is my new yaml:

name: $(Build.BuildId)

variables:
- group: VariablesBuild

pool:
  name: MyAgentPool

steps:
  - checkout: self
    clean: true

  - task: ALOpsDockerCreate@1
    displayName: "ALOPS - Create Docker Image" # It will reuse the image if already exists, or build one if it doesn't.
    inputs:
      artifactversion: 20
      artifacttype: OnPrem

  - task: ALOpsDockerStart@1
    displayName: "ALOPS - Start Docker Container" # No need to provide any details - it will get the details from previous step

  - task: ALOpsDockerWait@1
    displayName: "ALOPS - Wait for Docker Container to start"
    inputs:
      search_string: "Ready for connections!"

  #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  - task: ALOpsLicenseImport@1
    displayName: "ALOPS - License Import"
    inputs:
      usedocker: true
      license_path: $(LicenseFile2)

  - task: ALOpsAppCompiler@1
    displayName: "ALOPS - Compile Extension"
    inputs:
      usedocker: true
      targetproject: 'app.json'
      nav_app_version: '1.0.[yyyyWW].*'
      failed_on_warnings: true

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

  - task: ALOpsAppTest@1
    displayName: "ALOPS - Run TestSuite"
    inputs:
      usedocker: true
      import_action: "Skip"
      show_available_tests: true
      import_testtoolkit: true
      failed_test_action: "Ignore"
      testfilter: 50133
    continueOnError: true

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

  #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

  - task: ALOpsDockerRemove@1
    displayName: "ALOPS - Remove Docker Container"
    enabled: true
    condition: always()

I've tried many adjustments to these files but nothing seems to work. Any idea what the problem might be?

Thank you.

waldo1001 commented 2 years ago

V20 uses a complete different way of running tests and installing apps and such.

this is not necessary in the yaml: "test": "20.0.0.0"

This example should help you: https://github.com/HodorNV/ALOps/blob/master/Examples/06_UseDocker_TestTool_v15_Multiroot.yml it shows how to run tests from v15 upwards.

There is a step that installs the test-apps in the container:

- task: ALOpsAppPublish@1
  displayName: 'ALOPS - Install AL TestTool' # install necessary dependent apps for testability
  inputs:
    usedocker: true
    installaltesttool: true
    skip_verification: true
    install_al_app_names: |
     Tests-TestLibraries
     System Application Test
     System Application Test Library
     Any
     Library Assert
     Test Runner
     Permissions Mock
     Library Variable Storage

And also the test-run is different:


- task: ALOpsAppTest@1
  displayName: 'ALOPS - Run TestSuite'
  inputs:
    usedocker: true
    import_action: "Skip"
    import_testtoolkit: false
    testpage: '130455'
    testsuite: 'DEFAULT'
    failed_test_action: 'Ignore'
  continueOnError: true   
Brunoalves5 commented 2 years ago

I adapted that file to my project, but now I get a different error on "ALOPS - Run TestSuite" step saying that it cant build my test page:

*** Set Docker Container ErrorActionPreference = Stop
*** Copy Modules to Docker
*** Setup Docker Session
*** Checking for container-specific Test Assemblies
*** Using container-specific Test Assemblies
*** Import Modules in Docker Session
*** Import UI Client [C:\Run\DevOps\BCAppTest\bin\Microsoft.Dynamics.Framework.UI.Client.dll]
VERBOSE: Loading module from path 'C:\Run\DevOps\BCAppTest\bin\Microsoft.Dynamics.Framework.UI.Client.dll'.
*** Import NewtonSoft JSON [C:\Program Files\Microsoft Dynamics NAV\200\Service\Newtonsoft.Json.dll]
*** Import Modules in Docker Session: class_ClientContext
*** Test Context Url: https://aef4321ab483/BC/cs?tenant=default
*** Setup BC Credentials in Docker
*** Resolve Docker Credentials
*** Set TCP Keep-Alive
*** Start TestSuite
*** Running TestSuite with authentication [NavUserPassword] with User [admin]
*** Run warm-up with page [50133]
*** Warm-up Client Context
ERROR DIALOG: Cannot build the page 50133.
The metadata object Page 50133 was not found.
*** Create Client Context
*** Get Available Tests for suite [DEFAULT] with page [50133]
Show dialog 00000000-0000-0000-0800-0000836bd2d2
Title: Dialog 
ERROR DIALOG: Cannot build the page 50133.
The metadata object Page 50133 was not found.
##[error]Run-Test-Exception: Cannot open page 50133. You might need to import the test toolkit to the container and/or remove the folder  and retry. You might also have URL or Company name wrong.
*** Get XUnit Test file from [] to [C:\agent\_work\5\s\]
##[error]Cannot bind argument to parameter 'Path' because it is null.
Finishing: ALOPS - Run TestSuite

I've checked and the page ID is correct, I also separated the test page to a separate 'test' app (to make it more similar to your example).

The yaml file:

name: $(Build.BuildId)

# trigger:
#  branches:
#    include:
#      - master
#      - main

variables:
- group: 'VariablesBuild'  # link to a variable group that has secret variables, like URL to license file, or sasToken for insider builds

pool: MyAgentPool

steps:
- checkout: self
  clean: true 

- task: ALOpsDockerCreate@1
  displayName: 'ALOPS - Create Docker Image' # It will reuse the image if already exists, or build one if it doesn't.
  inputs:
    artifacttype: Sandbox

- task: ALOpsDockerStart@1
  displayName: 'ALOPS - Start Docker Container' # No need to provide any details - it will get the details from previous step

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

- task: ALOpsLicenseImport@1
  displayName: 'ALOPS - License Import'
  inputs:
    usedocker: true
    license_path: '$(LicenseFile2)'  # more info: https://www.youtube.com/watch?v=iVLOerdCuwA&t=3078s

 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

- task: ALOpsAppPublish@1
  displayName: 'ALOPS - Install AL TestTool' # install necessary dependent apps for testability
  inputs:
    usedocker: true
    installaltesttool: true
    skip_verification: true
    install_al_app_names: |
     Tests-TestLibraries
     System Application Test
     System Application Test Library
     Any
     Library Assert
     Test Runner
     Permissions Mock
     Library Variable Storage

#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

- task: ALOpsAppCompiler@1
  displayName: 'ALOPS - Compile Extension: App'
  inputs:
    usedocker: true
    nav_app_version: '1.0.[yyyyWW].*'
    targetproject: 'app/app.json'                            # The App
    failed_on_warnings: true
    app_file_suffix: '_APP'                                 # A trick to uniquely identify the APP (from the TEST-app)

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

- task: ALOpsAppCompiler@1
  displayName: 'ALOPS - Compile Extension: App'
  inputs:
    usedocker: true
    nav_app_version: '1.0.[yyyyWW].*'
    targetproject: 'test/app.json'                           # The Test-App
    failed_on_warnings: true
    app_file_suffix: '_TEST'                                 # A trick to uniquely identify the Test-App (from the App)

- task: ALOpsAppPublish@1
  displayName: 'ALOPS - Publish Extension'
  inputs:
    usedocker: true
    nav_artifact_app_filter: '*.app'
    skip_verification: true
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

- task: ALOpsAppTest@1
  displayName: 'ALOPS - Run TestSuite'
  inputs:
    usedocker: true
    import_action: "Skip"
    import_testtoolkit: false
    testpage: '50133'
    testsuite: 'DEFAULT'
    failed_test_action: 'Ignore'
  continueOnError: true   

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

#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

- task: ALOpsDockerRemove@1
  displayName: 'ALOPS - Remove Docker Container'
  enabled: true
  condition: always()
waldo1001 commented 2 years ago

Why don't you use the default page?

Can't say much about custom pages where the pipeline says it doesn't find or doesn't work 🤷‍♀️.

Brunoalves5 commented 2 years ago

You're right, I didn't know that was the default test page in the example, I thought I had to declare my own test page.

But it works with the default :)