Skip to content

[Bug]: New-BCImage triggered by pipeline does not add test toolkit to installation #2076

@frottke

Description

@frottke

AL-Go version

8.1 and 8.0

Describe the issue

There appears to be an issue that affects only self hosted runners and and perhaps also custom image GitHub hosted runners (persistent storage).

When running CI CD pipelines or pull request builds, the Business Central test libraries and test toolkits are not included in the generated Business Central container. The container image is created without these components, which means they must be installed later during the Import Test Toolkit step. This significantly increases the pipeline runtime by roughly one minute compared to having the test components baked directly into the container image.

A workaround is available by overriding New-BcContainer via a custom New BcContainer.ps1 script.

Param(
    [Hashtable]$parameters
)

$parameters.includePerformanceToolkit = $true
$parameters.includeTestLibrariesOnly = $true

New-BcContainer @parameters

This may ultimately be a BCContainerHelper issue, although the code itself appears correct. The parameters logged in the workflow output show the expected values, yet they are apparently not the same values that are actually passed into the internal call to New-BcContainer.

As a suggestion, when the corresponding parameters are set, the test toolkit and test libraries could be baked directly into the container image instead of being imported later (like it is scripted in bccontainerhelper). This would keep the current default behavior unchanged, while significantly reducing pipeline runtime in scenarios where images are reused and the parameters explicitly request these components.

Expected behavior

These variables should be true, "includeTestToolkit", "includeTestLibrariesOnly", "includeTestFrameworkOnly". But at minimum "includeTestToolkit"

Steps to reproduce

Repository with an test app, therefore the parameters are set for importing the test toolkit.

Additional context (logs, screenshots, etc.)

