microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
386 stars 247 forks source link

TestApps are missing in BCImage for Next Major #2907

Closed NAVRockClimber closed 1 year ago

NAVRockClimber commented 1 year ago

PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!

Describe the issue

If I run New-BCImage the TestApps are not installed or synced:

Scripts used to create container and cause the issue

$artifacturl=Get-BCArtifactUrl -country de -type Sandbox -select NextMajor -sasToken $sastoken
New-BCImage -includePerformanceToolkit -includeTestToolkit -includeTestLibrariesOnly -memory 10G -artifactUrl $ArtifactURl -imageName "myregistry.azurecr.io/bcinsider/cosmo-bc:sandbox-22.0.52926.0-de"

Full output of scripts

WARNING: Unable to find matching generic image for your host OS. Using mcr.microsoft.com/businesscentral:10.0.20348.1487
cosmoppi.azurecr.io/bcinsider/cosmo-bc:sandbox-22.0.52926.0-de
Building image cosmoppi.azurecr.io/bcinsider/cosmo-bc:sandbox-22.0.52926.0-de based on mcr.microsoft.com/businesscentral:10.0.20348.1487 with https://bcinsider.azureedge.net/sandbox/22.0.53021.0/de
Pulling latest image mcr.microsoft.com/businesscentral:10.0.20348.1487
10.0.20348.1487: Pulling from businesscentral
Digest: sha256:c4b4a98fb5ebecb8dc95a1c9ba9f6afbb98c103ff167ea21bc254044e6b08a16
Status: Image is up to date for mcr.microsoft.com/businesscentral:10.0.20348.1487
mcr.microsoft.com/businesscentral:10.0.20348.1487
Generic Tag: 1.0.2.14
Container OS Version: 10.0.20348.1487 (ltsc2022)
Host OS Version: 10.0.22000.1455 (21H2)
Using process isolation
Files in c:\bcartifacts.cache\gjqfotpt.3yc\my:
Copying Platform Artifacts
c:\bcartifacts.cache\sandbox\22.0.53021.0\platform
Copying Database
Copying Licensefile
Copying ConfigurationPackages
C:\bcartifacts.cache\sandbox\22.0.53021.0\de\ConfigurationPackages
Copying Extensions
C:\bcartifacts.cache\sandbox\22.0.53021.0\de\Extensions
Copying Applications.DE
C:\bcartifacts.cache\sandbox\22.0.53021.0\de\Applications.DE
c:\bcartifacts.cache\gjqfotpt.3yc
Cannot include TestToolkit without a licensefile, please specify licensefile
Sending build context to Docker daemon  2.439GB

Step 1/6 : FROM mcr.microsoft.com/businesscentral:10.0.20348.1487
 ---> 113b079c6f47
Step 2/6 : ENV DatabaseServer=localhost DatabaseInstance=SQLEXPRESS DatabaseName=CRONUS IsBcSandbox=Y artifactUrl=https://bcinsider.azureedge.net/sandbox/22.0.53021.0/de?sv=2021-06-08&ss=b&srt=sco&spr=https&st=2022-09-15T00%3A00%3A00Z&se=2023-04-01T00%3A00%3A00Z&sp=rl&sig=rBQiC8y0zbuWC66i2BJcVhydR3XD2aaz47aJ6q6zEss%3D filesOnly=False
 ---> Running in f41909c33b9e
Removing intermediate container f41909c33b9e
 ---> 5935aee6ca6c
Step 3/6 : COPY my /run/
 ---> 59c2d043434e
Step 4/6 : COPY NAVDVD /NAVDVD/
 ---> 9f32c4668d7f
Step 5/6 : RUN \Run\start.ps1 -installOnly -multitenant -includeTestToolkit -includeTestLibrariesOnly -includePerformanceToolkit
 ---> Running in fb7df85806f4
c:\run\my folder doesn't exist, creating it
Using installer from C:\Run\210-new
Installing Business Central
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 PowerShell Scripts
C:\NAVDVD\WindowsPowerShellScripts\Cloud\NAVAdministration
C:\NAVDVD\WindowsPowerShellScripts\WebSearch
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 Extensions
C:\NAVDVD\Extensions
Copying Applications
C:\NAVDVD\Applications
Copying Applications.DE
C:\NAVDVD\Applications.DE
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Removing Application from tenant
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
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Stopping Business Central Service Tier
Installation took 294 seconds
Installation complete
Removing intermediate container fb7df85806f4
 ---> d1cf56edcebe
Step 6/6 : LABEL legal="http://go.microsoft.com/fwlink/?LinkId=837447"       created="202302080643"       nav=""       cu=""       multitenant="Y" country="DE"       version="22.0.53021.0"       platform="22.0.52983.0"
 ---> Running in 4886d55253ff
Removing intermediate container 4886d55253ff
 ---> 84bc9ce48069
Successfully built 84bc9ce48069
Successfully tagged myregistry.azurecr.io/bcinsider/cosmo-bc:sandbox-22.0.52926.0-de
Building image took 837 seconds

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

This is probably another dotnet 6 issue.

See: https://github.com/microsoft/nav-docker/blob/f6474a40f7d2b6cdb600c51a2f2773d2aba7f369/generic/Run/210-new/navinstall.ps1#L354

freddydk commented 1 year ago

I think this is caused by the comment in line 30:

Cannot include TestToolkit without a licensefile, please specify licensefile
NAVRockClimber commented 1 year ago

This shouldn't be an problem according to issue #2868 But maybe it is a good idea to remove this message for versions above 21.0?

I bet a beer at the next TechDays it is these lines ;) https://github.com/microsoft/nav-docker/blob/f6474a40f7d2b6cdb600c51a2f2773d2aba7f369/generic/Run/210-new/navinstall.ps1#L354

if (Test-Path "$serviceTierFolder\Microsoft.Dynamics.Nav.Apps.Management.psd1") {
            Import-Module "$serviceTierFolder\Microsoft.Dynamics.Nav.Apps.Management.psd1"
freddydk commented 1 year ago

Yeah - these lines are wrong. And yes - we should be able to include test framework also without a license - I guess that check has been there for a long time. Will double check.

freddydk commented 1 year ago

There are really 2 bugs. This check should be changed. image and this check should be changed for 22 image

NAVRockClimber commented 1 year ago

@freddydk do you have an ETA for a fix? My co-workers are getting a little bit impatient.

freddydk commented 1 year ago

I will provide a workaround today

freddydk commented 1 year ago

For now - if you add:

 -myscripts @("https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/210-new/navinstall.ps1")

to your New-BcImage (if you are using version 21 or above) - then it should work. It still will only work if you provide the license file, it has been like that forever (will fix after my vacation)

NAVRockClimber commented 1 year ago

Thanks, have a nice vacation. :)

lippertmarkus commented 1 year ago

@freddydk any updates on a fix regarding the license requirement for 22 or at least a workaround like for 21.0 (https://github.com/microsoft/navcontainerhelper/pull/2869/files)?

freddydk commented 1 year ago

@freddydk any updates on a fix regarding the license requirement for 22 or at least a workaround like for 21.0 (https://github.com/microsoft/navcontainerhelper/pull/2869/files)?

Version 22 doesn't require a license anymore - I will remove the "warning" if version is >= 22.0.0.0

All generic docker images for the latest Windows versions have the fix for this. Some of the older images (for Windows versions not updated after February this year) does not have the fix. I won't fix the older unsupported Windows versions.