diff --git a/.github/workflows/BuildMissingImages.yaml b/.github/workflows/BuildMissingImages.yaml index d28ae9f..6710d39 100644 --- a/.github/workflows/BuildMissingImages.yaml +++ b/.github/workflows/BuildMissingImages.yaml @@ -190,6 +190,7 @@ jobs: MarkOldImagesStale: runs-on: [ Windows-Latest ] needs: [ AnalyzeImages, BuildImages ] + if: github.ref == 'refs/heads/main' steps: - name: Checkout uses: actions/checkout@v4 diff --git a/generic/Run/SQLConf.ini b/generic/Run/SQLConf.ini index 144425b..064dd65 100644 --- a/generic/Run/SQLConf.ini +++ b/generic/Run/SQLConf.ini @@ -5,7 +5,7 @@ SUPPRESSPRIVACYSTATEMENTNOTICE="True" ENU="True" QUIET="True" SUPPRESSPAIDEDITIONNOTICE="True" -FEATURES=SQLENGINE +FEATURES=SQLEngine,FullText INSTANCENAME="SQLEXPRESS" INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" diff --git a/generic/Run/SetupGeneric1.ps1 b/generic/Run/SetupGeneric1.ps1 index 5924753..2eb2801 100644 --- a/generic/Run/SetupGeneric1.ps1 +++ b/generic/Run/SetupGeneric1.ps1 @@ -35,10 +35,12 @@ if (-not $filesonly) { Set-Service 'W3SVC' -startuptype manual } Write-Host 'Downloading SQL Server 2019 Express' - Invoke-RestMethod -Method Get -UseBasicParsing -Uri $sql2019url -OutFile 'temp\SQL2019-SSEI-Expr.exe' - $configFileLocation = 'c:\run\SQLConf.ini' + Invoke-RestMethod -Method Get -UseBasicParsing -Uri $sql2019url -OutFile 'temp\SQLEXPRADV_x64_ENU.exe' + Write-Host 'Unpacking SQL Server 2019 Express' + Start-Process -FilePath 'temp\SQLEXPRADV_x64_ENU.exe' -NoNewWindow -Wait -PassThru -ArgumentList /qs, /x:temp\sqlsetup | Out-Null Write-Host 'Installing SQL Server 2019 Express' - $process = Start-Process -FilePath 'temp\SQL2019-SSEI-Expr.exe' -ArgumentList /Action=Install, /ConfigurationFile=$configFileLocation, /IAcceptSQLServerLicenseTerms, /Quiet -NoNewWindow -Wait -PassThru + $configFileLocation = 'c:\run\SQLConf.ini' + $process = Start-Process -FilePath 'temp\sqlsetup\setup.exe' -NoNewWindow -Wait -PassThru -ArgumentList /Action=Install, /ConfigurationFile=$configFileLocation, /IAcceptSQLServerLicenseTerms, /Quiet if (($null -ne $process.ExitCode) -and ($process.ExitCode -ne 0)) { Write-Host ('EXIT CODE '+$process.ExitCode) } else { Write-Host 'Success' } Write-Host 'Downloading SQL Server 2019 Cumulative Update' Invoke-RestMethod -Method Get -UseBasicParsing -Uri $sql2019LatestCuUrl -OutFile 'temp\SQL2019CU.exe' diff --git a/generic/build.ps1 b/generic/build.ps1 index 766d219..adb3e6d 100644 --- a/generic/build.ps1 +++ b/generic/build.ps1 @@ -2,15 +2,27 @@ $ErrorActionPreference = "stop" Set-StrictMode -Version 2.0 -$osVersion = '10.0.19042.1889' # 20H2 -$osVersion = '10.0.19041.1415' # 2004 -$osVersion = 'ltsc2022' - $isolation = "hyperv" $filesOnly = $false $only24 = $false $image = "mygeneric" -$genericTag = (Get-Content -Raw -Path (Join-Path $RootPath 'tag.txt')).Trim(@(13,10,32)) + +# Get osVersion to use for the right base image +$genericImage = Get-BestGenericImageName +$osVersion = ($genericImage.Split(':')[1]).Split('-')[0] # should return ltsc2016, ltsc2019 or ltsc2022 +if ($osVersion -notlike 'ltsc20??') { + throw "Unexpected osversion" +} + +# Get the latest generic tag to use +$labels = Get-BcContainerImageLabels -imageName $genericImage +$tagVersion = [System.Version]$labels.tag +$genericTag = "$($tagVersion.Major).$($tagVersion.Minor).$($tagVersion.Build).$($tagVersion.Revision+1)" + +# Manual overrides could be like this: +# $osVersion = '10.0.19042.1889' # 20H2 +# $osVersion = '10.0.19041.1415' # 2004 +# $genericTag = '2.0.0.0' $created = [DateTime]::Now.ToUniversalTime().ToString("yyyyMMddHHmm")