Parameters:


    _____                               _
   |  __ \                             | |
   | |__) |_ _ _ __ __ _ _ __ ___   ___| |_ ___ _ __ ___
   |  ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __|
   | |  | (_| | | | (_| | | | | | |  __/ |_  __/ |  \__ \
   |_|   \__,_|_|  \__,_|_| |_| |_|\___|\__\___|_|  |___/
  
  Pipeline name                   CI/CD
  Container name                  bc20717254212
  Image name                      my
  ArtifactUrl                     https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/onprem/26.0.30643.32481/de
  BcAuthContext                   Not Specified
  Environment                     
  ReUseContainer                  False
  KeepContainer                   False
  useCompilerFolder               False
  artifactCachePath               
  useDevEndpoint                  False
  Auth                            UserPassword
  CompanyName                     
  MemoryLimit                     20G
  FailOn                          error
  TreatTestFailuresAsWarnings     False
  Enable Task Scheduler           False
  Assign Premium Plan             False
  Install Test Runner             True
  Install Test Framework          True
  Install Test Libraries          True
  Install Perf. Toolkit           False
  InstallOnlyReferencedApps       False
  generateDependencyArtifact      True
  CopySymbolsFromContainer        False
  enableCodeCop                   True
  enableAppSourceCop              False
  enableUICop                     True
  enablePerTenantExtensionCop     False
  enableCodeAnalyzersOnTestApps   False
  doNotPerformUpgrade             False
  doNotPublishApps                False
  uninstallRemovedApps            True
  escapeFromCops                  False
  doNotBuildTests                 False
  doNotRunTests                   False
  doNotRunBcptTests               True
  doNotRunPageScriptingTests      False
  azureDevOps                     False
  gitLab                          False
  gitHubActions                   True
  vsixFile                        latest
  License file                    Specified
  Install Apps
  - dependencies
  Install Test Apps
  - None
  Previous Apps
  - None
  Application folders
  - C:\6\_work\dummy\dummy\app
  Test application folders
  - C:\6\_work\dummy\dummy\test
  BCPT Test application folders
  - None
  BCPT Test suites
  - None

But when New-BCImage is called:

Creaing docker container
BcContainerHelper is version 6.1.10
BcContainerHelper is running as administrator
HyperV is Enabled
Host is Microsoft Windows Server 2022 Standard - 10.0.20348.4529
UsePsSession is True
UsePwshForBc24 is True
UseWinRmSession is allow
UseSslForWinRmSession is True
Docker Client Version is 28.5.1
Docker Server Version is 28.5.1
Removing Desktop shortcuts
Download-Artifacts Telemetry Correlation Id: ba52a538-e158-4cc6-b7bc-0777d010637d
Fetching all docker images
Fetching all docker volumes
ArtifactUrl and ImageName specified
Download-Artifacts Telemetry Correlation Id: 9a7b8279-30ee-4afc-97fc-8ffccb3e60ac
Building image my:onprem-26.0.30643.32481-de based on mcr.microsoft.com/businesscentral:ltsc2022 with https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/onprem/26.0.30643.32481/de
Pulling latest image mcr.microsoft.com/businesscentral:ltsc2022
ltsc2022: Pulling from businesscentral
Generic Tag: 1.0.2.88
Container OS Version: 10.0.20348.4529 (ltsc2022)
Host OS Version: 10.0.20348.4529 (ltsc2022)
Host and container OS match, recommended isolation mode is process.
Using process isolation
Using license file "dummy"
Downloading c:\bcartifacts.cache\wpvekoqs.scm\my\license.bclicense
Files in c:\bcartifacts.cache\wpvekoqs.scm\my:
- license.bclicense
Copying Platform Artifacts
c:\bcartifacts.cache\onprem\26.0.30643.32481\platform
Copying Database
Copying Licensefile
Copying ConfigurationPackages
C:\bcartifacts.cache\onprem\26.0.30643.32481\de\ConfigurationPackages
Copying Applications
C:\bcartifacts.cache\onprem\26.0.30643.32481\de\Applications
c:\bcartifacts.cache\wpvekoqs.scm
Sending build context to Docker daemon    2.7GB

Step 1/6 : FROM mcr.microsoft.com/businesscentral:ltsc2022
 ---> 6e77476a8d45
Step 2/6 : ENV DatabaseServer=localhost DatabaseInstance=SQLEXPRESS DatabaseName=CRONUS IsBcSandbox=N artifactUrl=https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/onprem/26.0.30643.32481/de filesOnly=False
 ---> Running in ce0e76acfe81
 ---> Removed intermediate container ce0e76acfe81
 ---> c9942dc482c8
Step 3/6 : COPY my /run/
 ---> b5ba1b8c6e7b
Step 4/6 : COPY NAVDVD /NAVDVD/
 ---> 7b1ac3896548
Step 5/6 : RUN \Run\start.ps1 -installOnly
 ---> Running in ae646b0192c9
c:\run\my folder doesn't exist, creating it
Using DVD installer from C:\Run\260
Installing Business Central: multitenant=False, installOnly=True, filesOnly=False, includeTestToolkit=False, includeTestLibrariesOnly=False, includeTestFrameworkOnly=False, includePerformanceToolkit=False, appArtifactPath=, platformArtifactPath=, databasePath=, licenseFilePath=, rebootContainer=False
Installing from DVD
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
C:\NAVDVD\ServiceTier\Program Files
C:\NAVDVD\ServiceTier\System64Folder
Copying Web Client Files
C:\NAVDVD\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
C:\NAVDVD
C:\NAVDVD\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\NAVDVD\ConfigurationPackages
Copying Test Assemblies
C:\NAVDVD\Test Assemblies
Copying Applications
C:\NAVDVD\Applications
Copying dependencies
Importing PowerShell Modules
Restoring CRONUS Demo Database
Setting CompatibilityLevel for CRONUS on localhost\SQLEXPRESS
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Starting Business Central Service Tier
Importing CRONUS license file
Stopping Business Central Service Tier
Installation took 229 seconds
Installation complete
 ---> Removed intermediate container ae646b0192c9
 ---> 5f8893c740ce
Step 6/6 : LABEL legal="http://go.microsoft.com/fwlink/?LinkId=837447"       created="202601051410"       nav=""       cu=""       country="de"       version="26.0.30643.32481"       platform="26.0.32469.0"
 ---> Running in bfee76660d9b
 ---> Removed intermediate container bfee76660d9b
 ---> cebf5ad7704f
Successfully built cebf5ad7704f
Successfully tagged my:onprem-26.0.30643.32481-de

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions