HodorNV / ALOps

ALOps
56 stars 24 forks source link

ALOpsAppLicenseCheck 1.459.4971 now detects temporary tables as unlicensed object #682

Closed DanielGoehler closed 6 months ago

DanielGoehler commented 11 months ago

Describe the bug With the new version 1.459.4971 of ALOpsAppLicenseCheck it doesn't recognize that a table is temporary and deactivates it as an unlicensed object. In version 1.458.4912 it worked correctly the last time.

waldo1001 commented 11 months ago

Are you sure? We have parameters to exclude temp tables - there is no "interpreter" of temp tables that would have done that automagically in the base...

Check the parameter exclude_ranges: https://docs.alops.be/ALOpsSteps/Buildstepsv1/#alops_app_license_check

DanielGoehler commented 11 months ago

Yes, I'm sure. The temporary table 73384 was created on 2021-02-11 and has been there for a longer time, the BC version is 21.4 for a longer time and the license is also the same. The only thing that has changed is the version of ALOpsAppLicenseCheck. (I removed some lines and mask some words for privacy reasons.)

Version 1.458.4912 on 2023-09-22:

##[section]Starting: App License Check
==============================================================================
Task         : ALOps App License Check
Description  : Check App files agains a license
Version      : 1.458.4912
Author       : Hodor
Help         : Check App files agains a license.
==============================================================================
*** Validate configuration
*** Task Inputs:

name                                                      value
----                                                      -----
usedocker                                                 False
fixed_tag                                                      
licensefile      C:\agent\_work\540\s\CustomerLicence.bclicense
artifact_path                              C:\agent\_work\540\a
artifact_filter                                           *.app
artifact_include                                               
artifact_exclude                                       *OPplus*
exclude_ranges                5111082..5111082,5111091..5111091

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

*** Imported required PS-Functions
*** Parse Task Parameters
*** Load Management DLL's
*** Import NAV/BC Management DLL's [True]
*** ServiceTier not specified, loading default assemblies.
*** Default Assemblies not found. Load via BC-Artifacts
*** Install/Update BCContainerHelper [https://github.com/microsoft/navcontainerhelper]
*** Check BcContainerHelper
*** Load BcContainerHelper
BcContainerHelper version 5.0.4
BC.HelperFunctions emits usage statistics telemetry to Microsoft

ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Script     5.0.4      BcContainerHelper                   {Add-FontsToBcContainer, Add-GitToAlProjectFolder, AddTele...

##[command]"Get-BCArtifactUrl" 
Name                           Value                                                                                   
----                           -----                                                                                   
select                         Latest                                                                                  
type                           OnPrem                                                                                  
country                        W1                                                                                      

 -select: Latest -type: OnPrem -country: W1
Downloading artifact /onprem/22.5.59966.60134/w1
Downloading C:\Users\script-service\AppData\Local\Temp\0d66d1f4-e920-439b-a6f4-10407a3f92ec.zip
Downloading using WebClient
Unpacking artifact to tmp folder using 7zip
Downloading platform artifact /onprem/22.5.59966.60134/platform
Downloading C:\Users\script-service\AppData\Local\Temp\fe8c14fd-fb4b-45ee-bf7e-33a1a1f484e4.zip
Downloading using WebClient
Unpacking platform artifact to tmp folder using 7zip
Downloading Prerequisite Components
Downloading C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
Downloading using WebClient
Downloading C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
Downloading using WebClient
*** Platform: C:\bcartifacts.cache\onprem\22.5.59966.60134\platform
*** Localisation: C:\bcartifacts.cache\onprem\22.5.59966.60134\w1
*** BC NCL Management DLL: C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Ncl.dll
*** BC Types DLL: C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Types.dll
*** Selected module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Types.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Types.dll]
*** BC Management DLL: C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Management.dll
*** Selected module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Management.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Management.dll]
*** BC App Management DLL: C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll
*** Selected module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll]
*** Load CodeAnalysis from [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management]
*** Loading assemblies from: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management]
*** Loading: [C:\bcartifacts.cache\onprem\22.5.59966.60134\platform\ServiceTier\program files\Microsoft Dynamics NAV\220\Service\Management\Microsoft.Dynamics.Nav.CodeAnalysis.dll]
*** Import BCLicenseReader
*** Excluded Ranges:

   from      to
   ----      --
5111082 5111082
5111091 5111091

*** Get License: [C:\agent\_work\540\s\CustomerLicence.bclicense]
*** Read License from disk: [C:\agent\_work\540\s\CustomerLicence.bclicense]
*** Read License from disk: [C:\agent\_work\540\s\CustomerLicence.bclicense]
*** App License Check: [C:\agent\_work\540\a]
*** Resolved Path  : C:\agent\_work\540\a
*** Apps to process:

Name                                                                            
----                    
Company_XXX-BaseApp_21.4.37080.0.app                             

*** Detect license format
*** Parsing Format: BCLicense
*** License Header
Microsoft Software License Information
Copyright (C) 2007-2022 Microsoft Corporation. All rights reserved
****************************************************************************
Produkt Linie           : Microsoft Dynamics 365 Business Central on premises
Produkt-Edition         : Premium
Produkt-Version         : 21
Land                    : Germany
Sprache                 : German
Erstellungsdatum        : 04.05.2023 01:14:48 (-07:00)
Erstes Registrierungsdatum : 2 September 2020
****************************************************************************
Name                                                                  Anzahl
----------------------------------------------------------------- ----------
Country Code: Germany                                                      1
Dyn365 Business Central Application Builder                                1
Dyn365 Business Central Codeunits (100)                                  300
Dyn365 Business Central Codeunits (each)                                  20
Dyn365 Business Central Pages (100)                                      900
Dyn365 Business Central Premium                                           68
Dyn365 Business Central Premium - Upgrade                                136
Dyn365 Business Central Queries (100)                                    100
Dyn365 Business Central Reports (100)                                    600
Dyn365 Business Central Tables (10)                                      150
Dyn365 Business Central XML Ports (100)                                  200
****************************************************************************

*** Checking License against App: Company_XXX-BaseApp_21.4.37080.0.app
  * All Objects are Licensed [256]

*** Cleanup VSTS Environment: True
##[section]Finishing: App License Check

Version 1.459.4971 on 2023-10-11:

##[section]Starting: App License Check
==============================================================================
Task         : ALOps App License Check
Description  : Check App files agains a license
Version      : 1.459.4971
Author       : Hodor
Help         : Check App files agains a license.
==============================================================================
*** Validate configuration
*** Task Inputs:

name                                                      value
----                                                      -----
usedocker                                                 False
fixed_tag                                                      
licensefile      C:\agent\_work\597\s\CustomerLicence.bclicense
artifact_path                              C:\agent\_work\597\a
artifact_filter                                           *.app
artifact_include                                               
artifact_exclude                                       *OPplus*
exclude_ranges                5111082..5111082,5111091..5111091
warning_only                                              False

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

*** Imported required PS-Functions
*** Parse Task Parameters
*** Load Management DLL's
*** Import NAV/BC Management DLL's [True]
*** ServiceTier not specified, loading default assemblies.
*** Default Assemblies not found. Load via BC-Artifacts
*** Install/Update BCContainerHelper [https://github.com/microsoft/navcontainerhelper]
*** Check BcContainerHelper
*** Load BcContainerHelper
BcContainerHelper version 6.0.0
BC.HelperFunctions emits usage statistics telemetry to Microsoft

ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Script     6.0.0      BcContainerHelper                   {Add-FontsToBcContainer, Add-GitToAlProjectFolder, AddTele...

##[command]"Get-BCArtifactUrl" 
Name                           Value                                                                                   
----                           -----                                                                                   
select                         Latest                                                                                  
type                           OnPrem                                                                                  
country                        W1                                                                                      

 -select: Latest -type: OnPrem -country: W1
Downloading artifact /onprem/23.0.12034.12841/w1
Downloading C:\Users\script-service\AppData\Local\Temp\94f3ddfd-f469-4abf-8050-779fb887cd48.zip
Downloading using WebClient
Unpacking artifact to tmp folder using 7zip
Downloading platform artifact /onprem/23.0.12034.12841/platform
Downloading C:\Users\script-service\AppData\Local\Temp\0b9f42b0-338b-492e-8ddf-f6453ef69079.zip
Downloading using WebClient
Unpacking platform artifact to tmp folder using 7zip
Downloading Prerequisite Components
Downloading C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
Downloading using WebClient
Downloading C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
Downloading using WebClient
*** Platform: C:\bcartifacts.cache\onprem\23.0.12034.12841\platform
*** Localisation: C:\bcartifacts.cache\onprem\23.0.12034.12841\w1
*** BC NCL Management DLL: C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Ncl.dll
*** BC Types DLL: C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Types.dll
*** Selected module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Types.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Types.dll]
*** BC Management DLL: C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Management.dll
*** Selected module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Management.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Management.dll]
*** BC App Management DLL: C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll
*** Selected module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll]
*** Loading module: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.Apps.Management.dll]
*** Load CodeAnalysis from [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management]
*** Loading assemblies from: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management]
*** Loading: [C:\bcartifacts.cache\onprem\23.0.12034.12841\platform\ServiceTier\program files\Microsoft Dynamics NAV\230\Service\Management\Microsoft.Dynamics.Nav.CodeAnalysis.dll]
*** Import BCLicenseReader
*** Excluded Ranges:

   from      to
   ----      --
