diff --git a/BC.HelperFunctions.ps1 b/BC.HelperFunctions.ps1 index 610339be3..a3a3e2d1c 100644 --- a/BC.HelperFunctions.ps1 +++ b/BC.HelperFunctions.ps1 @@ -11,8 +11,8 @@ function Get-ContainerHelperConfig { if (!((Get-Variable -scope Script bcContainerHelperConfig -ErrorAction SilentlyContinue) -and $bcContainerHelperConfig)) { Set-Variable -scope Script -Name bcContainerHelperConfig -Value @{ "bcartifactsCacheFolder" = "" - "genericImageName" = 'mcr.microsoft.com/businesscentral:{0}' - "genericImageNameFilesOnly" = 'mcr.microsoft.com/businesscentral:{0}-filesonly' + "genericImageName" = 'mcr.microsoft.com/businesscentral:{1}' + "genericImageNameFilesOnly" = 'mcr.microsoft.com/businesscentral:{1}-filesonly' "usePsSession" = $true "usePwshForBc24" = $true "tryWinRmSession" = !$isAdministrator @@ -120,8 +120,8 @@ function Get-ContainerHelperConfig { } if ($isInsider) { - $bcContainerHelperConfig.genericImageName = 'mcr.microsoft.com/businesscentral:{0}-dev' - $bcContainerHelperConfig.genericImageNameFilesOnly = 'mcr.microsoft.com/businesscentral:{0}-filesonly-dev' + $bcContainerHelperConfig.genericImageName = 'mcr.microsoft.com/businesscentral:{1}-dev' + $bcContainerHelperConfig.genericImageNameFilesOnly = 'mcr.microsoft.com/businesscentral:{1}-filesonly-dev' } if ($bcContainerHelperConfigFile -notcontains (Join-Path $programDataFolder "BcContainerHelper.config.json")) { diff --git a/ContainerHandling/Get-BestGenericImageName.ps1 b/ContainerHandling/Get-BestGenericImageName.ps1 index 89a4ac074..ab680b82b 100644 --- a/ContainerHandling/Get-BestGenericImageName.ps1 +++ b/ContainerHandling/Get-BestGenericImageName.ps1 @@ -32,12 +32,24 @@ try { if ($build -eq -1) { $build = [int32]::MaxValue } $hostOsVersion = [System.Version]::new($hostOsVersion.Major, $hostOsVersion.Minor, $build, $revision) } + if ("$hostOsVersion" -lt [System.Version]"10.0.17763.0") { + # Everything before Windows Server 2019 uses ltsc2016 + $ltscVersion = 'ltsc2016' + } + elseif ("$hostOsVersion" -lt [System.Version]"10.0.20348.0") { + # Everything before Windows Server 2022 uses ltsc2019 + $ltscVersion = 'ltsc2019' + } + else { + # Default is ltsc2022 + $ltscVersion = 'ltsc2022' + } if ($filesOnly) { - $genericImageNameSetting = $bcContainerHelperConfig.genericImageNameFilesOnly + $genericImageNameSetting = $bcContainerHelperConfig.genericImageNameFilesOnly.Replace('{1}', $ltscVersion) } else { - $genericImageNameSetting = $bcContainerHelperConfig.genericImageName + $genericImageNameSetting = $bcContainerHelperConfig.genericImageName.Replace('{1}', $ltscVersion) } $repo = $genericImageNameSetting.Split(':')[0] $tag = $genericImageNameSetting.Split(':')[1].Replace('{0}','*') diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index aca8c587e..1a06ee9ad 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -4,6 +4,7 @@ Remove support for pre 1.0.2.15 generic images Issue 3406 Regression - Set-BcContainerKeyVaultAadAppAndCertificate only worked when running pwsh in container Issue 3407 Export-NavContainerDatabasesAsBacpac fails using PS7x (and with tenants on BC24 altogether) Issue 3409 Invoke-RestMethod -SkipCertificateCheck for PowerShell 7 +By default use mcr.microsoft.com/businesscentral:ltscXXXX instead of mcr.microsoft.com/businesscentral:10.0.osbuild.osrevision as generic image 6.0.8 Fix error where Publish-BcNuGetPackageToContainer doesn't work with BC 24