HodorNV / ALOps

ALOps
59 stars 24 forks source link

Improved Error Handling for ALOpsAppCompiler v2 for NextMinor/NextMajor: Cannot bind argument to parameter 'artifactUrl' because it is an empty string. #626

Open DanielGoehler opened 1 year ago

DanielGoehler commented 1 year ago

Is your feature request related to a problem? Please describe. Twice a year, when a new BC version is released, Get-BCArtifactUrl fails to return an artifactUrl from 9:00 till 17:00, causing our NextMinor and NextMajor pipelines to fail.

E.g.:

Describe the solution you'd like I suggested that BCContainerHelper could output the BC version before, so at least the pipelines will not fail. In a first answer Feddy thinks that this should be implemented in the pipeline (https://github.com/microsoft/navcontainerhelper/issues/2960#issuecomment-1495420602). This would mean in ALOps.

Describe alternatives you've considered At least a better error message would be nice like "Artifact download is currently not possible because the artifactUrl is empty".

Additional context Add any other context or screenshots about the feature request here.

image

the yaml

- task: ALOpsAppCompiler@2
  inputs:
    artifacttype: 'Sandbox'
    artifactcountry: 'de'
    versionselect: 'NextMajor'
    appversiontemplate: '$(AppVersion)'
    alcodeanalyzer: 'AppSourceCop,CodeCop,PerTenantExtensionCop,UICop'
    publishartifact: false
    sastoken: '$(sasToken)'

the output

##[section]Starting: ALOpsAppCompiler
==============================================================================
Task         : ALOps App Compiler
Description  : Compile AL Extension(s) for Business Central
Version      : 2.0.3577
Author       : Hodor
Help         : Compile Business Central extension(s) from AL code.
==============================================================================
******************************************************************************
*** ALOps v2 - Preview                                                     ***
******************************************************************************
*** Importing required ALOps-Functions
*** Task Inputs:

name                                             value                                                                 
----                                             -----                                                                 
artifactversion                                                                                                        
artifacttype                                     Sandbox                                                               
artifactcountry                                  de                                                                    
versionselect                                    NextMajor                                                             
alternativevsixurl                                                                                                     
alsourcepath                                     C:\agent\_work\31\s                                                   
ruleset                                                                                                                
suppresswarnings                                 KEEP                                                                  
appversiontemplate                               ?.?.0.*                                                               
updatebuildnumber                                True                                                                  
appfilenametemplate                              %APP_PUBLISHER%_%APP_NAME%_%APP_VERSION%_%BC_TYPE%_%BC_VERSION%_%BC...
alcodeanalyzer                                   AppSourceCop,CodeCop,PerTenantExtensionCop,UICop                      
ignorepragmas                                                                                                          
enable_external_rulesets                         False                                                                 
showmycode                                       Keep                                                                  
resourceexposurepolicy_allowdebugging            Keep                                                                  
resourceexposurepolicy_allowdownloadingsource    Keep                                                                  
resourceexposurepolicy_includesourceinsymbolfile Keep                                                                  
internalsvisibleto                               Keep                                                                  
preprocessorsymbols                                                                                                    
applicationinsightskey                                                                                                 
alcachepath                                      C:\agent\_work\31\s                                                   
publishartifact                                  False                                                                 
publishxlif                                      False                                                                 
failonwarnings                                   False                                                                 
storageaccount                                                                                                         
sastoken                                         ...
printappmanifest                                 True                                                                  
outputalclogs                                    True                                                                  
additionalprobingpaths                                                                                                 

*** For documentation, please visit   : https://www.alops.be/documentation

*** Importing required Task-Functions

*** Artifact Type   : [Sandbox]
*** Artifact Version: []
*** Artifact Country: [de]
*** AL Source Path  : [C:\agent\_work\31\s]
*** AL Cache Path   : [C:\agent\_work\31\s]

*** Default Working Folder: C:\agent\_work\31\s
*** Artifact Folder       : C:\agent\_work\31\a
*** Agent Tool Folder     : C:\agent\_work\_tool
*** Agent Temp Folder     : C:\agent\_work\_temp

*** Resolving Path: [C:\agent\_work\31\s]
*** AL Source Folder      : C:\agent\_work\31\s
*** Resolving Path: [C:\agent\_work\31\s]
*** AL Cache Folder       : C:\agent\_work\31\s

*** Check BcContainerHelper
*** Load BcContainerHelper
BcContainerHelper version 4.0.14
BC.HelperFunctions emits usage statistics telemetry to Microsoft

##[command]"Get-BCArtifactUrl" 
Name                           Value                                                                                   
----                           -----                                                                                   
sasToken                       ...
select                         NextMajor                                                                               
type                           Sandbox                                                                                 
country                        de                                                                                      

 -sasToken: *** -select: NextMajor -type: Sandbox -country: de
##[error]Das Argument kann nicht an den Parameter "artifactUrl" gebunden werden, da es sich um eine leere Zeichenfolge handelt.
##[section]Finishing: ALOpsAppCompiler
waldo1001 commented 1 year ago

Freddy 's opinion that it should be solved in the pipeline doesn't make this is an ALOps-issue ;-).

As I understand it - Get-BcArtifactUrl returns nothing while it should return something. For me, that's clearly an issue in the Get-BcArtifactUrl function 🤷‍♂️.

Seems that Freddy still "needs to think that through" .. so let's see what he comes up with.

DanielGoehler commented 1 year ago

You know what I mean. I can't change the inner workings of the ALOpsAppCompiler v2 task. If you have a better idea to solve this problem, please let me know. This caused a lot of confusion for my collages yesterday.

waldo1001 commented 1 year ago

Sorry - I didn't want to sound that we wanted to avoid this issue. We'll improve the error message.

What we will also do is implement a new parameter: "artifacturl", which will overrule any "Get-BCArtifact", and which makes you possible to even use local downloads, or implement your own logic in retrieving nextmajor.

DanielGoehler commented 1 year ago

@waldo1001 No problem. Most of the time it is not that important. A better error message would be a nice improvement. Even better if I can implement a fallback when Get-BCArtifact doesn't return anything.