5111082 5111082
5111091 5111091

*** Get License: [C:\agent\_work\597\s\CustomerLicence.bclicense]
*** Read License from disk: [C:\agent\_work\597\s\CustomerLicence.bclicense]
*** Read License from disk: [C:\agent\_work\597\s\CustomerLicence.bclicense]
*** App License Check: [C:\agent\_work\597\a]
*** Resolved Path  : C:\agent\_work\597\a
*** Apps to process:

Name                                                                            
----                                                                   
Company_GKM-BaseApp_21.4.37997.0.app                             

*** Detect license format
*** Parsing Format: BCLicense
*** License Header
Microsoft Software License Information
Copyright (C) 2007-2022 Microsoft Corporation. All rights reserved
Produkt Linie           : Microsoft Dynamics 365 Business Central on premises
Produkt-Edition         : Premium
Produkt-Version         : 21
Land                    : Germany
Sprache                 : German
Erstellungsdatum        : 04.05.2023 01:14:48 (-07:00)
Erstes Registrierungsdatum : 2 September 2020
****************************************************************************
Name                                                                  Anzahl
----------------------------------------------------------------- ----------
Country Code: Germany                                                      1
Dyn365 Business Central Application Builder                                1
Dyn365 Business Central Codeunits (100)                                  300
Dyn365 Business Central Codeunits (each)                                  20
Dyn365 Business Central Pages (100)                                      900
Dyn365 Business Central Premium                                           68
Dyn365 Business Central Premium - Upgrade                                136
Dyn365 Business Central Queries (100)                                    100
Dyn365 Business Central Reports (100)                                    600
Dyn365 Business Central Tables (10)                                      150
Dyn365 Business Central XML Ports (100)                                  200
****************************************************************************

*** Checking License against App: Company_XXX-BaseApp_21.4.37084.0.app
*** Unlicensed Objects:

Object Type Object ID Object Name        
----------- --------- -----------        
  TableData     73384 PRI-XXX RM Overview

##[error]Company_XXX-BaseApp_21.4.37084.0.app contains 1 unlicensed objects
##[section]Finishing: App License Check
waldo1001 commented 11 months ago

I checked with the devteam, I think I understand the confusion now.

We solved a bug that when there was only one error, the pipeline succeeded. Now, since you only had one error, you never saw this as an error... .

That would kind of explain the situation here..

How the license-step works: we extract the range from your license, we list the objects, and we match it. We have no context of these objects.. . That's why we introduced the "exclude"-params...

DanielGoehler commented 11 months ago

Ok, would it be possible if the table is a temporary table and ignore this? They don't need to be licensed. I thought this happened before since table 73384 was never licensed.

waldo1001 commented 11 months ago

I understand that - but that's why we added the parameter.

We might be able to figure that out in our script - but all we do now is get a list of objects, that's all. No properties whatsoever. I don't know if we "just" can include some kind of parsing to get this info.. .

I'll put it on the "to be investigated" list. In the meantime, I'd agree internally on a "range to use for buffer tables", include that in ninja as a "buffer"-range, and set up the pipeline with that exclude.

waldo1001 commented 6 months ago

We found a way!

DanielGoehler commented 6 months ago

Thank you! Works fine.