From 52d282620d8429f28664d58238ffac64056fdcb8 Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Tue, 26 Mar 2024 17:24:26 -0400 Subject: [PATCH 001/141] Delete NUL: --- NUL: | 1 - 1 file changed, 1 deletion(-) delete mode 100644 NUL: diff --git a/NUL: b/NUL: deleted file mode 100644 index b9e5e6965..000000000 --- a/NUL: +++ /dev/null @@ -1 +0,0 @@ -Changed database context to 'tempdb'. From c01cbfd2898aeda77ebf14506722ba5adc08e436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 30 Mar 2024 19:09:19 +0000 Subject: [PATCH 002/141] bubbled up dealing with certificate secrets --- Build/LocalBuild.ps1 | 6 +++++- Build/tSQLt_BuildCLR.ps1 | 11 ++++++++--- CI/Azure-DevOps/AZ_MainPipeline.yml | 7 ++++--- tSQLtCLR/build.ps1 | 8 +++++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Build/LocalBuild.ps1 b/Build/LocalBuild.ps1 index 906338593..dafea802d 100644 --- a/Build/LocalBuild.ps1 +++ b/Build/LocalBuild.ps1 @@ -11,6 +11,10 @@ param( ) $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} +$pfxFilePath = (Join-Path $env:TSQLTCERTPATH "tSQLtOfficialSigningKey.pfx" |Resolve-Path); +$pfxPassword = ConvertTo-SecureString -String "$env:TSQLTCERTPASSWORD" -Force -AsPlainText + +$pfxFilePath Get-Module -Name CommonFunctionsAndMethods | Select-Object Name, Path, Version @@ -57,7 +61,7 @@ try{ Log-Output(': Starting CLR Build :') Log-Output('+ - - - - - - - - - - - - - - - - - +') - & ./tSQLt_BuildCLR.ps1 + & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword CleanTemp $KeepTemp; Log-Output('+ - - - - - - - - - - - - - - - - - +') diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index a1a70e927..ea139130e 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -1,4 +1,8 @@ using module "./CommonFunctionsAndMethods.psm1"; +param( + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $pfxFilePath , + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][securestring] $pfxPassword +) Push-Location -Path $PSScriptRoot try{ @@ -11,10 +15,11 @@ try{ Get-ChildItem -Path ("../tSQLtCLR/") -Recurse -Include bin, obj|Foreach-Object{Remove-DirectoryQuietly -Path $_} <# Init directories, capturing the return values in a variable so that they don't print. #> - $_ = New-Item -ItemType "directory" -Path $TempPath; - $_ = New-Item -ItemType "directory" -Path $OutputPath; + $__=$__; + $__ = New-Item -ItemType "directory" -Path $TempPath; + $__ = New-Item -ItemType "directory" -Path $OutputPath; - ../tSQLtCLR/Build.ps1 + ../tSQLtCLR/Build.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword Get-ChildItem -Path ("../tSQLtCLR/*/bin") -Recurse -Include *.dll | Copy-Item -Destination $TempPath; diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index bde43f194..3f4467228 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -87,6 +87,7 @@ stages: jobs: - job: Create_VM + condition: eq(1,2) strategy: matrix: ${{ each version in parameters.VMMatrix }}: @@ -113,7 +114,7 @@ stages: targetType: 'inline' script: | Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" - .("Build/CommonFunctionsAndMethods.ps1") + .("Build/CommonFunctionsAndMethods.psm1") $ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)"); Log-Output "ResourceGroupName: $ResourceGroupName"; @@ -136,7 +137,7 @@ stages: scriptLocation: inlineScript inlineScript: | Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" - .("Build/CommonFunctionsAndMethods.ps1") + .("Build/CommonFunctionsAndMethods.psm1") $SqlPort = Get-Random -minimum $env:SQLPORTMINIMUM -maximum $env:SQLPORTMAXIMUM $SQLUserName = "$env:SQL_USER_NAME"; @@ -678,7 +679,7 @@ stages: $ResourceGroupName = $myJsonObject.$ResourceGroupNameKey; Set-Location $(Build.Repository.LocalPath) - .("Build/CommonFunctionsAndMethods.ps1") + .("Build/CommonFunctionsAndMethods.psm1") $ResourceGroupName | Log-Output; az group delete --name $ResourceGroupName --yes diff --git a/tSQLtCLR/build.ps1 b/tSQLtCLR/build.ps1 index 9e64efda7..7dde0572a 100644 --- a/tSQLtCLR/build.ps1 +++ b/tSQLtCLR/build.ps1 @@ -1,3 +1,7 @@ +param( + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $pfxFilePath , + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][securestring] $pfxPassword +) Push-Location -Path $PSScriptRoot # Create a unique temporary directory for this process @@ -9,10 +13,8 @@ try{ $snkFilePath = Join-Path -Path $tempDir -ChildPath "tSQLtOfficialSigningKey.snk" $pemFilePath = Join-Path -Path $tempDir -ChildPath "tSQLtOfficialSigningKey.pem" - $pfxFilePath = Join-Path -Path $env:TSQLTCERTPATH -ChildPath $("tSQLtOfficialSigningKey.pfx") - $pfxPassword = $env:TSQLTCERTPASSWORD - & openssl pkcs12 -in "$pfxFilePath" -out "$pemFilePath" -nodes -passin pass:$pfxPassword + & openssl pkcs12 -in "$pfxFilePath" -out "$pemFilePath" -nodes -passin pass:"$((ConvertFrom-SecureString $pfxPassword -AsPlainText))" $rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider $pemContent = Get-Content -Path "$pemFilePath" -Raw From b2c32bb360a0559b7918543e0775151d23f53814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 22:27:53 +0000 Subject: [PATCH 003/141] changed pipeline to use tSQLt_BuildCLR.ps1 --- Build/LocalBuild.ps1 | 6 ++---- CI/Azure-DevOps/AZ_MainPipeline.yml | 33 ++++++++--------------------- tSQLtCLR/build.ps1 | 2 ++ 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Build/LocalBuild.ps1 b/Build/LocalBuild.ps1 index dafea802d..1e697873d 100644 --- a/Build/LocalBuild.ps1 +++ b/Build/LocalBuild.ps1 @@ -6,15 +6,13 @@ param( [Parameter(Mandatory=$true, ParameterSetName = 'UserPass')][ValidateNotNullOrEmpty()][securestring] $Password = (ConvertTo-SecureString "P@ssw0rd" -AsPlainText), [Parameter(Mandatory=$true, ParameterSetName = 'TrustedCon')][ValidateNotNullOrEmpty()][switch] $TrustedConnection, [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $DatabaseName = 'tSQLt.TmpBuild.DacPacBuild', + [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $pfxFilePath = (Join-Path $env:TSQLTCERTPATH "tSQLtOfficialSigningKey.pfx" |Resolve-Path), + [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][securestring] $pfxPassword = (ConvertTo-SecureString -String "$env:TSQLTCERTPASSWORD" -Force -AsPlainText), [Parameter(Mandatory=$false)][switch]$KeepTemp, [Parameter(Mandatory=$false, ParameterSetName="IgnoreMe")][string]$IgnoreMe ) $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} -$pfxFilePath = (Join-Path $env:TSQLTCERTPATH "tSQLtOfficialSigningKey.pfx" |Resolve-Path); -$pfxPassword = ConvertTo-SecureString -String "$env:TSQLTCERTPASSWORD" -Force -AsPlainText - -$pfxFilePath Get-Module -Name CommonFunctionsAndMethods | Select-Object Name, Path, Version diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 3f4467228..313d80559 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -207,8 +207,8 @@ stages: timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 - variables: - CertificatePath: '$(Build.Repository.LocalPath)\tsqltclr\OfficialSigningKey\tSQLtOfficialSigningKey.pfx' + # variables: + # CertificatePath: '$(Build.Repository.LocalPath)\tsqltclr\OfficialSigningKey\tSQLtOfficialSigningKey.pfx' steps: @@ -228,34 +228,19 @@ stages: targetType: 'inline' script: | $pfxSecretBytes = [System.Convert]::FromBase64String('$(tSQLtOfficialSigningKey-Base64)') - $pfxPath = "$(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx" - [System.IO.File]::WriteAllBytes($pfxPath, $pfxSecretBytes) - &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey - - - task: MSBuild@1 - displayName: 'Build solution tSQLtCLR/tSQLtCLR.sln' - inputs: - solution: tSQLtCLR/tSQLtCLR.sln - platform: 'Any CPU' - configuration: CruiseControl + $pfxFilePath = (Join-Path "$(Build.SourcesDirectory)" "/Build/tSQLtOfficialSigningKey.pfx") + [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) + # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey + & ./Build/tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword '$(tSQLtSigningKeyPassword)' - task: CopyFiles@2 displayName: 'Copy all dll files to the ArtifactStagingDirectory' inputs: - SourceFolder: tSQLtCLR - Contents: '*/bin/*/*.dll' - TargetFolder: '$(Build.ArtifactStagingDirectory)/tSQLtCLR' + SourceFolder: ./Build/output/tSQLtCLR + Contents: 'tSQLtCLR.zip' + TargetFolder: '$(Build.ArtifactStagingDirectory)/tSQLtCLR.zip' flattenFolders: true - - task: ArchiveFiles@2 - inputs: - rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/tSQLtCLR' - includeRootFolder: false - archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/tSQLtCLR.zip' - replaceExistingArchive: true - verbose: true - - task: PublishPipelineArtifact@1 name: PublishCLRArtifact inputs: diff --git a/tSQLtCLR/build.ps1 b/tSQLtCLR/build.ps1 index 7dde0572a..99ac59333 100644 --- a/tSQLtCLR/build.ps1 +++ b/tSQLtCLR/build.ps1 @@ -15,6 +15,8 @@ try{ $pemFilePath = Join-Path -Path $tempDir -ChildPath "tSQLtOfficialSigningKey.pem" & openssl pkcs12 -in "$pfxFilePath" -out "$pemFilePath" -nodes -passin pass:"$((ConvertFrom-SecureString $pfxPassword -AsPlainText))" + & openssl pkcs12 -in "$pfxFilePath" -noout -info -nodes -passin pass:"$((ConvertFrom-SecureString $pfxPassword -AsPlainText))" + Write-Warning("Certificate Thumbprint: " + (Get-PfxCertificate -Filepath "$pfxFilePath" -Password $pfxPassword).Thumbprint.ToString()); $rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider $pemContent = Get-Content -Path "$pemFilePath" -Raw From c0872da1cda5e5e0a24a15fefda1dc11d40dba08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 22:32:41 +0000 Subject: [PATCH 004/141] change working dir on CompileCLR step --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 313d80559..24bc30892 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -223,15 +223,17 @@ stages: KeyVaultName: 'tSQLtSigningKey' - task: PowerShell@2 - name: Install_tSQLt_OfficialSigningKey + name: CompileCLR + workingDirectory: $(Build.SourcesDirectory)/Build/ inputs: targetType: 'inline' script: | + $pfxSecretBytes = [System.Convert]::FromBase64String('$(tSQLtOfficialSigningKey-Base64)') $pfxFilePath = (Join-Path "$(Build.SourcesDirectory)" "/Build/tSQLtOfficialSigningKey.pfx") [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey - & ./Build/tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword '$(tSQLtSigningKeyPassword)' + & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword '$(tSQLtSigningKeyPassword)' - task: CopyFiles@2 displayName: 'Copy all dll files to the ArtifactStagingDirectory' From d1ae3228ebcda4ab1a4ef4ba3d369898aa6b483b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 22:34:08 +0000 Subject: [PATCH 005/141] ... in the right place --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 24bc30892..33fd44b4d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -224,8 +224,8 @@ stages: - task: PowerShell@2 name: CompileCLR - workingDirectory: $(Build.SourcesDirectory)/Build/ inputs: + workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | From 60c58893a9fc5dd3fc8adbe5d10d9ba02f39680a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 22:40:54 +0000 Subject: [PATCH 006/141] .... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 33fd44b4d..92a5910e9 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -231,9 +231,10 @@ stages: $pfxSecretBytes = [System.Convert]::FromBase64String('$(tSQLtOfficialSigningKey-Base64)') $pfxFilePath = (Join-Path "$(Build.SourcesDirectory)" "/Build/tSQLtOfficialSigningKey.pfx") + $pfxPassword = (ConvertTo-SecureString -String '$(tSQLtSigningKeyPassword)' -Force -AsPlainText) [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey - & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword '$(tSQLtSigningKeyPassword)' + & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword - task: CopyFiles@2 displayName: 'Copy all dll files to the ArtifactStagingDirectory' From 38ecbd5da38b2b36616e0cf4953cec6f54b13421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 22:49:23 +0000 Subject: [PATCH 007/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 92a5910e9..890ba6115 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -232,6 +232,7 @@ stages: $pfxSecretBytes = [System.Convert]::FromBase64String('$(tSQLtOfficialSigningKey-Base64)') $pfxFilePath = (Join-Path "$(Build.SourcesDirectory)" "/Build/tSQLtOfficialSigningKey.pfx") $pfxPassword = (ConvertTo-SecureString -String '$(tSQLtSigningKeyPassword)' -Force -AsPlainText) + Write-Warning($pfxPassword) [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword From f1c593a35a43787783ec850144f8a78f8ecc164d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 31 Mar 2024 23:43:12 +0000 Subject: [PATCH 008/141] switch to linux --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 890ba6115..8583b43cb 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -14,7 +14,7 @@ schedules: always: true pool: - vmImage: 'windows-latest' + vmImage: 'linux-latest' parameters: # TODO, these don't work for scheduled pipelines, not even the defaults. Fix it. Hint: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script#check-for-an-empty-parameter-object - name: VMMatrix From ba0d466d242697d1697f3e55e9d590a2faf2043c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 1 Apr 2024 01:09:21 +0000 Subject: [PATCH 009/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 8583b43cb..74332247e 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -14,7 +14,7 @@ schedules: always: true pool: - vmImage: 'linux-latest' + vmImage: 'ubuntu-latest' parameters: # TODO, these don't work for scheduled pipelines, not even the defaults. Fix it. Hint: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script#check-for-an-empty-parameter-object - name: VMMatrix From 82a6d8847621737ad1f380ffe774dcc7750d958e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 1 Apr 2024 01:12:38 +0000 Subject: [PATCH 010/141] ........ --- Build/tSQLt_BuildCLR.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index ea139130e..f91d2c107 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -4,7 +4,7 @@ param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][securestring] $pfxPassword ) Push-Location -Path $PSScriptRoot - +Get-Location try{ $OutputPath = "./output/tSQLtCLR/"; $TempPath = "./temp/tSQLtCLR/"; From dc9a98be1cdf81c23ffa00e5558c927b805d1ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 1 Apr 2024 01:14:23 +0000 Subject: [PATCH 011/141] ......... --- Build/tSQLt_BuildCLR.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index f91d2c107..c7afc2333 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -4,7 +4,7 @@ param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][securestring] $pfxPassword ) Push-Location -Path $PSScriptRoot -Get-Location +Write-Warning((Get-Location).Path) try{ $OutputPath = "./output/tSQLtCLR/"; $TempPath = "./temp/tSQLtCLR/"; From d4805903ac5b9419943510e07cd88c7d2614bd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 2 Apr 2024 21:41:30 +0000 Subject: [PATCH 012/141] ConvertFrom-SecureString seems to not work reliably --- tSQLtCLR/build.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tSQLtCLR/build.ps1 b/tSQLtCLR/build.ps1 index 99ac59333..a0ff38bfc 100644 --- a/tSQLtCLR/build.ps1 +++ b/tSQLtCLR/build.ps1 @@ -14,8 +14,11 @@ try{ $snkFilePath = Join-Path -Path $tempDir -ChildPath "tSQLtOfficialSigningKey.snk" $pemFilePath = Join-Path -Path $tempDir -ChildPath "tSQLtOfficialSigningKey.pem" - & openssl pkcs12 -in "$pfxFilePath" -out "$pemFilePath" -nodes -passin pass:"$((ConvertFrom-SecureString $pfxPassword -AsPlainText))" - & openssl pkcs12 -in "$pfxFilePath" -noout -info -nodes -passin pass:"$((ConvertFrom-SecureString $pfxPassword -AsPlainText))" + + # $pfxPasswordCleartext = (ConvertFrom-SecureString $pfxPassword -AsPlainText); + $pfxPasswordCleartext = [System.Runtime.InteropServices.Marshal]::PtrToStringUni([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pfxPassword)); + & openssl pkcs12 -in "$pfxFilePath" -out "$pemFilePath" -nodes -passin pass:$pfxPasswordCleartext + & openssl pkcs12 -in "$pfxFilePath" -noout -info -nodes -passin pass:$pfxPasswordCleartext Write-Warning("Certificate Thumbprint: " + (Get-PfxCertificate -Filepath "$pfxFilePath" -Password $pfxPassword).Thumbprint.ToString()); $rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider From aa6bef3f418230d0f23199e29c1921437e343dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 2 Apr 2024 21:44:47 +0000 Subject: [PATCH 013/141] .... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 74332247e..42ffaabeb 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -231,9 +231,10 @@ stages: $pfxSecretBytes = [System.Convert]::FromBase64String('$(tSQLtOfficialSigningKey-Base64)') $pfxFilePath = (Join-Path "$(Build.SourcesDirectory)" "/Build/tSQLtOfficialSigningKey.pfx") - $pfxPassword = (ConvertTo-SecureString -String '$(tSQLtSigningKeyPassword)' -Force -AsPlainText) - Write-Warning($pfxPassword) [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) + $pfxPassword = (ConvertTo-SecureString -String '$(tSQLtSigningKeyPassword)' -Force -AsPlainText) + + ls -la # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword From 35a190c32de340d28a95f009ed7c786f3c64e8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 2 Apr 2024 21:51:28 +0000 Subject: [PATCH 014/141] ..... --- Build/tSQLt_BuildCLR.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index c7afc2333..4fa2d8d9e 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -19,6 +19,7 @@ try{ $__ = New-Item -ItemType "directory" -Path $TempPath; $__ = New-Item -ItemType "directory" -Path $OutputPath; + ls ../tSQLtCLR -la ../tSQLtCLR/Build.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword Get-ChildItem -Path ("../tSQLtCLR/*/bin") -Recurse -Include *.dll | Copy-Item -Destination $TempPath; From 7d8c7f1f333e9ffc7eb0cbc1572f4daeb85e6a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 2 Apr 2024 21:53:15 +0000 Subject: [PATCH 015/141] fixed case of file name --- tSQLtCLR/{build.ps1 => Buildx.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tSQLtCLR/{build.ps1 => Buildx.ps1} (100%) diff --git a/tSQLtCLR/build.ps1 b/tSQLtCLR/Buildx.ps1 similarity index 100% rename from tSQLtCLR/build.ps1 rename to tSQLtCLR/Buildx.ps1 From a0e81ef9f3fc2f8312af42d334ae93bb2ede4f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 2 Apr 2024 21:54:19 +0000 Subject: [PATCH 016/141] rename - part 2 --- tSQLtCLR/{Buildx.ps1 => Build.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tSQLtCLR/{Buildx.ps1 => Build.ps1} (100%) diff --git a/tSQLtCLR/Buildx.ps1 b/tSQLtCLR/Build.ps1 similarity index 100% rename from tSQLtCLR/Buildx.ps1 rename to tSQLtCLR/Build.ps1 From fcc2c13a73cb3a6c92d47df815e31f0808c8bb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 01:12:53 +0000 Subject: [PATCH 017/141] fixed dirs for tSQLt_Build --- Build/tSQLt_BuildCLR.ps1 | 1 - CI/Azure-DevOps/AZ_MainPipeline.yml | 16 +++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index 4fa2d8d9e..c7afc2333 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -19,7 +19,6 @@ try{ $__ = New-Item -ItemType "directory" -Path $TempPath; $__ = New-Item -ItemType "directory" -Path $OutputPath; - ls ../tSQLtCLR -la ../tSQLtCLR/Build.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword Get-ChildItem -Path ("../tSQLtCLR/*/bin") -Recurse -Include *.dll | Copy-Item -Destination $TempPath; diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 42ffaabeb..4f8757fb7 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -55,7 +55,7 @@ variables: - name: ARTIFACT_REPO_DIR value: 'tSQLtArtifactRepo' - name: CLR_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\CLRBuild + value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLtCLR - name: TSQLTFILES_ARTIFACT_DIR value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLtBuild - name: DACPAC_ARTIFACT_DIR @@ -234,8 +234,6 @@ stages: [System.IO.File]::WriteAllBytes($pfxFilePath, $pfxSecretBytes) $pfxPassword = (ConvertTo-SecureString -String '$(tSQLtSigningKeyPassword)' -Force -AsPlainText) - ls -la - # &"$(Build.SourcesDirectory)/Build/SnInstallPfx" $(Build.SourcesDirectory)/Build/tSQLtOfficialSigningKey.pfx '$(tSQLtSigningKeyPassword)' tSQLt_OfficialSigningKey & ./tSQLt_BuildCLR.ps1 -pfxFilePath $pfxFilePath -pfxPassword $pfxPassword - task: CopyFiles@2 @@ -272,13 +270,13 @@ stages: itemPattern: '*.zip' targetPath: '$(CLR_ARTIFACT_DIR)' - - task: Ant@1 - displayName: 'Ant -debug Build/tSQLt.build.xml' + - task: PowerShell@2 + name: CompileCLR inputs: - buildFile: Build/tSQLt.build.xml - options: ' -D"commit.id"="$(Build.BuildId)" ' - targets: all - publishJUnitResults: false + workingDirectory: $(Build.SourcesDirectory)/Build/ + targetType: 'inline' + script: | + & ./tSQLt_Build.ps1 - task: PowerShell@2 name: CreateArtifact From 899a4f1b4b78a81064b0866cdbe80b90efc5dc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 01:17:05 +0000 Subject: [PATCH 018/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 4f8757fb7..9c62d4c8c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -271,11 +271,12 @@ stages: targetPath: '$(CLR_ARTIFACT_DIR)' - task: PowerShell@2 - name: CompileCLR + name: Build_tSQLt inputs: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + ls ./output -laR & ./tSQLt_Build.ps1 - task: PowerShell@2 From 8e58a8bd89db19e8cdc354f02691f39156aa46b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 20:51:54 +0000 Subject: [PATCH 019/141] try createing the artifact folder first --- CI/Azure-DevOps/AZ_MainPipeline.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 9c62d4c8c..5c622e69d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -263,6 +263,15 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) + - task: PowerShell@2 + name: CreateArtifactDir + inputs: + workingDirectory: $(Build.SourcesDirectory)/Build/ + targetType: 'inline' + script: | + mkdir $(CLR_ARTIFACT_DIR) + ls ./output -laR + - task: DownloadPipelineArtifact@2 inputs: buildType: 'current' From fbca0c283b530f614b39d8188efa73166206f0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 20:54:33 +0000 Subject: [PATCH 020/141] .... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 5c622e69d..755faf3d2 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -269,6 +269,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + Write-Warning("$(CLR_ARTIFACT_DIR)") mkdir $(CLR_ARTIFACT_DIR) ls ./output -laR From 87de48da271532ed42801e2f9709932ed8f54140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 20:58:59 +0000 Subject: [PATCH 021/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 755faf3d2..3f482e14b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -270,7 +270,7 @@ stages: targetType: 'inline' script: | Write-Warning("$(CLR_ARTIFACT_DIR)") - mkdir $(CLR_ARTIFACT_DIR) + New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force ls ./output -laR - task: DownloadPipelineArtifact@2 From 8f49674bf17784c9a54aead15c4fe74560ce39b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 21:06:22 +0000 Subject: [PATCH 022/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 3f482e14b..29f634cea 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -269,9 +269,8 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - Write-Warning("$(CLR_ARTIFACT_DIR)") New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force - ls ./output -laR + ls $(CLR_ARTIFACT_DIR) -laR - task: DownloadPipelineArtifact@2 inputs: @@ -286,7 +285,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - ls ./output -laR + ls $(CLR_ARTIFACT_DIR) -laR & ./tSQLt_Build.ps1 - task: PowerShell@2 From c79ccb6ad238d4ea87975162f602aec09cbbbb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 21:30:49 +0000 Subject: [PATCH 023/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 29f634cea..c4d4c9e13 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -269,7 +269,9 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + Write-Warning("$(CLR_ARTIFACT_DIR)") New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force + Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(CLR_ARTIFACT_DIR) -laR - task: DownloadPipelineArtifact@2 From 03549d9248f11427095041cc7d7a448a63924a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 21:34:01 +0000 Subject: [PATCH 024/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c4d4c9e13..17891a15d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -270,7 +270,8 @@ stages: targetType: 'inline' script: | Write-Warning("$(CLR_ARTIFACT_DIR)") - New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force + mkdir -p $(CLR_ARTIFACT_DIR) + # New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(CLR_ARTIFACT_DIR) -laR From cd28e789fa3c70aa04619c5977b160b9d30e7b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 22:33:17 +0000 Subject: [PATCH 025/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 17891a15d..b9955a904 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -289,6 +289,7 @@ stages: targetType: 'inline' script: | ls $(CLR_ARTIFACT_DIR) -laR + ls ./output/tSQLtCLR -la & ./tSQLt_Build.ps1 - task: PowerShell@2 From f6cc112cf4cc5e60d08ef6dc78a2d0064a810008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 22:36:22 +0000 Subject: [PATCH 026/141] ......... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index b9955a904..9bc8e1d36 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -288,8 +288,13 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(CLR_ARTIFACT_DIR) -laR + Write-Warning("$(CLR_ARTIFACT_DIR)") + ls -laR + Write-Warning("$(CLR_ARTIFACT_DIR)") ls ./output/tSQLtCLR -la + Write-Warning("$(CLR_ARTIFACT_DIR)") & ./tSQLt_Build.ps1 - task: PowerShell@2 From 9ca071d714289e961b3da9c5aa2b89a340a4d86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 22:42:49 +0000 Subject: [PATCH 027/141] ......... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 9bc8e1d36..86b19fe35 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -269,6 +269,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + Get-Location Write-Warning("$(CLR_ARTIFACT_DIR)") mkdir -p $(CLR_ARTIFACT_DIR) # New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force @@ -288,8 +289,9 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + Get-Location Write-Warning("$(CLR_ARTIFACT_DIR)") - ls $(CLR_ARTIFACT_DIR) -laR + ls $(Pipeline.Workspace) -laR Write-Warning("$(CLR_ARTIFACT_DIR)") ls -laR Write-Warning("$(CLR_ARTIFACT_DIR)") From 2782490ff2e7972148d274cfe1c1fd9a05ffca06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 22:51:31 +0000 Subject: [PATCH 028/141] ........... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 86b19fe35..f4d52982f 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -269,7 +269,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - Get-Location + Write-Warning("Current Location --> $((Get-Location).path)") Write-Warning("$(CLR_ARTIFACT_DIR)") mkdir -p $(CLR_ARTIFACT_DIR) # New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force @@ -289,7 +289,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - Get-Location + Write-Warning("Current Location --> $((Get-Location).path)") Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(Pipeline.Workspace) -laR Write-Warning("$(CLR_ARTIFACT_DIR)") From e19c072803a467baf125c98cd02a615b04b351b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 23:09:42 +0000 Subject: [PATCH 029/141] ........... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index f4d52982f..c0fbd3449 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -283,12 +283,27 @@ stages: itemPattern: '*.zip' targetPath: '$(CLR_ARTIFACT_DIR)' + - task: PowerShell@2 + name: tmp_dirs + inputs: + workingDirectory: $(Build.SourcesDirectory)/Build/ + targetType: 'inline' + script: | + Write-Warning("$(CLR_ARTIFACT_DIR)") + ls /home/vsts/work/1/tSQLt -laR + Write-Warning("$(CLR_ARTIFACT_DIR)") + ls /home/vsts/work/1\tSQLt\Build\output\tSQLtCLR -la + Write-Warning("$(CLR_ARTIFACT_DIR)") + ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la + Write-Warning("$(CLR_ARTIFACT_DIR)") + - task: PowerShell@2 name: Build_tSQLt inputs: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | + ls /home/vsts/work/1\tSQLt\Build\output\tSQLtCLR -la Write-Warning("Current Location --> $((Get-Location).path)") Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(Pipeline.Workspace) -laR From 1373b6546948bb163a5caed30800147080be8443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 23:15:59 +0000 Subject: [PATCH 030/141] \ --> / --- CI/Azure-DevOps/AZ_MainPipeline.yml | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c0fbd3449..401e2d92e 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -55,23 +55,23 @@ variables: - name: ARTIFACT_REPO_DIR value: 'tSQLtArtifactRepo' - name: CLR_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLtCLR + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtCLR - name: TSQLTFILES_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLtBuild + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtBuild - name: DACPAC_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\DacpacBuild + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/DacpacBuild - name: TSQLT_PUBLIC_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLt\public + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/public - name: TSQLT_VALIDATION_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLt\validation + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation - name: TSQLT_TEST_RESULTS_ARTIFACT_DIR - value: $(Pipeline.Workspace)\$(TSQLT_REPO_DIR)\Build\output\tSQLt\validation\TestResults + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation/TestResults - name: SQLCMDPath -# value: 'C:\Program Files\Microsoft SQL Server\110\Tools\Binn' for vmImage: 'vs2017-win2016' - value: 'C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn' +# value: 'C:/Program Files/Microsoft SQL Server/110/Tools/Binn' for vmImage: 'vs2017-win2016' + value: 'C:/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn' - name: SQLPackagePath -# value: 'C:\Program Files\Microsoft SQL Server\150\DAC\bin' Updated to the new path on 2022-02-05 - value: 'C:\Program Files\Microsoft SQL Server\160\DAC\bin' +# value: 'C:/Program Files/Microsoft SQL Server/150/DAC/bin' Updated to the new path on 2022-02-05 + value: 'C:/Program Files/Microsoft SQL Server/160/DAC/bin' resources: repositories: @@ -208,7 +208,7 @@ stages: cancelTimeoutInMinutes: 2 # variables: - # CertificatePath: '$(Build.Repository.LocalPath)\tsqltclr\OfficialSigningKey\tSQLtOfficialSigningKey.pfx' + # CertificatePath: '$(Build.Repository.LocalPath)/tsqltclr/OfficialSigningKey/tSQLtOfficialSigningKey.pfx' steps: @@ -292,7 +292,7 @@ stages: Write-Warning("$(CLR_ARTIFACT_DIR)") ls /home/vsts/work/1/tSQLt -laR Write-Warning("$(CLR_ARTIFACT_DIR)") - ls /home/vsts/work/1\tSQLt\Build\output\tSQLtCLR -la + ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la Write-Warning("$(CLR_ARTIFACT_DIR)") ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la Write-Warning("$(CLR_ARTIFACT_DIR)") @@ -303,7 +303,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - ls /home/vsts/work/1\tSQLt\Build\output\tSQLtCLR -la + ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la Write-Warning("Current Location --> $((Get-Location).path)") Write-Warning("$(CLR_ARTIFACT_DIR)") ls $(Pipeline.Workspace) -laR @@ -320,8 +320,8 @@ stages: targetType: 'inline' failOnStderr: true script: | - $basePath = "$(Build.SourcesDirectory)\Build\output\tSQLtBuild\"; - $artifactPath = ($basePath+"Artifact\"); + $basePath = "$(Build.SourcesDirectory)/Build/output/tSQLtBuild/"; + $artifactPath = ($basePath+"Artifact/"); New-Item -Path $artifactPath -ItemType directory -Force $artifactFiles = @("ReadMe.txt","CommitId.txt","CreateBuildLog.sql","GetFriendlySQLServerVersion.sql","tSQLt.tests.zip","tSQLtFacade.zip","tSQLtFiles.zip","tSQLtSnippets(SQLPrompt).zip","Version.txt"); Get-ChildItem -Path ($basePath + "*") -Include $artifactFiles | Copy-Item -Destination "$artifactPath"; @@ -331,7 +331,7 @@ stages: - task: PublishPipelineArtifact@1 name: PublishtSQLtFilesArtifact inputs: - targetPath: '$(TSQLTFILES_ARTIFACT_DIR)\Artifact' + targetPath: '$(TSQLTFILES_ARTIFACT_DIR)/Artifact' artifact: 'tSQLtFilesArtifact' publishLocation: 'pipeline' @@ -386,9 +386,9 @@ stages: $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; - .\Build\SetupDacpacBuild.ps1 -ErrorAction Stop - .\Build\FacadeBuildDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" - .\Build\BuildtSQLtDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)_dacpac_src" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" + ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop + ./Build/FacadeBuildDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" + ./Build/BuildtSQLtDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)_dacpac_src" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" - task: PublishPipelineArtifact@1 name: PublishtSQLtDacpacArtifact @@ -438,7 +438,7 @@ stages: targetType: 'inline' script: | Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)"; - .\Build\BuildtSQLtZip.ps1 + ./Build/BuildtSQLtZip.ps1 Get-ChildItem -Path "$(TSQLT_PUBLIC_ARTIFACT_DIR)" -Recurse; Get-ChildItem -Path "$(TSQLT_VALIDATION_ARTIFACT_DIR)" -Recurse; @@ -466,7 +466,7 @@ stages: script: | $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "GIT Failed!"}}; - Set-Location "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\"; + Set-Location "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/"; Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ git config --global user.email "$env:GITHUB_EMAIL" @@ -485,11 +485,11 @@ stages: git rm -r *.* $CheckIfGitOk.invoke($?); - New-Item -Path "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\public" -ItemType directory -Force; - New-Item -Path "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\validation" -ItemType directory -Force; + New-Item -Path "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/public" -ItemType directory -Force; + New-Item -Path "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/validation" -ItemType directory -Force; - Copy-Item -Path "$(TSQLT_PUBLIC_ARTIFACT_DIR)\*" -Destination "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\public" -Recurse -Verbose - Copy-Item -Path "$(TSQLT_VALIDATION_ARTIFACT_DIR)\*" -Destination "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\validation" -Recurse -Verbose + Copy-Item -Path "$(TSQLT_PUBLIC_ARTIFACT_DIR)/*" -Destination "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/public" -Recurse -Verbose + Copy-Item -Path "$(TSQLT_VALIDATION_ARTIFACT_DIR)/*" -Destination "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/validation" -Recurse -Verbose Get-ChildItem -Path "./public" -Recurse; Get-ChildItem -Path "./validation" -Recurse; @@ -596,7 +596,7 @@ stages: name: tSQLtValidateBuild inputs: script: | - cd /d $(Pipeline.Workspace)\$(TSQLT_REPO_DIR) + cd /d $(Pipeline.Workspace)/$(TSQLT_REPO_DIR) ECHO ON SET SQLInstanceName=$(SetupVariables.FQDNAndPort) SET DBName=$(buildDatabase) @@ -609,7 +609,7 @@ stages: echo %SQLPackagePath% type %0 - Build\LocalValidateBuild.bat "." "." "%SQLCMDPath%" "%SQLInstanceName%" tSQLt_Dev " %DBLogin%" "%SQLPackagePath%" -v || goto :error + Build/LocalValidateBuild.bat "." "." "%SQLCMDPath%" "%SQLInstanceName%" tSQLt_Dev " %DBLogin%" "%SQLPackagePath%" -v || goto :error :error @@ -643,7 +643,7 @@ stages: $TagName = "$(SQLVersionEdition)_$(Build.BuildId)" - Set-Location "$(Pipeline.Workspace)\$(ARTIFACT_REPO_DIR)\"; + Set-Location "$(Pipeline.Workspace)/$(ARTIFACT_REPO_DIR)/"; Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ From 6ebda4d38c0a1f6e812b98ea6ead535a6db335a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 3 Apr 2024 23:38:02 +0000 Subject: [PATCH 031/141] cleanup --- Build/tSQLt_Build.ps1 | 4 +-- Build/tSQLt_BuildTests.ps1 | 9 +++--- CI/Azure-DevOps/AZ_MainPipeline.yml | 49 ++++++++++------------------- 3 files changed, 23 insertions(+), 39 deletions(-) diff --git a/Build/tSQLt_Build.ps1 b/Build/tSQLt_Build.ps1 index a24a8ae32..061c973a1 100644 --- a/Build/tSQLt_Build.ps1 +++ b/Build/tSQLt_Build.ps1 @@ -122,13 +122,13 @@ try{ $toBeZipped = @("ReleaseNotes.txt", "License.txt", "tSQLt.class.sql", "Example.sql", "PrepareServer.sql"); $compress = @{ CompressionLevel = "Optimal" - DestinationPath = (Join-Path $outputPath "tSQLtFiles.zip") + DestinationPath = (Join-Path $OutputPath "tSQLtFiles.zip") } Get-ChildItem -Path (Join-Path $tempPath "*") -Include $toBeZipped | Compress-Archive @compress # $toBeCopied = @("Version.txt", "tSQLt.class.sql", "CommitId.txt", "GetFriendlySQLServerVersion.sql", "CreateBuildLog.sql"); $toBeCopied = @("Version.txt", "CommitId.txt", "tSQLt.Private_GetAssemblyKeyBytes.sql", "GetFriendlySQLServerVersion.sql", "CreateBuildLog.sql"); - $toBeCopied | ForEach-Object{(Join-Path $TempPath $_ | Resolve-Path )| Copy-Item -Destination $outputPath;} + $toBeCopied | ForEach-Object{(Join-Path $TempPath $_ | Resolve-Path )| Copy-Item -Destination $OutputPath;} # Copy-Item (Join-Path $tempPath "ReleaseNotes.txt" | Resolve-Path) -Destination (Join-Path $outputPath "ReadMe.txt"); Log-Output("Creating tSQLt Snippets...") diff --git a/Build/tSQLt_BuildTests.ps1 b/Build/tSQLt_BuildTests.ps1 index f52dd5514..df7ebd650 100644 --- a/Build/tSQLt_BuildTests.ps1 +++ b/Build/tSQLt_BuildTests.ps1 @@ -14,10 +14,11 @@ try{ Remove-DirectoryQuietly -Path $TempPath; Remove-DirectoryQuietly -Path $OutputPath; <# Init directories, capturing the return values in a variable so that they don't print. #> - $_ = New-Item -ItemType "directory" -Path $TempPath; - $_ = New-Item -ItemType "directory" -Path $SourcePath; - $_ = New-Item -ItemType "directory" -Path $PackagePath; - $_ = New-Item -ItemType "directory" -Path $OutputPath; + $__ = $__ + $__ = New-Item -ItemType "directory" -Path $TempPath; + $__ = New-Item -ItemType "directory" -Path $SourcePath; + $__ = New-Item -ItemType "directory" -Path $PackagePath; + $__ = New-Item -ItemType "directory" -Path $OutputPath; Log-Output("Copying source files...") $files = @( diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 401e2d92e..e1b103067 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -66,12 +66,12 @@ variables: value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation - name: TSQLT_TEST_RESULTS_ARTIFACT_DIR value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation/TestResults - - name: SQLCMDPath -# value: 'C:/Program Files/Microsoft SQL Server/110/Tools/Binn' for vmImage: 'vs2017-win2016' - value: 'C:/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn' - - name: SQLPackagePath -# value: 'C:/Program Files/Microsoft SQL Server/150/DAC/bin' Updated to the new path on 2022-02-05 - value: 'C:/Program Files/Microsoft SQL Server/160/DAC/bin' +# - name: SQLCMDPath +# # value: 'C:/Program Files/Microsoft SQL Server/110/Tools/Binn' for vmImage: 'vs2017-win2016' +# value: 'C:/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn' +# - name: SQLPackagePath +# # value: 'C:/Program Files/Microsoft SQL Server/150/DAC/bin' Updated to the new path on 2022-02-05 +# value: 'C:/Program Files/Microsoft SQL Server/160/DAC/bin' resources: repositories: @@ -269,12 +269,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - Write-Warning("Current Location --> $((Get-Location).path)") - Write-Warning("$(CLR_ARTIFACT_DIR)") mkdir -p $(CLR_ARTIFACT_DIR) - # New-Item -Path $(CLR_ARTIFACT_DIR) -ItemType Directory -Force - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls $(CLR_ARTIFACT_DIR) -laR - task: DownloadPipelineArtifact@2 inputs: @@ -284,35 +279,20 @@ stages: targetPath: '$(CLR_ARTIFACT_DIR)' - task: PowerShell@2 - name: tmp_dirs + name: Build_tSQLt inputs: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls /home/vsts/work/1/tSQLt -laR - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la - Write-Warning("$(CLR_ARTIFACT_DIR)") + & ./tSQLt_Build.ps1 - task: PowerShell@2 - name: Build_tSQLt + name: Build_tSQLtTests inputs: workingDirectory: $(Build.SourcesDirectory)/Build/ targetType: 'inline' script: | - ls /home/vsts/work/1/tSQLt/Build/output/tSQLtCLR -la - Write-Warning("Current Location --> $((Get-Location).path)") - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls $(Pipeline.Workspace) -laR - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls -laR - Write-Warning("$(CLR_ARTIFACT_DIR)") - ls ./output/tSQLtCLR -la - Write-Warning("$(CLR_ARTIFACT_DIR)") - & ./tSQLt_Build.ps1 + & ./tSQLt_BuildTests.ps1 - task: PowerShell@2 name: CreateArtifact @@ -320,11 +300,14 @@ stages: targetType: 'inline' failOnStderr: true script: | - $basePath = "$(Build.SourcesDirectory)/Build/output/tSQLtBuild/"; + $basePath = "$(Build.SourcesDirectory)/Build/output/"; $artifactPath = ($basePath+"Artifact/"); New-Item -Path $artifactPath -ItemType directory -Force - $artifactFiles = @("ReadMe.txt","CommitId.txt","CreateBuildLog.sql","GetFriendlySQLServerVersion.sql","tSQLt.tests.zip","tSQLtFacade.zip","tSQLtFiles.zip","tSQLtSnippets(SQLPrompt).zip","Version.txt"); - Get-ChildItem -Path ($basePath + "*") -Include $artifactFiles | Copy-Item -Destination "$artifactPath"; + # $toBeCopied = @("Version.txt", "CommitId.txt", "tSQLt.Private_GetAssemblyKeyBytes.sql", "GetFriendlySQLServerVersion.sql", "CreateBuildLog.sql"); + $artifactFiles = @("Version.txt","CommitId.txt", "tSQLt.Private_GetAssemblyKeyBytes.sql", "GetFriendlySQLServerVersion.sql","CreateBuildLog.sql","tSQLtFiles.zip","tSQLtSnippets(SQLPrompt).zip"); + Get-ChildItem -Path ($basePath + "tSQLtBuild/*") -Include $artifactFiles | Copy-Item -Destination "$artifactPath"; + $artifactFiles = @("tSQLt.tests.zip"); + Get-ChildItem -Path ($basePath + "tSQLtTests/*") -Include $artifactFiles | Copy-Item -Destination "$artifactPath"; Set-Content -Path ($artifactPath+"CommitId.txt") -Value "$(Build.SourceVersion)" From 315f7d549dc4deac08bee267e3c47d631f7f64ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 4 Apr 2024 00:31:26 +0000 Subject: [PATCH 032/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index e1b103067..e8256ce4e 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -57,9 +57,9 @@ variables: - name: CLR_ARTIFACT_DIR value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtCLR - name: TSQLTFILES_ARTIFACT_DIR - value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtBuild + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtBuild/Artifact - name: DACPAC_ARTIFACT_DIR - value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/DacpacBuild + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/DacpacBuild/Artifact - name: TSQLT_PUBLIC_ARTIFACT_DIR value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/public - name: TSQLT_VALIDATION_ARTIFACT_DIR @@ -301,7 +301,7 @@ stages: failOnStderr: true script: | $basePath = "$(Build.SourcesDirectory)/Build/output/"; - $artifactPath = ($basePath+"Artifact/"); + $artifactPath = '$(TSQLTFILES_ARTIFACT_DIR)'; New-Item -Path $artifactPath -ItemType directory -Force # $toBeCopied = @("Version.txt", "CommitId.txt", "tSQLt.Private_GetAssemblyKeyBytes.sql", "GetFriendlySQLServerVersion.sql", "CreateBuildLog.sql"); $artifactFiles = @("Version.txt","CommitId.txt", "tSQLt.Private_GetAssemblyKeyBytes.sql", "GetFriendlySQLServerVersion.sql","CreateBuildLog.sql","tSQLtFiles.zip","tSQLtSnippets(SQLPrompt).zip"); @@ -314,7 +314,7 @@ stages: - task: PublishPipelineArtifact@1 name: PublishtSQLtFilesArtifact inputs: - targetPath: '$(TSQLTFILES_ARTIFACT_DIR)/Artifact' + targetPath: '$(TSQLTFILES_ARTIFACT_DIR)' artifact: 'tSQLtFilesArtifact' publishLocation: 'pipeline' From f206b22c5cd8f57a5a88539f18ec9d0d34c5fa6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 18 Apr 2024 00:36:10 +0000 Subject: [PATCH 033/141] CreateSQLContainer now working --- .devcontainer/Dockerfile | 6 ++ .devcontainer/devcontainer.json | 1 + CI/Azure-DevOps/CreateSQLContainer.ps1 | 94 +++++++++++++++++++ ...CreateSQLContainerAndIpAddressModule.bicep | 59 ++++++++++++ .../CreateSQLContainerTemplate.bicep | 37 ++++++++ CI/Azure-DevOps/GetSQLServerVersion.sql | 1 + 6 files changed, 198 insertions(+) create mode 100644 CI/Azure-DevOps/CreateSQLContainer.ps1 create mode 100644 CI/Azure-DevOps/CreateSQLContainerAndIpAddressModule.bicep create mode 100644 CI/Azure-DevOps/CreateSQLContainerTemplate.bicep diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3e925ea68..295a47844 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -55,6 +55,12 @@ RUN apt-get install -y wget apt-transport-https software-properties-common && \ RUN pwsh -Command "Install-Module -Name SqlServer -Scope AllUsers -AllowClobber -Force" +RUN pwsh -Command "Install-Module -Name Az -AllowClobber -Scope AllUsers -Force" +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash +RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 \ + && chmod +x ./bicep \ + && mv ./bicep /usr/local/bin/bicep + # Set the default shell to PowerShell SHELL ["pwsh", "-Command"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6a3f6915e..5f4b1512b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -51,6 +51,7 @@ "github.vscode-github-actions", "ms-dotnettools.csdevkit", "ms-vscode.powershell", + "ms-azuretools.vscode-bicep", ] } }, diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 new file mode 100644 index 000000000..b24326579 --- /dev/null +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -0,0 +1,94 @@ +<# USAGE: ./CreateSQLContainer.ps1 -Location "East US 2" -ResourceGroupName "myTestResourceGroup" -SQLVersionEdition "2022L" -SQLPwd "aoeihag;ladjfalkj46" -BuildId "001" #> +using module "../../Build/CommonFunctionsAndMethods.psm1"; + +Param( + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Location, + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $ResourceGroupName, + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $BuildId, + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLVersionEdition, + [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLPwd, + [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][int] $SQLCpu = 4, + [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][int] $SQLMemory = 8 +); + +$__=$__ #quiesce warnings +$invocationDir = $PSScriptRoot +Push-Location -Path $invocationDir + + +$SQLPort = 1433; +$SQLUserName = 'SA'; + +$dir = $invocationDir; +$projectDir = Split-Path (Split-Path $dir); + +Log-Output "FileLocation: ", $dir; +Log-Output "Project Location: ", $projectDir; + + +Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->"; +Log-Output "<-> <->"; +Log-Output "<-> START 1 <->"; +Log-Output "<-> <->"; +Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->"; +Log-Output "Parameters:"; +Log-Output "ResourceGroupName:", $ResourceGroupName; +Log-Output "Location:", $Location; +Log-Output "BuildId:", $BuildId; +Log-Output "SQLVersionEdition:", $SQLVersionEdition; +Log-Output "SQLPort:", $SQLPort; +Log-Output "<-> END 1 <-><-><-><-><-><-><-><-><-><-><-><-><->"; + +<# FYI Usage: $SQLVersionEditionHash.$SQLVersionEdition.offer = "SQL2016SP2-WS2016" #> +$SQLVersionEditionHash = @{ + "2017L"=@{"sqlversion"="2017";"image"="mcr.microsoft.com/mssql/server:2017-latest";}; + "2019L"=@{"sqlversion"="2019";"image"="mcr.microsoft.com/mssql/server:2019-latest";} + "2022L"=@{"sqlversion"="2022";"image"="mcr.microsoft.com/mssql/server:2022-latest";} +}; + +$SQLVersionEditionInfo = $SQLVersionEditionHash.$SQLVersionEdition; +Log-Output "SQLVersionEditionInfo: ", $SQLVersionEditionInfo; +$ContainerName = ("C{0}-{1}###############" -f $BuildId,$SQLVersionEdition).substring(0,15).replace('#','').ToLower() +$ContainerImage = $SQLVersionEditionInfo.image + +Log-Output 'Creating SQL Server Container resources' + +$templatePath = (Join-Path $invocationDir 'CreateSQLContainerTemplate.bicep' | Resolve-Path); +Log-Output "*---------------*"; +Log-Output (Get-InstalledModule -Name Az|Out-String); +Log-Output (bicep --version|Out-String); +Log-Output (get-module -name az.resources -listavailable|Out-String); +Log-Output ($psversiontable|Out-String); +Log-Output ($env:PSModulePath -split ";"|Out-String); +Log-Output "*---------------*"; +Log-Output $templatePath +Log-Output "*---------------*"; + +$deploymentResult = (az deployment sub create --location $Location --template-file $templatePath --parameters location=$Location containerName=$ContainerName sqlServerImage=$ContainerImage newResourceGroupName=$ResourceGroupName saPassword=$SQLPwd ); + +Log-Output 'Done: Creating SQL Server Container' +Log-Output 'Prep SQL Server for tSQLt Build' +# $deploymentResult +$outputs = ($deploymentResult|ConvertFrom-Json).properties.outputs +$ipAddress = $outputs.ipAddress.value +$Port = $outputs.Port.value +Log-Output "*---------------*"; +Log-Output "SQL Server address: $ipAddress,$Port" +Log-Output "*---------------*"; + +$GetSQLVersionPath = (Join-Path $invocationDir 'GetSQLServerVersion.sql' | Resolve-Path); +$DS = Invoke-Sqlcmd -InputFile $GetSQLVersionPath -ServerInstance "$ipAddress,$Port" -Username "$SQLUserName" -Password "$SQLPwd" -TrustServerCertificate -As DataSet +$DS.Tables[0].Rows | ForEach-Object{ Log-Output "{ $($_['LoginName']), $($_['TimeStamp']), $($_['VersionDetail']), $($_['ProductVersion']), $($_['ProductLevel']), $($_['SqlVersion']) }" } + +$ActualSQLVersion = $DS.Tables[0].Rows[0]['SqlVersion']; +Log-Output "Actual SQL Version:",$ActualSQLVersion; + +Log-Output 'Done: Prep SQL Server for tSQLt Build'; + +Return @{ + "ContainerName"="$ContainerName"; + "ResourceGroupName"="$ResourceGroupName"; + "SQLFQDN"="$ipAddress"; ##[vmname].[region].cloudapp.azure.com + "SQLPort"="$SQLPort"; ##1433 + "SQLVersionEdition"="$SQLVersionEdition"; ##2012Ent +}; \ No newline at end of file diff --git a/CI/Azure-DevOps/CreateSQLContainerAndIpAddressModule.bicep b/CI/Azure-DevOps/CreateSQLContainerAndIpAddressModule.bicep new file mode 100644 index 000000000..5f952f748 --- /dev/null +++ b/CI/Azure-DevOps/CreateSQLContainerAndIpAddressModule.bicep @@ -0,0 +1,59 @@ +param location string = resourceGroup().location +param containerName string +param sqlServerImage string +param cpu int +param memory int +@secure() +param saPassword string + +var containerGroupName = '${containerName}-group' +var sqlPort = 1433 + +resource containerGroup 'Microsoft.ContainerInstance/containerGroups@2021-10-01' = { + name: containerGroupName + location: location + properties: { + containers: [ + { + name: containerName + properties: { + image: sqlServerImage + resources: { + requests: { + cpu: cpu + memoryInGB: memory + } + } + environmentVariables: [ + { + name: 'ACCEPT_EULA' + value: 'Y' + } + { + name: 'MSSQL_SA_PASSWORD' + secureValue: saPassword + } + ] + ports: [ + { + port: sqlPort + } + ] + } + } + ] + osType: 'Linux' + ipAddress: { + type: 'Public' + ports: [ + { + protocol: 'tcp' + port: sqlPort + } + ] + } + } +} + +output ipAddress string = containerGroup.properties.ipAddress.ip +output Port int = containerGroup.properties.ipAddress.ports[0].port diff --git a/CI/Azure-DevOps/CreateSQLContainerTemplate.bicep b/CI/Azure-DevOps/CreateSQLContainerTemplate.bicep new file mode 100644 index 000000000..dd0798986 --- /dev/null +++ b/CI/Azure-DevOps/CreateSQLContainerTemplate.bicep @@ -0,0 +1,37 @@ +targetScope='subscription' + +param location string = 'eastus2' +param newResourceGroupName string = 'sqlserver-container-test-rg' +param containerName string = 'sqlserver2022' +param sqlServerImage string = 'mcr.microsoft.com/mssql/server:2022-latest' +@secure() +param saPassword string +param cpu int = 4 +param memory int = 8 + + +resource newResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: newResourceGroupName + location: location + tags: { + Department: 'tSQLtCI' + Ephemeral: 'True' + } +} + + +module containers './CreateSQLContainerAndIpAddressModule.bicep' = { + name: 'deployContainers' + scope: newResourceGroup + params: { + location: location + containerName: containerName + sqlServerImage: sqlServerImage + cpu:cpu + memory:memory + saPassword: saPassword + } +} + +output ipAddress string = containers.outputs.ipAddress +output Port int = containers.outputs.Port diff --git a/CI/Azure-DevOps/GetSQLServerVersion.sql b/CI/Azure-DevOps/GetSQLServerVersion.sql index f61061063..242b2135c 100644 --- a/CI/Azure-DevOps/GetSQLServerVersion.sql +++ b/CI/Azure-DevOps/GetSQLServerVersion.sql @@ -13,6 +13,7 @@ WHEN '13.0' THEN '2016' WHEN '14.0' THEN '2017' WHEN '15.0' THEN '2019' + WHEN '16.0' THEN '2022' ELSE 'Unknown' END SQLVersion, SERVERPROPERTY('Collation') AS ServerCollation \ No newline at end of file From f72fe19ebfa2d9045ab1c29efd9d463a384fa5f1 Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Fri, 19 Apr 2024 16:52:14 -0400 Subject: [PATCH 034/141] using new " azureSubscription: 'tSQLt CI - Nightly Cleanup - Service Connection'" to authenticate --- CI/Azure-DevOps/AZ_NightlyCleanup.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_NightlyCleanup.yml b/CI/Azure-DevOps/AZ_NightlyCleanup.yml index b88be5c78..01f0e6c83 100644 --- a/CI/Azure-DevOps/AZ_NightlyCleanup.yml +++ b/CI/Azure-DevOps/AZ_NightlyCleanup.yml @@ -35,7 +35,7 @@ steps: AZURE_DEVOPS_EXT_PAT: $(tSQLtCIAzureCLIPatToken) ## black magic: this token ^^^^ is required to make "az pipelines runs show" work below inputs: - azureSubscription: 'tSQLt CI Subscription(58c04a99-5b92-410c-9e41-10262f68ca80)' + azureSubscription: 'tSQLt CI - Nightly Cleanup - Service Connection' scriptType: 'ps' scriptLocation: 'inlineScript' inlineScript: | @@ -141,7 +141,7 @@ steps: - task: AzurePowerShell@4 name: print_stuff inputs: - azureSubscription: 'tSQLt CI Subscription(58c04a99-5b92-410c-9e41-10262f68ca80)' + azureSubscription: 'tSQLt CI - Nightly Cleanup - Service Connection' azurePowerShellVersion: 'LatestVersion' failOnStandardError: True ScriptType: 'InlineScript' @@ -159,7 +159,7 @@ steps: condition: succeeded() name: Delete_RGs inputs: - azureSubscription: 'tSQLt CI Subscription(58c04a99-5b92-410c-9e41-10262f68ca80)' + azureSubscription: 'tSQLt CI - Nightly Cleanup - Service Connection' azurePowerShellVersion: 'LatestVersion' FailOnStandardError: true ScriptType: 'InlineScript' @@ -225,7 +225,7 @@ steps: name: AssertDeleteSuccessful condition: always() inputs: - azureSubscription: 'tSQLt CI Subscription(58c04a99-5b92-410c-9e41-10262f68ca80)' + azureSubscription: 'tSQLt CI - Nightly Cleanup - Service Connection' azurePowerShellVersion: 'LatestVersion' failOnStandardError: True ScriptType: 'InlineScript' From 3370380ad6541d6229a265ce7096954af1768deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 19 Apr 2024 23:43:09 +0000 Subject: [PATCH 035/141] changed to ubuntu agent --- CI/Azure-DevOps/AZ_NightlyCleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_NightlyCleanup.yml b/CI/Azure-DevOps/AZ_NightlyCleanup.yml index 01f0e6c83..510e9a008 100644 --- a/CI/Azure-DevOps/AZ_NightlyCleanup.yml +++ b/CI/Azure-DevOps/AZ_NightlyCleanup.yml @@ -4,7 +4,7 @@ # https://aka.ms/yaml pool: - vmImage: 'vs2017-win2016' + vmImage: 'ubuntu-latest' schedules: - cron: 1 16 * * * From 7c8fea97aa388fd9e42df51f5080497ebd43056f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 19 Apr 2024 23:52:36 +0000 Subject: [PATCH 036/141] ... --- CI/Azure-DevOps/AZ_NightlyCleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_NightlyCleanup.yml b/CI/Azure-DevOps/AZ_NightlyCleanup.yml index 510e9a008..064a5bb67 100644 --- a/CI/Azure-DevOps/AZ_NightlyCleanup.yml +++ b/CI/Azure-DevOps/AZ_NightlyCleanup.yml @@ -39,7 +39,7 @@ steps: scriptType: 'ps' scriptLocation: 'inlineScript' inlineScript: | - + Write-Warning 'GotHere!'; ##Functions $GetAll_tSQLtCI_RGs = { param(); From a271653884716210354afb2abf95423884e0dedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 19 Apr 2024 23:55:12 +0000 Subject: [PATCH 037/141] back to windows --- CI/Azure-DevOps/AZ_NightlyCleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_NightlyCleanup.yml b/CI/Azure-DevOps/AZ_NightlyCleanup.yml index 064a5bb67..9f6bc3b99 100644 --- a/CI/Azure-DevOps/AZ_NightlyCleanup.yml +++ b/CI/Azure-DevOps/AZ_NightlyCleanup.yml @@ -4,7 +4,7 @@ # https://aka.ms/yaml pool: - vmImage: 'ubuntu-latest' + vmImage: 'windows-latest' #requires windows for azure authentication schedules: - cron: 1 16 * * * From 094026749d356d5ea6548def1fc5e7f5f7d49949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 20 Apr 2024 22:24:42 +0000 Subject: [PATCH 038/141] removed extra print --- CI/Azure-DevOps/AZ_NightlyCleanup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_NightlyCleanup.yml b/CI/Azure-DevOps/AZ_NightlyCleanup.yml index 9f6bc3b99..c06eb4e90 100644 --- a/CI/Azure-DevOps/AZ_NightlyCleanup.yml +++ b/CI/Azure-DevOps/AZ_NightlyCleanup.yml @@ -39,7 +39,6 @@ steps: scriptType: 'ps' scriptLocation: 'inlineScript' inlineScript: | - Write-Warning 'GotHere!'; ##Functions $GetAll_tSQLtCI_RGs = { param(); From ca74b631eec33591a8ae16844eca9757438817cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 20 Apr 2024 22:28:22 +0000 Subject: [PATCH 039/141] switched main pipeline to new service connection --- CI/Azure-DevOps/AZ_MainPipeline.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 9e62f375e..9c5c41b94 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -102,7 +102,7 @@ stages: - task: AzureKeyVault@1 inputs: - azureSubscription: 'Azure DevOps Main Pipeline Service Principal' + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' KeyVaultName: 'tSQLtSigningKey' SecretsFilter: '*' RunAsPreJob: false @@ -130,7 +130,7 @@ stages: SQLPORTMINIMUM: $(SqlPortMinimum) SQLPORTMAXIMUM: $(SqlPortMaximum) inputs: - azureSubscription: 'Azure DevOps Main Pipeline Service Principal' + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' scriptType: ps scriptLocation: inlineScript @@ -218,7 +218,7 @@ stages: - task: AzureKeyVault@1 inputs: - azureSubscription: 'Azure DevOps Main Pipeline Service Principal' + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' KeyVaultName: 'tSQLtSigningKey' - task: PowerShell@2 @@ -426,7 +426,7 @@ stages: - task: AzureKeyVault@1 inputs: - azureSubscription: 'Azure DevOps Main Pipeline Service Principal' + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' KeyVaultName: 'tSQLtSigningKey' - task: PowerShell@2 @@ -665,7 +665,7 @@ stages: - task: AzureCLI@2 name: DeleteAzureVM inputs: - azureSubscription: 'Azure DevOps Main Pipeline Service Principal' + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' scriptType: ps scriptLocation: inlineScript From dcce6f2ed9a9dad0a48bc32df6641727e109b889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 21 Apr 2024 01:28:28 +0000 Subject: [PATCH 040/141] what account are we using? --- CI/Azure-DevOps/AZ_MainPipeline.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 9c5c41b94..25c68865b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -100,6 +100,13 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) + - task: AzureCLI@2 + inputs: + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: 'az account show' # This command shows the logged-in Azure account details. + - task: AzureKeyVault@1 inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' From 1d28ae3cc58b610ca59f91dc7f1ebec343de1305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 21 Apr 2024 01:58:37 +0000 Subject: [PATCH 041/141] removed additional print --- CI/Azure-DevOps/AZ_MainPipeline.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 25c68865b..9c5c41b94 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -100,13 +100,6 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) - - task: AzureCLI@2 - inputs: - azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' - scriptType: 'ps' - scriptLocation: 'inlineScript' - inlineScript: 'az account show' # This command shows the logged-in Azure account details. - - task: AzureKeyVault@1 inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' From 425e4a2618e95734abdfc81d5feaa557074bc849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 00:08:41 +0000 Subject: [PATCH 042/141] added container script to createvm part --- CI/Azure-DevOps/AZ_MainPipeline.yml | 70 +++++++++++++++++--------- CI/Azure-DevOps/CreateSQLContainer.ps1 | 8 +-- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 1a07c4aac..6f57f59c5 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -87,7 +87,6 @@ stages: jobs: - job: Create_VM - condition: eq(1,2) strategy: matrix: ${{ each version in parameters.VMMatrix }}: @@ -143,28 +142,53 @@ stages: $SQLUserName = "$env:SQL_USER_NAME"; $SQLPwd = "$env:SQL_PASSWORD"; #TODO, randomize password, instead of taking it directly from the key vault - Log-Output '=========================================================='; - Log-Output 'Executing CreateSQLVM.ps1'; - Log-Output '=========================================================='; - $Parameters = @{ - Location="$(VMLocation)"; - Size="$(VMSize)" - ResourceGroupName="$(CreateResourceGroupName.ResourceGroupName)"; - BuildId="$(Build.BuildId)"; - VMAdminName="$env:VM_USER_NAME"; - VMAdminPwd="$env:VM_PASSWORD"; - SQLVersionEdition="$(SQLVersionEdition)"; - SQLPort="$SqlPort"; - SQLUserName="$SQLUserName"; - SQLPwd="$SQLPwd"; - VMPriority="${{ parameters.VMPriority }}"; - }; - $VMDetails = .'CI/Azure-DevOps/CreateSQLVM_azcli.ps1' @Parameters - - Log-Output '=========================================================='; - Log-Output 'Done: Executing CreateSQLVM.ps1'; - Log-Output '=========================================================='; - + if("$(SQLVersionEdition)" -like "[0-9][0-9][0-9][0-9]L"){ + $SqlPort = 1433; + $SQLUserName = 'SA' + + Log-Output '=========================================================='; + Log-Output 'Executing CreateSQLContainer.ps1'; + Log-Output '=========================================================='; + $Parameters = @{ + Location="$(VMLocation)"; + Size="$(VMSize)" + ResourceGroupName="$(CreateResourceGroupName.ResourceGroupName)"; + BuildId="$(Build.BuildId)"; + SQLVersionEdition="$(SQLVersionEdition)"; + # SQLPort="1433"; + # SQLUserName="SA"; + SQLPwd="$SQLPwd"; + SQLCpu=4; + SQLMemory=8; + }; + $VMDetails = .'CI/Azure-DevOps/CreateSQLContainer.ps1' @Parameters + + Log-Output '=========================================================='; + Log-Output 'Done: Executing CreateSQLContainer.ps1'; + Log-Output '=========================================================='; + }else{ + Log-Output '=========================================================='; + Log-Output 'Executing CreateSQLVM_azcli.ps1'; + Log-Output '=========================================================='; + $Parameters = @{ + Location="$(VMLocation)"; + Size="$(VMSize)" + ResourceGroupName="$(CreateResourceGroupName.ResourceGroupName)"; + BuildId="$(Build.BuildId)"; + VMAdminName="$env:VM_USER_NAME"; + VMAdminPwd="$env:VM_PASSWORD"; + SQLVersionEdition="$(SQLVersionEdition)"; + SQLPort="$SqlPort"; + SQLUserName="$SQLUserName"; + SQLPwd="$SQLPwd"; + VMPriority="${{ parameters.VMPriority }}"; + }; + $VMDetails = .'CI/Azure-DevOps/CreateSQLVM_azcli.ps1' @Parameters + + Log-Output '=========================================================='; + Log-Output 'Done: Executing CreateSQLVM_azcli.ps1'; + Log-Output '=========================================================='; + } # $SerializedVMDetails=(ConvertTo-JSON -InputObject $VMDetails -Compress); # $SerializedVMDetails; diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index b24326579..4a0e835d4 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -86,9 +86,9 @@ Log-Output "Actual SQL Version:",$ActualSQLVersion; Log-Output 'Done: Prep SQL Server for tSQLt Build'; Return @{ - "ContainerName"="$ContainerName"; + "VmName"="$ContainerName"; "ResourceGroupName"="$ResourceGroupName"; - "SQLFQDN"="$ipAddress"; ##[vmname].[region].cloudapp.azure.com - "SQLPort"="$SQLPort"; ##1433 + "SQLVmFQDN"="$ipAddress"; ##[vmname].[region].cloudapp.azure.com + "SQLVmPort"="$SQLPort"; ##1433 "SQLVersionEdition"="$SQLVersionEdition"; ##2012Ent -}; \ No newline at end of file +}; From 52c40e7028574ab0b1e7d4dc9feb6d20580be909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 00:14:48 +0000 Subject: [PATCH 043/141] import of commonFunctionsAndMethods broken --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 6f57f59c5..2811e5c7b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -110,10 +110,10 @@ stages: - task: PowerShell@2 name: CreateResourceGroupName inputs: + workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | - Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" - .("Build/CommonFunctionsAndMethods.psm1") + using module "./Build/CommonFunctionsAndMethods.psm1"; $ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)"); Log-Output "ResourceGroupName: $ResourceGroupName"; From 1b80116eeab113913d5e468eb1dca5b1aa502b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 21:25:49 +0000 Subject: [PATCH 044/141] changed back to dot-sourcing, added workingDirectory --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 2811e5c7b..f43d63695 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -113,7 +113,7 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | - using module "./Build/CommonFunctionsAndMethods.psm1"; + . "./Build/CommonFunctionsAndMethods.psm1"; $ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)"); Log-Output "ResourceGroupName: $ResourceGroupName"; @@ -133,10 +133,10 @@ stages: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' scriptType: ps + workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" scriptLocation: inlineScript inlineScript: | - Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" - .("Build/CommonFunctionsAndMethods.psm1") + . "./Build/CommonFunctionsAndMethods.psm1" $SqlPort = Get-Random -minimum $env:SQLPORTMINIMUM -maximum $env:SQLPORTMAXIMUM $SQLUserName = "$env:SQL_USER_NAME"; From 97e07a92afb158d21b5bab904db96a754d2827fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 21:35:28 +0000 Subject: [PATCH 045/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index f43d63695..6dd500038 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -113,7 +113,10 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | - . "./Build/CommonFunctionsAndMethods.psm1"; + Get-Location + Get-ChildItem -Recurse + $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) + . "$cfam"; $ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)"); Log-Output "ResourceGroupName: $ResourceGroupName"; From fb93bbf25d6be999f2b172104f5e570571ff04bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 21:38:27 +0000 Subject: [PATCH 046/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 6dd500038..756755e82 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -108,7 +108,7 @@ stages: RunAsPreJob: false - task: PowerShell@2 - name: CreateResourceGroupName + name: CreateResourceGroupNameTTT inputs: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' From 43fe1e68f44d2b3d05a2a6040fd3fc03dcf23eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 21:50:51 +0000 Subject: [PATCH 047/141] switching to Import-Module instead of . --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 756755e82..aa65f53c6 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -113,10 +113,14 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | + Get-Alias . Get-Location - Get-ChildItem -Recurse + Get-ChildItem -Recurse | Select-Object FullName, Length, LastWriteTime | Format-Table -AutoSize $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) - . "$cfam"; + + Write-Host "Attempting to load module from: $cfam" + Import-Module "$cfam" -Force + Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded $ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)"); Log-Output "ResourceGroupName: $ResourceGroupName"; From 32df2b3c0598c302d22011974944b7cfe7b9a1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 22 Apr 2024 21:52:32 +0000 Subject: [PATCH 048/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index aa65f53c6..8da1c1fb7 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -113,7 +113,6 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | - Get-Alias . Get-Location Get-ChildItem -Recurse | Select-Object FullName, Length, LastWriteTime | Format-Table -AutoSize $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) From afff5cd468dea3ff7e3f85a7c8bcd2d438a9ea8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 23 Apr 2024 01:05:55 +0000 Subject: [PATCH 049/141] Import_Module seems to work --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 8da1c1fb7..1f5bdb68e 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -113,8 +113,6 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' script: | - Get-Location - Get-ChildItem -Recurse | Select-Object FullName, Length, LastWriteTime | Format-Table -AutoSize $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) Write-Host "Attempting to load module from: $cfam" @@ -142,7 +140,9 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" scriptLocation: inlineScript inlineScript: | - . "./Build/CommonFunctionsAndMethods.psm1" + Write-Host "Attempting to load module from: $cfam" + Import-Module "$cfam" -Force + Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded $SqlPort = Get-Random -minimum $env:SQLPORTMINIMUM -maximum $env:SQLPORTMAXIMUM $SQLUserName = "$env:SQL_USER_NAME"; From 8caac7b73498d268e7d57cad55b57192d4cff0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 23 Apr 2024 01:19:08 +0000 Subject: [PATCH 050/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 1f5bdb68e..11a233136 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -140,6 +140,7 @@ stages: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" scriptLocation: inlineScript inlineScript: | + $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) Write-Host "Attempting to load module from: $cfam" Import-Module "$cfam" -Force Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded From 6e7f80c4f149d2499cf96ef7253f3405dea32e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 00:55:04 +0000 Subject: [PATCH 051/141] maybe not WorkingDirectory? --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 11a233136..69b18758b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -137,9 +137,9 @@ stages: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' scriptType: ps - workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" scriptLocation: inlineScript inlineScript: | + Set-Location (Join-Path "$(Pipeline.Workspace)" "$(TSQLT_REPO_DIR)") $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) Write-Host "Attempting to load module from: $cfam" Import-Module "$cfam" -Force From 4c75439cc33a2d88670a593bf91e582d1da3ae07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:01:38 +0000 Subject: [PATCH 052/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 69b18758b..53ffebdfb 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -123,6 +123,30 @@ stages: Log-Output "ResourceGroupName: $ResourceGroupName"; Write-Host "##vso[task.setvariable variable=ResourceGroupName;isOutput=true]$ResourceGroupName"; + - task: AzureCLI@2 + name: testLineByLine + env: + SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) + SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) + CONTACT_EMAIL: $(NotificationEmail) + VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) + VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) + SQLPORTMINIMUM: $(SqlPortMinimum) + SQLPORTMAXIMUM: $(SqlPortMaximum) + inputs: + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' + azurePowerShellVersion: 'LatestVersion' + scriptType: ps + scriptLocation: inlineScript + inlineScript: | + Set-Location (Join-Path "$(Pipeline.Workspace)" "$(TSQLT_REPO_DIR)") + $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) + Write-Host "Attempting to load module from: $cfam" + Import-Module "$cfam" -Force + Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + + + - task: AzureCLI@2 name: CreateSQLVMEnvironment env: From 33fccd19e6c144983f9251cc3887cc8707eb0c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:10:51 +0000 Subject: [PATCH 053/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 53ffebdfb..2baba0cb4 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -125,14 +125,14 @@ stages: - task: AzureCLI@2 name: testLineByLine - env: - SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) - SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) - CONTACT_EMAIL: $(NotificationEmail) - VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) - VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) - SQLPORTMINIMUM: $(SqlPortMinimum) - SQLPORTMAXIMUM: $(SqlPortMaximum) + # env: + # SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) + # SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) + # CONTACT_EMAIL: $(NotificationEmail) + # VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) + # VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) + # SQLPORTMINIMUM: $(SqlPortMinimum) + # SQLPORTMAXIMUM: $(SqlPortMaximum) inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' From 4894f9e0d02c8ca45cc0e683835332528640d2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:12:31 +0000 Subject: [PATCH 054/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 2baba0cb4..0ba964fcf 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -108,7 +108,7 @@ stages: RunAsPreJob: false - task: PowerShell@2 - name: CreateResourceGroupNameTTT + name: CreateResourceGroupName inputs: workingDirectory: "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" targetType: 'inline' From 00e46f7a410c3d782414f75e6fe746e37195ce9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:14:04 +0000 Subject: [PATCH 055/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 0ba964fcf..a49db2fcd 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -140,10 +140,10 @@ stages: scriptLocation: inlineScript inlineScript: | Set-Location (Join-Path "$(Pipeline.Workspace)" "$(TSQLT_REPO_DIR)") - $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) - Write-Host "Attempting to load module from: $cfam" - Import-Module "$cfam" -Force - Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + # $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) + # Write-Host "Attempting to load module from: $cfam" + # Import-Module "$cfam" -Force + # Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded From 0e504f1aa49f193c3fb59153732ffd525713d08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:16:57 +0000 Subject: [PATCH 056/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index a49db2fcd..2fd509523 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -100,6 +100,16 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) + - task: AzureCLI@2 + name: doesThisWork + inputs: + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' + azurePowerShellVersion: 'LatestVersion' + scriptType: ps + scriptLocation: inlineScript + inlineScript: | + Write-Host 'Got-Here!' + - task: AzureKeyVault@1 inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' @@ -125,25 +135,13 @@ stages: - task: AzureCLI@2 name: testLineByLine - # env: - # SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) - # SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) - # CONTACT_EMAIL: $(NotificationEmail) - # VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) - # VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) - # SQLPORTMINIMUM: $(SqlPortMinimum) - # SQLPORTMAXIMUM: $(SqlPortMaximum) inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' azurePowerShellVersion: 'LatestVersion' scriptType: ps scriptLocation: inlineScript inlineScript: | - Set-Location (Join-Path "$(Pipeline.Workspace)" "$(TSQLT_REPO_DIR)") - # $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) - # Write-Host "Attempting to load module from: $cfam" - # Import-Module "$cfam" -Force - # Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + Write-Host 'Got-Here!' From 5d94b07ed46853327750b9f26b10128818c9b945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 01:20:12 +0000 Subject: [PATCH 057/141] ......... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 2fd509523..dca4c748c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -100,6 +100,24 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) + - task: AzureCLI@2 + name: DTW2 + env: + SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) + SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) + CONTACT_EMAIL: $(NotificationEmail) + VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) + VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) + SQLPORTMINIMUM: $(SqlPortMinimum) + SQLPORTMAXIMUM: $(SqlPortMaximum) + inputs: + azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' + azurePowerShellVersion: 'LatestVersion' + scriptType: ps + scriptLocation: inlineScript + inlineScript: | + Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" + - task: AzureCLI@2 name: doesThisWork inputs: From 6bf46355291de36bd261c6b9a848302975f31499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 24 Apr 2024 21:22:21 +0000 Subject: [PATCH 058/141] switched back to windows for AzureCLI containing jobs --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index dca4c748c..a30a21fc4 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -84,6 +84,8 @@ stages: - stage: Create_VMs dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel + pool: + vmImage: 'windows-latest' jobs: - job: Create_VM @@ -726,6 +728,8 @@ stages: - Create_VMs - Validate condition: always() + pool: + vmImage: 'ubuntu-latest' jobs: From e0c64fc1aa664b3474723ff4df2368e5ced7e993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 25 Apr 2024 21:54:07 +0000 Subject: [PATCH 059/141] paths --- CI/Azure-DevOps/AZ_MainPipeline.yml | 40 -------------------------- CI/Azure-DevOps/CreateSQLContainer.ps1 | 3 +- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index a30a21fc4..617df9501 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -102,34 +102,6 @@ stages: lfs: false path: $(TSQLT_REPO_DIR) - - task: AzureCLI@2 - name: DTW2 - env: - SQL_USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) - SQL_PASSWORD: $(tSQLt-UserForCIEnvironment-Password) - CONTACT_EMAIL: $(NotificationEmail) - VM_USER_NAME: $(tSQLt-AdminForCIVM-UserName) - VM_PASSWORD: $(tSQLt-AdminForCIVM-Password) - SQLPORTMINIMUM: $(SqlPortMinimum) - SQLPORTMAXIMUM: $(SqlPortMaximum) - inputs: - azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' - azurePowerShellVersion: 'LatestVersion' - scriptType: ps - scriptLocation: inlineScript - inlineScript: | - Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" - - - task: AzureCLI@2 - name: doesThisWork - inputs: - azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' - azurePowerShellVersion: 'LatestVersion' - scriptType: ps - scriptLocation: inlineScript - inlineScript: | - Write-Host 'Got-Here!' - - task: AzureKeyVault@1 inputs: azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' @@ -153,18 +125,6 @@ stages: Log-Output "ResourceGroupName: $ResourceGroupName"; Write-Host "##vso[task.setvariable variable=ResourceGroupName;isOutput=true]$ResourceGroupName"; - - task: AzureCLI@2 - name: testLineByLine - inputs: - azureSubscription: 'tSQLt CI - Main Pipeline - Service Connection' - azurePowerShellVersion: 'LatestVersion' - scriptType: ps - scriptLocation: inlineScript - inlineScript: | - Write-Host 'Got-Here!' - - - - task: AzureCLI@2 name: CreateSQLVMEnvironment env: diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 4a0e835d4..27af472e7 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -1,5 +1,5 @@ <# USAGE: ./CreateSQLContainer.ps1 -Location "East US 2" -ResourceGroupName "myTestResourceGroup" -SQLVersionEdition "2022L" -SQLPwd "aoeihag;ladjfalkj46" -BuildId "001" #> -using module "../../Build/CommonFunctionsAndMethods.psm1"; +# using module "../../Build/CommonFunctionsAndMethods.psm1"; Param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Location, @@ -15,6 +15,7 @@ $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir +.("..\..\Build\CommonFunctionsAndMethods.ps1") $SQLPort = 1433; $SQLUserName = 'SA'; From 3b5889af39a3e3177b2f3eb0568d8678b047ebf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 01:05:24 +0000 Subject: [PATCH 060/141] fixed parameters and agent type --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 617df9501..5f5c25b39 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -160,7 +160,7 @@ stages: Log-Output '=========================================================='; $Parameters = @{ Location="$(VMLocation)"; - Size="$(VMSize)" + # Size="$(VMSize)" ResourceGroupName="$(CreateResourceGroupName.ResourceGroupName)"; BuildId="$(Build.BuildId)"; SQLVersionEdition="$(SQLVersionEdition)"; @@ -689,7 +689,7 @@ stages: - Validate condition: always() pool: - vmImage: 'ubuntu-latest' + vmImage: 'windows-latest' jobs: From 87385d7aea01c89d7fd500d6c4bd154d0c071624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 01:12:59 +0000 Subject: [PATCH 061/141] cfam work... --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 27af472e7..2cd7fab03 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -14,8 +14,10 @@ Param( $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir - -.("..\..\Build\CommonFunctionsAndMethods.ps1") +$cfam = (Join-Path $invocationDir ".../../Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Host "Attempting to load module from: $cfam" +Import-Module "$cfam" -Force +Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded $SQLPort = 1433; $SQLUserName = 'SA'; From f1796dd828dc897108d89c11b49c1861cbad8781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 01:19:20 +0000 Subject: [PATCH 062/141] ..... --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 2cd7fab03..0bffb6f20 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -10,7 +10,7 @@ Param( [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][int] $SQLCpu = 4, [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][int] $SQLMemory = 8 ); - +Write-Host "Starting execution of CreateSQLContainer.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir From 2547f2da26de3eeb250ac2157a451c80c8c8c037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 20:07:41 +0000 Subject: [PATCH 063/141] change . to & when "calling a script with parameters" --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- CI/Azure-DevOps/CreateSQLContainer.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 5f5c25b39..c90b60c39 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -170,7 +170,7 @@ stages: SQLCpu=4; SQLMemory=8; }; - $VMDetails = .'CI/Azure-DevOps/CreateSQLContainer.ps1' @Parameters + $VMDetails = & 'CI/Azure-DevOps/CreateSQLContainer.ps1' @Parameters Log-Output '=========================================================='; Log-Output 'Done: Executing CreateSQLContainer.ps1'; diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 0bffb6f20..15c9e41f5 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -16,7 +16,7 @@ $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir $cfam = (Join-Path $invocationDir ".../../Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) Write-Host "Attempting to load module from: $cfam" -Import-Module "$cfam" -Force +Import-Module "$cfam" -Force -Verbose Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded $SQLPort = 1433; From 7c751bc4d2a3d15a0babca746bbf2e2d62c35d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 20:12:31 +0000 Subject: [PATCH 064/141] fixed issue in path --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 15c9e41f5..13fa7596a 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -14,7 +14,9 @@ Write-Host "Starting execution of CreateSQLContainer.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir -$cfam = (Join-Path $invocationDir ".../../Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Warning 'GH1'; +$cfam = (Join-Path $invocationDir "../../Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Warning 'GH1'; Write-Host "Attempting to load module from: $cfam" Import-Module "$cfam" -Force -Verbose Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded From d0c002a1bced3721f7532f76c31a258b5d2ec199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 20:22:34 +0000 Subject: [PATCH 065/141] old powershell version forces old Join-Path syntax, maybe? --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 13fa7596a..40ab20d76 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -15,8 +15,8 @@ $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir Write-Warning 'GH1'; -$cfam = (Join-Path $invocationDir "../../Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) -Write-Warning 'GH1'; +$cfam = (Join-Path (Join-Path $invocationDir "../../Build/") "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Warning 'GH2'; Write-Host "Attempting to load module from: $cfam" Import-Module "$cfam" -Force -Verbose Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded From 1483ddd65b5d9c8dee83a3fefe078fa4647c78ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 26 Apr 2024 20:47:38 +0000 Subject: [PATCH 066/141] removed some superfluous code --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 40ab20d76..0b7e3a37a 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -31,6 +31,13 @@ Log-Output "FileLocation: ", $dir; Log-Output "Project Location: ", $projectDir; +Log-Output "*---------------*"; +Log-Output (az --version|Out-String); +Log-Output (bicep --version|Out-String); +Log-Output ($psversiontable|Out-String); +Log-Output "*---------------*"; + + Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->"; Log-Output "<-> <->"; Log-Output "<-> START 1 <->"; @@ -60,12 +67,6 @@ Log-Output 'Creating SQL Server Container resources' $templatePath = (Join-Path $invocationDir 'CreateSQLContainerTemplate.bicep' | Resolve-Path); Log-Output "*---------------*"; -Log-Output (Get-InstalledModule -Name Az|Out-String); -Log-Output (bicep --version|Out-String); -Log-Output (get-module -name az.resources -listavailable|Out-String); -Log-Output ($psversiontable|Out-String); -Log-Output ($env:PSModulePath -split ";"|Out-String); -Log-Output "*---------------*"; Log-Output $templatePath Log-Output "*---------------*"; From 49036c87ab0a4ef050f827138bf9cab45e43f732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 00:23:21 +0000 Subject: [PATCH 067/141] more progess towards build part 2 --- CI/Azure-DevOps/AZ_MainPipeline.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c90b60c39..819a48d0c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -386,7 +386,7 @@ stages: inputs: targetType: 'inline' script: | - Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" + Set-Location (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path) $inputObject = @' $(databaseAccessDetails) @@ -402,9 +402,13 @@ stages: $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; - ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop - ./Build/FacadeBuildDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" - ./Build/BuildtSQLtDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)_dacpac_src" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" + Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" + Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" + # ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop + # ./Build/FacadeBuildDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" + # ./Build/BuildtSQLtDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)_dacpac_src" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" + & ./tSQLt_BuildDacpac.ps1 -SqlServerConnection $SqlServerConnection -DacPacDatabaseName $DatabaseName + & ./tSQLt_BuildPackage.ps1 - task: PublishPipelineArtifact@1 name: PublishtSQLtDacpacArtifact @@ -713,15 +717,18 @@ stages: scriptType: ps scriptLocation: inlineScript inlineScript: | + Set-Location (Join-Path "$(Pipeline.Workspace)" "$(TSQLT_REPO_DIR)") + $cfam = (Join-Path "./Build/" "CommonFunctionsAndMethods.psm1" | Resolve-Path) + Write-Host "Attempting to load module from: $cfam" + Import-Module "$cfam" -Force + Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + $inputObject = @' $(databaseAccessDetails) '@; $myJsonObject = ConvertFrom-JSON -InputObject $inputObject; $ResourceGroupNameKey = "$(System.JobName).CreateResourceGroupName.ResourceGroupName"; $ResourceGroupName = $myJsonObject.$ResourceGroupNameKey; - - Set-Location $(Build.Repository.LocalPath) - .("Build/CommonFunctionsAndMethods.psm1") - + $ResourceGroupName | Log-Output; az group delete --name $ResourceGroupName --yes From ecdcd35a4b9b53c8726941c390302db407941a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 02:01:47 +0000 Subject: [PATCH 068/141] create the target dirs first. --- CI/Azure-DevOps/AZ_MainPipeline.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 819a48d0c..d81a2447d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -402,6 +402,8 @@ stages: $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; + $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" + $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" # ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop @@ -709,6 +711,11 @@ stages: databaseAccessDetails: $[convertToJson(stageDependencies.Create_VMs.Create_VM.outputs)] steps: + - checkout: self + clean: true + lfs: false + path: $(TSQLT_REPO_DIR) + - task: AzureCLI@2 name: DeleteAzureVM inputs: From 09653517acb4c31cf30930d3b1b74cef2e6909bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 02:08:46 +0000 Subject: [PATCH 069/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index d81a2447d..f6c52a4c8 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -403,7 +403,7 @@ stages: $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" - $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" + # $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" # ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop From 3b5dc6016e4fcd7e1ae48901279bc73791e7160b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 13:32:32 +0000 Subject: [PATCH 070/141] fixed SQL Connection --- CI/Azure-DevOps/AZ_MainPipeline.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index f6c52a4c8..6f9794e91 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -401,6 +401,9 @@ stages: $SQLUserName = $myJsonObject.$SQLUserNameKey; $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; + $ApplicationName = "$(Build.DefinitionName)-$(Build.BuildId)-$(System.StageName)-$(System.JobId)" + $DatabaseName = "$(buildDatabase)_dacpac_src" + $SqlServerConnection = [SqlServerConnection]::new($FQDNAndPort,$SQLUserName,$SQLPwd,$ApplicationName); $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" # $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" From c93904deb56494458149c8451040d5120f16a307 Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 28 Apr 2024 11:12:22 -0400 Subject: [PATCH 071/141] Added cmaf to dacpac step --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 6f9794e91..63e8a2cdf 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -387,6 +387,12 @@ stages: targetType: 'inline' script: | Set-Location (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path) + $cfam = (Join-Path "./" "CommonFunctionsAndMethods.psm1" | Resolve-Path) + + Write-Host "Attempting to load module from: $cfam" + Import-Module "$cfam" -Force + Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + $inputObject = @' $(databaseAccessDetails) From 8f1b3684f68616b7f6ef92b5a4a4601d13cb34f3 Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 28 Apr 2024 11:47:50 -0400 Subject: [PATCH 072/141] Export SqlServerConnection Type from cfam --- Build/CommonFunctionsAndMethods.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index 2b8e04603..ef9e230be 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -1,4 +1,4 @@ -$__=$__ #quiesce warnings +$__=$__ #quiesce warnings $CommonFunctionsAndMethodsDir = $PSScriptRoot Write-Host "Loading CommonFunctionsAndMethods.psm1 from: $PSCommandPath" @@ -415,3 +415,4 @@ Log-Output($GetUTCTimeStamp.Invoke(),"Done: Loading CommonFunctionsAndMethods"); Export-ModuleMember -Function Log-Output, Exec-SqlFile, Get-SqlConnectionString, Get-TempFileForQuery, Get-FriendlySQLServerVersion, Update-Archive Export-ModuleMember -Function Remove-ResourceGroup, Get-SnipContent, Replace-InFile, Invoke-SQLFileOrQuery, Remove-DirectoryQuietly Export-ModuleMember -Variable $CommonFunctionsAndMethodsDir, $SQLPrintCurrentTime +Export-ModuleMember -Type SqlServerConnection \ No newline at end of file From ce18d54aa619953ed2de87627c6f77a4a9a6d9a6 Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 28 Apr 2024 11:57:25 -0400 Subject: [PATCH 073/141] Undo export --- Build/CommonFunctionsAndMethods.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index ef9e230be..419bb6bf5 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -415,4 +415,3 @@ Log-Output($GetUTCTimeStamp.Invoke(),"Done: Loading CommonFunctionsAndMethods"); Export-ModuleMember -Function Log-Output, Exec-SqlFile, Get-SqlConnectionString, Get-TempFileForQuery, Get-FriendlySQLServerVersion, Update-Archive Export-ModuleMember -Function Remove-ResourceGroup, Get-SnipContent, Replace-InFile, Invoke-SQLFileOrQuery, Remove-DirectoryQuietly Export-ModuleMember -Variable $CommonFunctionsAndMethodsDir, $SQLPrintCurrentTime -Export-ModuleMember -Type SqlServerConnection \ No newline at end of file From bb3f88c22f7a7ad3f81826913e0b9be1b34389ea Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 28 Apr 2024 12:00:28 -0400 Subject: [PATCH 074/141] Different way to load the module --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 63e8a2cdf..c8a59d9c0 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -390,9 +390,9 @@ stages: $cfam = (Join-Path "./" "CommonFunctionsAndMethods.psm1" | Resolve-Path) Write-Host "Attempting to load module from: $cfam" - Import-Module "$cfam" -Force - Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded - + # Import-Module "$cfam" -Force + # Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + . $cfam $inputObject = @' $(databaseAccessDetails) From b17578db1f04f65b6dc92eba39c0f572aef6205b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 18:02:03 +0000 Subject: [PATCH 075/141] moved SQLServerConnection into separate dor-source-able file --- Build/CommonFunctionsAndMethods.psm1 | 91 +--------------------------- Build/SQLServerConnection.ps1 | 89 +++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 Build/SQLServerConnection.ps1 diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index 2b8e04603..d201047de 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -1,7 +1,7 @@ $__=$__ #quiesce warnings $CommonFunctionsAndMethodsDir = $PSScriptRoot Write-Host "Loading CommonFunctionsAndMethods.psm1 from: $PSCommandPath" - +. (Join-Path $CommonFunctionsAndMethodsDir 'SQLServerConnection.ps1'); $MergeHashTables = {param([HashTable]$base,[HashTable]$new);$new.GetEnumerator()|%{$base.remove($_.Key);$base += @{$_.Key=$_.Value}};$base;}; $AddTagsToResourceGroup = @@ -15,95 +15,6 @@ $SQLPrintCurrentTime = "EXEC('DECLARE @C VARCHAR(MAX)=CONVERT(VARCHAR(MAX),SYSUT Function Log-Output{[cmdletbinding()]Param([parameter(ValueFromPipeline)]$I);Process{Write-Host ([string]::Concat($GetUTCTimeStamp.Invoke()[0],[string]::Concat(" $I")));};}; -if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) { - - class SqlServerConnection { - hidden [string]$ServerName - hidden [string]$UserName - hidden [System.Security.SecureString]$Password - hidden [bool]$TrustedConnection - hidden [string]$ApplicationName - hidden [string]$BaseConnectionString = "Connect Timeout=60;TrustServerCertificate=true;" - - SqlServerConnection([string]$ServerName, [string]$UserName, [System.Security.SecureString]$Password,[string]$ApplicationName) { - $this.ServerName = $ServerName.Trim() - $this.UserName = $UserName.Trim() - $this.Password = $Password - $this.TrustedConnection = false - $this.ApplicationName = $ApplicationName.Trim() - } - SqlServerConnection([string]$ServerName,[string]$ApplicationName) { - $this.ServerName = $ServerName.Trim() - $this.UserName = $null - $this.Password = $null - $this.TrustedConnection = true - $this.ApplicationName = $ApplicationName.Trim() - } - - [string] ToString() { - - - return @{ - ServerName= $($this.ServerName) - UserName= $($this.UserName) - Password= (ConvertFrom-SecureString $this.Password -AsPlainText) - TrustedConnection= $($this.TrustedConnection) - ApplicationName= $($this.ApplicationName) - BaseConnectionString= $($this.BaseConnectionString) - }| ConvertTo-Json -Compress - } - - static [string] ToStringStatic([SqlServerConnection]$instance) { - if ($null -eq $instance) { - return "$null" - } - else { - return $instance.ToString() - } - } - - [string] GetServerName() { - return $this.ServerName - } - - [string] GetUserName() { - return $this.UserName - } - - [System.Security.SecureString] GetPassword() { - return $this.Password - } - - [bool] GetTrustedConnection() { - return $this.TrustedConnection - } - - hidden [string] EscapeAndQuoteConnectionStringValue([string]$value) { - return "`"$( $value.Replace('"', '""') )`"" - } - - [string] GetConnectionString([string]$DatabaseName = '', [string]$ApplicationNameSuffix = '') { - $connectionString = "Server=$($this.EscapeAndQuoteConnectionStringValue($this.ServerName));" - - if ($this.TrustedConnection) { - $connectionString += "Integrated Security=SSPI;" - } else { - $connectionString += "User Id=$($this.EscapeAndQuoteConnectionStringValue($this.UserName));" - $connectionString += "Password=$($this.EscapeAndQuoteConnectionStringValue((ConvertFrom-SecureString $this.Password -AsPlainText)));" - } - if(![string]::IsNullOrWhiteSpace($DatabaseName)){ - $connectionString += "Initial Catalog=$($this.EscapeAndQuoteConnectionStringValue($DatabaseName));" - } - $PApplicationName = $this.ApplicationName; - if(![string]::IsNullOrWhiteSpace($ApplicationNameSuffix)){ - $PApplicationName+=".$ApplicationNameSuffix" - } - $connectionString += "Application Name=$($this.EscapeAndQuoteConnectionStringValue($PApplicationName));" - return $this.BaseConnectionString+$connectionString - } - } -} - Function Exec-SqlFile { [CmdletBinding()] diff --git a/Build/SQLServerConnection.ps1 b/Build/SQLServerConnection.ps1 new file mode 100644 index 000000000..34dab050e --- /dev/null +++ b/Build/SQLServerConnection.ps1 @@ -0,0 +1,89 @@ +if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) { + + class SqlServerConnection { + hidden [string]$ServerName + hidden [string]$UserName + hidden [System.Security.SecureString]$Password + hidden [bool]$TrustedConnection + hidden [string]$ApplicationName + hidden [string]$BaseConnectionString = "Connect Timeout=60;TrustServerCertificate=true;" + + SqlServerConnection([string]$ServerName, [string]$UserName, [System.Security.SecureString]$Password,[string]$ApplicationName) { + $this.ServerName = $ServerName.Trim() + $this.UserName = $UserName.Trim() + $this.Password = $Password + $this.TrustedConnection = false + $this.ApplicationName = $ApplicationName.Trim() + } + SqlServerConnection([string]$ServerName,[string]$ApplicationName) { + $this.ServerName = $ServerName.Trim() + $this.UserName = $null + $this.Password = $null + $this.TrustedConnection = true + $this.ApplicationName = $ApplicationName.Trim() + } + + [string] ToString() { + + + return @{ + ServerName= $($this.ServerName) + UserName= $($this.UserName) + Password= (ConvertFrom-SecureString $this.Password -AsPlainText) + TrustedConnection= $($this.TrustedConnection) + ApplicationName= $($this.ApplicationName) + BaseConnectionString= $($this.BaseConnectionString) + }| ConvertTo-Json -Compress + } + + static [string] ToStringStatic([SqlServerConnection]$instance) { + if ($null -eq $instance) { + return "$null" + } + else { + return $instance.ToString() + } + } + + [string] GetServerName() { + return $this.ServerName + } + + [string] GetUserName() { + return $this.UserName + } + + [System.Security.SecureString] GetPassword() { + return $this.Password + } + + [bool] GetTrustedConnection() { + return $this.TrustedConnection + } + + hidden [string] EscapeAndQuoteConnectionStringValue([string]$value) { + return "`"$( $value.Replace('"', '""') )`"" + } + + [string] GetConnectionString([string]$DatabaseName = '', [string]$ApplicationNameSuffix = '') { + $connectionString = "Server=$($this.EscapeAndQuoteConnectionStringValue($this.ServerName));" + + if ($this.TrustedConnection) { + $connectionString += "Integrated Security=SSPI;" + } else { + $connectionString += "User Id=$($this.EscapeAndQuoteConnectionStringValue($this.UserName));" + $connectionString += "Password=$($this.EscapeAndQuoteConnectionStringValue((ConvertFrom-SecureString $this.Password -AsPlainText)));" + } + if(![string]::IsNullOrWhiteSpace($DatabaseName)){ + $connectionString += "Initial Catalog=$($this.EscapeAndQuoteConnectionStringValue($DatabaseName));" + } + $PApplicationName = $this.ApplicationName; + if(![string]::IsNullOrWhiteSpace($ApplicationNameSuffix)){ + $PApplicationName+=".$ApplicationNameSuffix" + } + $connectionString += "Application Name=$($this.EscapeAndQuoteConnectionStringValue($PApplicationName));" + return $this.BaseConnectionString+$connectionString + } + } + } + \ No newline at end of file From 051b9142a0768b9555d83edc32e4dfcc813cebf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 28 Apr 2024 18:07:53 +0000 Subject: [PATCH 076/141] import only SQLServerConnection --- CI/Azure-DevOps/AZ_MainPipeline.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c8a59d9c0..b825a3068 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -386,13 +386,9 @@ stages: inputs: targetType: 'inline' script: | - Set-Location (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path) - $cfam = (Join-Path "./" "CommonFunctionsAndMethods.psm1" | Resolve-Path) - - Write-Host "Attempting to load module from: $cfam" - # Import-Module "$cfam" -Force - # Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded - . $cfam + $BuildDir = (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path); + Set-Location $BuildDir; + . (Join-Path $BuildDir 'SQLServerConnection.ps1'); $inputObject = @' $(databaseAccessDetails) From 23b9f2b9214d8bde4b92f83cc03e5313be82a06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 29 Apr 2024 21:05:45 +0000 Subject: [PATCH 077/141] ...... --- Build/SQLServerConnection.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Build/SQLServerConnection.ps1 b/Build/SQLServerConnection.ps1 index 34dab050e..d65240772 100644 --- a/Build/SQLServerConnection.ps1 +++ b/Build/SQLServerConnection.ps1 @@ -15,13 +15,13 @@ if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) $this.TrustedConnection = false $this.ApplicationName = $ApplicationName.Trim() } - SqlServerConnection([string]$ServerName,[string]$ApplicationName) { - $this.ServerName = $ServerName.Trim() - $this.UserName = $null - $this.Password = $null - $this.TrustedConnection = true - $this.ApplicationName = $ApplicationName.Trim() - } + # SqlServerConnection([string]$ServerName,[string]$ApplicationName) { + # $this.ServerName = $ServerName.Trim() + # $this.UserName = $null + # $this.Password = $null + # $this.TrustedConnection = true + # $this.ApplicationName = $ApplicationName.Trim() + # } [string] ToString() { From 2467f83484d598f547b0e1ee49ab5dad438a4339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 29 Apr 2024 21:17:13 +0000 Subject: [PATCH 078/141] Password as Secure String --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index b825a3068..fe8a8b25c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -401,7 +401,7 @@ stages: $FQDNAndPortKey = "$(System.JobName).CreateSQLVMEnvironment.FQDNAndPort"; $SQLUserName = $myJsonObject.$SQLUserNameKey; - $SQLPwd = $myJsonObject.$SQLPwdKey; + $SQLPwd = (ConvertTo-SecureString $myJsonObject.$SQLPwdKey -AsPlainText); $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; $ApplicationName = "$(Build.DefinitionName)-$(Build.BuildId)-$(System.StageName)-$(System.JobId)" $DatabaseName = "$(buildDatabase)_dacpac_src" From 94c2f319f8dcd5dff8bfc2e337c50dd42b1f9e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 29 Apr 2024 21:30:17 +0000 Subject: [PATCH 079/141] does renaming work? --- Build/CommonFunctionsAndMethods.psm1 | 16 ++++++++-------- Build/tSQLt_BuildDacpac.ps1 | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index 46f0470b5..ed3ad5a13 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -15,7 +15,7 @@ $SQLPrintCurrentTime = "EXEC('DECLARE @C VARCHAR(MAX)=CONVERT(VARCHAR(MAX),SYSUT Function Log-Output{[cmdletbinding()]Param([parameter(ValueFromPipeline)]$I);Process{Write-Host ([string]::Concat($GetUTCTimeStamp.Invoke()[0],[string]::Concat(" $I")));};}; -Function Exec-SqlFile +Function Invoke-SqlFile { [CmdletBinding()] param( @@ -40,9 +40,9 @@ Function Exec-SqlFile $parameters['Verbose'] = $true } - $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(CommonFunctionsAndMethods.p1:Exec-SqlFile:Invoke-SqlCommand[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $results = (Invoke-SqlCmd @parameters) - $dddafter = Get-Date;Write-Warning("------->>After<<-------(CommonFunctionsAndMethods.p1:Exec-SqlFile:Invoke-SqlCommand[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddafter = Get-Date;Write-Warning("------->>After<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") Write-Warning("Runtime in Milliseconds: $(($dddafter-$dddbefore).TotalMilliseconds)") return $results } @@ -100,9 +100,9 @@ Function Invoke-SQLFileOrQuery AdditionalParameters = $AdditionalParameters PrintSqlOutput = $PrintSqlOutput } -$dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Exec-SqlFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") - $QueryOutput = Exec-SqlFile @parameters -$dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Exec-SqlFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") +$dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $QueryOutput = Invoke-SqlFile @parameters +$dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $dddafter-$dddbefore return $QueryOutput } @@ -177,7 +177,7 @@ function Get-FriendlySQLServerVersion { [Parameter(Mandatory=$false)][switch]$Quiet ) $GetFriendlySQLServerVersionFullPath = (Get-ChildItem -Path ($PSScriptRoot + '/output/*') -include "GetFriendlySQLServerVersion.sql" -Recurse | Select-Object -First 1 ).FullName; - $resultSet = (Exec-SqlFile -SqlServerConnection $SqlServerConnection -FileNames @($GetFriendlySQLServerVersionFullPath) -DatabaseName 'tempdb'); + $resultSet = (Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames @($GetFriendlySQLServerVersionFullPath) -DatabaseName 'tempdb'); $FriendlyVersion = ($resultSet.FriendlyVersion) if(!$Quiet){Log-Output "Friendly SQL Server Version: $FriendlyVersion"}; return $FriendlyVersion @@ -323,6 +323,6 @@ Function Replace-InFile { } Log-Output($GetUTCTimeStamp.Invoke(),"Done: Loading CommonFunctionsAndMethods"); -Export-ModuleMember -Function Log-Output, Exec-SqlFile, Get-SqlConnectionString, Get-TempFileForQuery, Get-FriendlySQLServerVersion, Update-Archive +Export-ModuleMember -Function Log-Output, Invoke-SqlFile, Get-TempFileForQuery, Get-FriendlySQLServerVersion, Update-Archive Export-ModuleMember -Function Remove-ResourceGroup, Get-SnipContent, Replace-InFile, Invoke-SQLFileOrQuery, Remove-DirectoryQuietly Export-ModuleMember -Variable $CommonFunctionsAndMethodsDir, $SQLPrintCurrentTime diff --git a/Build/tSQLt_BuildDacpac.ps1 b/Build/tSQLt_BuildDacpac.ps1 index 73563c9ed..3c05451d0 100644 --- a/Build/tSQLt_BuildDacpac.ps1 +++ b/Build/tSQLt_BuildDacpac.ps1 @@ -29,13 +29,13 @@ try{ Set-Location $TempPath; Log-Output('Building Database') Log-Output('-- Executing ResetValidationServer.sql') - Exec-SqlFile -SqlServerConnection $SqlServerConnection -FileNames @('ResetValidationServer.sql'); + Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames @('ResetValidationServer.sql'); Log-Output('-- Executing PrepareServer.sql') - Exec-SqlFile -SqlServerConnection $SqlServerConnection -FileNames 'PrepareServer.sql'; + Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames 'PrepareServer.sql'; Log-Output('-- Executing CreateBuildDb.sql') - Exec-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "CreateBuildDb.sql" -Database "tempdb" -AdditionalParameters @{NewDbName=$DacPacDatabaseName} -PrintSqlOutput $true; + Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "CreateBuildDb.sql" -Database "tempdb" -AdditionalParameters @{NewDbName=$DacPacDatabaseName} -PrintSqlOutput $true; Log-Output('-- Executing tSQLt.class.sql') - Exec-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "tSQLt.class.sql" -Database "$DacPacDatabaseName"; + Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "tSQLt.class.sql" -Database "$DacPacDatabaseName"; Write-Host('Building DACPAC') $FriendlySQLServerVersion = Get-FriendlySQLServerVersion -SqlServerConnection $SqlServerConnection; $tSQLtDacpacFileName = "tSQLt."+$FriendlySQLServerVersion+".dacpac"; From ee980f30f78d7a85849481be3965425efac85396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 29 Apr 2024 21:34:40 +0000 Subject: [PATCH 080/141] ....... --- Build/tSQLt_BuildDacpac.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Build/tSQLt_BuildDacpac.ps1 b/Build/tSQLt_BuildDacpac.ps1 index 3c05451d0..823138ec3 100644 --- a/Build/tSQLt_BuildDacpac.ps1 +++ b/Build/tSQLt_BuildDacpac.ps1 @@ -1,4 +1,4 @@ -using module "./CommonFunctionsAndMethods.psm1"; +# using module "./CommonFunctionsAndMethods.psm1"; Param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][SqlServerConnection] $SqlServerConnection, @@ -11,6 +11,11 @@ Technically this should be called by a matrixed job, so that dacpacs are built f $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir +$cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Host "Attempting to load module from: $cfam" +Import-Module "$cfam" -Force +Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded + try{ $OutputPath = (Join-Path $invocationDir "/output/DacpacBuild/"); From 88444c2943661c8e85f5ec6d0a4a18fb03ae5fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 30 Apr 2024 00:55:11 +0000 Subject: [PATCH 081/141] if Invoke-SqlCmd is not installed, let's fix that --- CI/Azure-DevOps/AZ_MainPipeline.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index fe8a8b25c..939c8b344 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -381,9 +381,25 @@ stages: artifactName: 'tSQLtFilesArtifact' targetPath: '$(TSQLTFILES_ARTIFACT_DIR)' + - task: PowerShell@2 + displayName: 'Install SqlServer Module' + inputs: + pwsh: true + targetType: 'inline' + script: | + # Check if the SqlServer module is installed + $module = "SqlServer" + if (-not (Get-Module -ListAvailable -Name $module)) { + # Install the SqlServer module + Install-Module -Name $module -Scope CurrentUser -Force -AllowClobber + } + Import-Module $module + + - task: PowerShell@2 name: FacadeBuildDacpac inputs: + pwsh: true targetType: 'inline' script: | $BuildDir = (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path); From 707f5a807e05a6d11f227d2bf91a60073a537490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Tue, 30 Apr 2024 01:52:34 +0000 Subject: [PATCH 082/141] lots of changes at once --- Build/tSQLt_BuildPackage.ps1 | 19 +++++++++++-------- CI/Azure-DevOps/AZ_MainPipeline.yml | 26 +++++++++++++++++--------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Build/tSQLt_BuildPackage.ps1 b/Build/tSQLt_BuildPackage.ps1 index 6ac41c56a..0bd1256aa 100644 --- a/Build/tSQLt_BuildPackage.ps1 +++ b/Build/tSQLt_BuildPackage.ps1 @@ -5,6 +5,9 @@ $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir try{ + $tSQLtBuildPath = '/output/tSQLtBuild/'; + $tSQLtTestsPath = '/output/tSQLtTests/'; + $DacpacBuildPath = '/output/DacpacBuild/'; $OutputPath = (Join-Path $invocationDir "/output/tSQLt/"); $TempPath = (Join-Path $invocationDir "/temp/tSQLt/"); @@ -40,16 +43,16 @@ try{ Log-Output("Copying source files...") $files = @( - "/output/tSQLtBuild/Version.txt", - "/output/tSQLtBuild/CommitId.txt", - "/output/tSQLtBuild/CreateBuildLog.sql", - "/output/tSQLtBuild/GetFriendlySQLServerVersion.sql", - "/output/tSQLtTests/tSQLt.tests.zip", - "/output/tSQLtBuild/tSQLtSnippets(SQLPrompt).zip", - "/output/tSQLtBuild/tSQLtFiles.zip" + "$($tSQLtBuildPath)Version.txt", + "$($tSQLtBuildPath)CommitId.txt", + "$($tSQLtBuildPath)CreateBuildLog.sql", + "$($tSQLtBuildPath)GetFriendlySQLServerVersion.sql", + "$($tSQLtTestsPath)tSQLt.tests.zip", + "$($tSQLtBuildPath)tSQLtSnippets(SQLPrompt).zip", + "$($tSQLtBuildPath)tSQLtFiles.zip" ); $files|%{(Join-Path $invocationDir $_ | Resolve-Path) | Copy-Item -Destination $SourcePath} - Get-ChildItem (Join-Path $invocationDir "/output/DacpacBuild") | Copy-Item -Destination $DacpacSourcePath + Get-ChildItem (Join-Path $invocationDir $DacpacBuildPath) | Copy-Item -Destination $DacpacSourcePath <# Copy files to temp path #> Expand-Archive -Path (Join-Path $SourcePath "tSQLtFiles.zip" | Resolve-Path) -DestinationPath $PublicTempPath; diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 939c8b344..eb3ecf5a7 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -66,6 +66,12 @@ variables: value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation - name: TSQLT_TEST_RESULTS_ARTIFACT_DIR value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLt/validation/TestResults + - name: TSQLT_BUILD_DIR + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtBuild + - name: TSQLT_TESTS_DIR + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/tSQLtTests + - name: DACPAC_BUILD_DIR + value: $(Pipeline.Workspace)/$(TSQLT_REPO_DIR)/Build/output/DacpacBuild # - name: SQLCMDPath # # value: 'C:/Program Files/Microsoft SQL Server/110/Tools/Binn' for vmImage: 'vs2017-win2016' # value: 'C:/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn' @@ -397,7 +403,7 @@ stages: - task: PowerShell@2 - name: FacadeBuildDacpac + name: BuildDacpac inputs: pwsh: true targetType: 'inline' @@ -427,11 +433,7 @@ stages: # $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" - # ./Build/SetupDacpacBuild.ps1 -ErrorAction Stop - # ./Build/FacadeBuildDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" - # ./Build/BuildtSQLtDacpac.ps1 -ErrorAction Stop -ServerName "$FQDNAndPort" -DatabaseName "$(buildDatabase)_dacpac_src" -Login " -U $SQLUserName -P $SQLPwd" -SqlCmdPath "$(SQLCMDPath)" -SqlPackagePath "$(SQLPackagePath)" & ./tSQLt_BuildDacpac.ps1 -SqlServerConnection $SqlServerConnection -DacPacDatabaseName $DatabaseName - & ./tSQLt_BuildPackage.ps1 - task: PublishPipelineArtifact@1 name: PublishtSQLtDacpacArtifact @@ -465,14 +467,20 @@ stages: targetPath: '$(Pipeline.Workspace)/dacpacArtifactTmp' - task: PowerShell@2 - name: CopyDacpacsToOutputDir + name: CopyFilesToOutputDirs inputs: targetType: 'inline' failOnStderr: true script: | + $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" + #$__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" + New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; + + Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" + Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" + Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; - New-Item -Path "$(DACPAC_ARTIFACT_DIR)" -ItemType directory -Force; - Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_ARTIFACT_DIR)" + Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" Get-ChildItem -Path "$(DACPAC_ARTIFACT_DIR)" -Recurse; - task: PowerShell@2 @@ -481,7 +489,7 @@ stages: targetType: 'inline' script: | Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)"; - ./Build/BuildtSQLtZip.ps1 + ./Build/tSQLt_BuildPackage.ps1 Get-ChildItem -Path "$(TSQLT_PUBLIC_ARTIFACT_DIR)" -Recurse; Get-ChildItem -Path "$(TSQLT_VALIDATION_ARTIFACT_DIR)" -Recurse; From bcd4d1645901aeea3dce91ae9cf9a7c50a4f72ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 00:13:56 +0000 Subject: [PATCH 083/141] fixed dacpac path --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index eb3ecf5a7..3caae5e0a 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -438,7 +438,7 @@ stages: - task: PublishPipelineArtifact@1 name: PublishtSQLtDacpacArtifact inputs: - targetPath: '$(DACPAC_ARTIFACT_DIR)' + targetPath: '$(DACPAC_BUILD_DIR)' artifact: 'tSQLtDacpacArtifact_$(System.JobName)' publishLocation: 'pipeline' @@ -481,7 +481,7 @@ stages: Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" - Get-ChildItem -Path "$(DACPAC_ARTIFACT_DIR)" -Recurse; + Get-ChildItem -Path "$(DACPAC_BUILD_DIR)" -Recurse; - task: PowerShell@2 name: BuildtSQLtZip From ed8529bd62c1095125f43b634bbb34e5d82d2529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 00:25:52 +0000 Subject: [PATCH 084/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 3caae5e0a..5a8af51f0 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -473,7 +473,7 @@ stages: failOnStderr: true script: | $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" - #$__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" + $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" From 136eee937f2a149c30bc9b1c0c050c24106a597f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 21:06:06 +0000 Subject: [PATCH 085/141] added a deployment name to the container deployment --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 0b7e3a37a..cb4747172 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -70,7 +70,7 @@ Log-Output "*---------------*"; Log-Output $templatePath Log-Output "*---------------*"; -$deploymentResult = (az deployment sub create --location $Location --template-file $templatePath --parameters location=$Location containerName=$ContainerName sqlServerImage=$ContainerImage newResourceGroupName=$ResourceGroupName saPassword=$SQLPwd ); +$deploymentResult = (az deployment sub create --name $ContainerName --location $Location --template-file $templatePath --parameters location=$Location containerName=$ContainerName sqlServerImage=$ContainerImage newResourceGroupName=$ResourceGroupName saPassword=$SQLPwd ); Log-Output 'Done: Creating SQL Server Container' Log-Output 'Prep SQL Server for tSQLt Build' From 3eade48beea1efd29c7d0fcc801119875dd42b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 21:14:10 +0000 Subject: [PATCH 086/141] reduced to 3 cpus per container --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 5a8af51f0..9ebddfac0 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -173,7 +173,7 @@ stages: # SQLPort="1433"; # SQLUserName="SA"; SQLPwd="$SQLPwd"; - SQLCpu=4; + SQLCpu=3; SQLMemory=8; }; $VMDetails = & 'CI/Azure-DevOps/CreateSQLContainer.ps1' @Parameters From c591f53a7359e56ba9bf1d41fccaa95c2a0869ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 23:07:36 +0000 Subject: [PATCH 087/141] passing paramaters through all the way --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index cb4747172..6815598e3 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -70,7 +70,7 @@ Log-Output "*---------------*"; Log-Output $templatePath Log-Output "*---------------*"; -$deploymentResult = (az deployment sub create --name $ContainerName --location $Location --template-file $templatePath --parameters location=$Location containerName=$ContainerName sqlServerImage=$ContainerImage newResourceGroupName=$ResourceGroupName saPassword=$SQLPwd ); +$deploymentResult = (az deployment sub create --name $ContainerName --location $Location --template-file $templatePath --parameters location=$Location containerName=$ContainerName sqlServerImage=$ContainerImage newResourceGroupName=$ResourceGroupName saPassword=$SQLPwd cpu=$SQLCpu memory=$SQLMemory); Log-Output 'Done: Creating SQL Server Container' Log-Output 'Prep SQL Server for tSQLt Build' From 7cedc6d2963cd2fe94d0d6822d2a127dfcc0ff16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 23:36:29 +0000 Subject: [PATCH 088/141] copying all artifact files --- CI/Azure-DevOps/AZ_MainPipeline.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 9ebddfac0..facbbcd87 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -476,8 +476,16 @@ stages: $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; + $files = @( + "$(TSQLTFILES_ARTIFACT_DIR)/Version.txt", + "$(TSQLTFILES_ARTIFACT_DIR)/CommitId.txt", + "$(TSQLTFILES_ARTIFACT_DIR)/CreateBuildLog.sql", + "$(TSQLTFILES_ARTIFACT_DIR)/GetFriendlySQLServerVersion.sql", + "$(TSQLTFILES_ARTIFACT_DIR)/tSQLtSnippets(SQLPrompt).zip", + "$(TSQLTFILES_ARTIFACT_DIR)/tSQLtFiles.zip" + ); + $files|%{Move-Item $_ "./output/tSQLtBuild/"} Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" - Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLtFiles.zip') "./output/tSQLtBuild/" Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" From 903923fede8c32b752196ba5936123bd437f4888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 1 May 2024 23:49:50 +0000 Subject: [PATCH 089/141] listing dirs to copy --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index facbbcd87..b6d5c04f6 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -476,6 +476,8 @@ stages: $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; + Get-ChildItem -Path "$(TSQLTFILES_ARTIFACT_DIR)" -Recurse; + $files = @( "$(TSQLTFILES_ARTIFACT_DIR)/Version.txt", "$(TSQLTFILES_ARTIFACT_DIR)/CommitId.txt", @@ -489,7 +491,8 @@ stages: Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" - Get-ChildItem -Path "$(DACPAC_BUILD_DIR)" -Recurse; + + Get-ChildItem -Path "./output" -Recurse; - task: PowerShell@2 name: BuildtSQLtZip From 762c5d88c04176ebafd667772c7e6a7a9d0f9dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 2 May 2024 00:13:41 +0000 Subject: [PATCH 090/141] changed final artifact folders, started validate redo --- CI/Azure-DevOps/AZ_MainPipeline.yml | 102 ++++++++++++++++++---------- 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index b6d5c04f6..7fd1b46aa 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -457,7 +457,7 @@ stages: inputs: buildType: 'current' artifactName: 'tSQLtFilesArtifact' - targetPath: '$(TSQLTFILES_ARTIFACT_DIR)' + targetPath: '$(Pipeline.Workspace)/tSQLtArtifactTmp' - task: DownloadPipelineArtifact@2 name: DownloadtSQLtDacpacArtifact @@ -472,22 +472,22 @@ stages: targetType: 'inline' failOnStderr: true script: | - $__ = New-Item -ItemType "directory" -Path "./output/tSQLtTests/" - $__ = New-Item -ItemType "directory" -Path "./output/tSQLtBuild/" - New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; + $__ = New-Item -Path "$(TSQLT_BUILD_DIR)" -ItemType directory -Force; + $__ = New-Item -Path "$(TSQLT_TESTS_DIR)" -ItemType directory -Force; + $__ = New-Item -Path "$(DACPAC_BUILD_DIR)" -ItemType directory -Force; - Get-ChildItem -Path "$(TSQLTFILES_ARTIFACT_DIR)" -Recurse; + Get-ChildItem -Path "$(Pipeline.Workspace)/tSQLtArtifactTmp/" -Recurse; $files = @( - "$(TSQLTFILES_ARTIFACT_DIR)/Version.txt", - "$(TSQLTFILES_ARTIFACT_DIR)/CommitId.txt", - "$(TSQLTFILES_ARTIFACT_DIR)/CreateBuildLog.sql", - "$(TSQLTFILES_ARTIFACT_DIR)/GetFriendlySQLServerVersion.sql", - "$(TSQLTFILES_ARTIFACT_DIR)/tSQLtSnippets(SQLPrompt).zip", - "$(TSQLTFILES_ARTIFACT_DIR)/tSQLtFiles.zip" + "$(Pipeline.Workspace)/tSQLtArtifactTmp/Version.txt", + "$(Pipeline.Workspace)/tSQLtArtifactTmp/CommitId.txt", + "$(Pipeline.Workspace)/tSQLtArtifactTmp/CreateBuildLog.sql", + "$(Pipeline.Workspace)/tSQLtArtifactTmp/GetFriendlySQLServerVersion.sql", + "$(Pipeline.Workspace)/tSQLtArtifactTmp/tSQLtSnippets(SQLPrompt).zip", + "$(Pipeline.Workspace)/tSQLtArtifactTmp/tSQLtFiles.zip" ); - $files|%{Move-Item $_ "./output/tSQLtBuild/"} - Move-Item (Join-Path '$(TSQLTFILES_ARTIFACT_DIR)' 'tSQLt.tests.zip') "./output/tSQLtTests/" + $files|%{Move-Item $_ "$(TSQLT_BUILD_DIR)"} + Move-Item (Join-Path '$(Pipeline.Workspace)/tSQLtArtifactTmp' 'tSQLt.tests.zip') "$(TSQLT_TESTS_DIR)" Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" @@ -632,10 +632,30 @@ stages: - task: PowerShell@2 - name: SetupVariables + displayName: 'Install SqlServer Module' inputs: + pwsh: true targetType: 'inline' script: | + # Check if the SqlServer module is installed + $module = "SqlServer" + if (-not (Get-Module -ListAvailable -Name $module)) { + # Install the SqlServer module + Install-Module -Name $module -Scope CurrentUser -Force -AllowClobber + } + Import-Module $module + + + - task: PowerShell@2 + name: tSQLtValidateBuild + inputs: + pwsh: true + targetType: 'inline' + script: | + $BuildDir = (Join-Path "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)" "Build"|Resolve-Path); + Set-Location $BuildDir; + . (Join-Path $BuildDir 'SQLServerConnection.ps1'); + $inputObject = @' $(databaseAccessDetails) '@; @@ -647,32 +667,40 @@ stages: $FQDNAndPortKey = "$(System.JobName).CreateSQLVMEnvironment.FQDNAndPort"; $SQLUserName = $myJsonObject.$SQLUserNameKey; - $SQLPwd = $myJsonObject.$SQLPwdKey; + $SQLPwd = (ConvertTo-SecureString $myJsonObject.$SQLPwdKey -AsPlainText); $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; + $ApplicationName = "$(Build.DefinitionName)-$(Build.BuildId)-$(System.StageName)-$(System.JobId)" + $DatabaseName = "$(buildDatabase)_dacpac_src" + $SqlServerConnection = [SqlServerConnection]::new($FQDNAndPort,$SQLUserName,$SQLPwd,$ApplicationName); - Write-Host "##vso[task.setvariable variable=SQLUserName;isOutput=true]$SQLUserName" - Write-Host "##vso[task.setvariable variable=SQLPwd;isOutput=true]$SQLPwd" - Write-Host "##vso[task.setvariable variable=FQDNAndPort;isOutput=true]$FQDNAndPort" + $parameters = @{ + SqlServerConnection = $SqlServerConnection + MainTestDb = 'tSQLt.TmpBuild.ValidateBuild' + DacpacTestDb = 'tSQLt.TmpBuild.ValidateDacPac' + ExampleTestDb = 'tSQLt.TmpBuild.ValidateExample' + } - - task: CmdLine@2 - name: tSQLtValidateBuild - inputs: - script: | - cd /d $(Pipeline.Workspace)/$(TSQLT_REPO_DIR) - ECHO ON - SET SQLInstanceName=$(SetupVariables.FQDNAndPort) - SET DBName=$(buildDatabase) - SET DBLogin=-U $(SetupVariables.SQLUserName) -P $(SetupVariables.SQLPwd) - SET SQLCMDPath=$(SQLCMDPath) - SET SQLPackagePath=$(SQLPackagePath) - echo %SQLInstanceName% - echo %DBName% - echo %SQLCMDPath% - echo %SQLPackagePath% - type %0 - - Build/LocalValidateBuild.bat "." "." "%SQLCMDPath%" "%SQLInstanceName%" tSQLt_Dev " %DBLogin%" "%SQLPackagePath%" -v || goto :error - :error + & ./tSQLt_Validate.ps1 @parameters + + # - task: CmdLine@2 + # name: tSQLtValidateBuild + # inputs: + # script: | + # cd /d $(Pipeline.Workspace)/$(TSQLT_REPO_DIR) + # ECHO ON + # SET SQLInstanceName=$(SetupVariables.FQDNAndPort) + # SET DBName=$(buildDatabase) + # SET DBLogin=-U $(SetupVariables.SQLUserName) -P $(SetupVariables.SQLPwd) + # SET SQLCMDPath=$(SQLCMDPath) + # SET SQLPackagePath=$(SQLPackagePath) + # echo %SQLInstanceName% + # echo %DBName% + # echo %SQLCMDPath% + # echo %SQLPackagePath% + # type %0 + + # Build/LocalValidateBuild.bat "." "." "%SQLCMDPath%" "%SQLInstanceName%" tSQLt_Dev " %DBLogin%" "%SQLPackagePath%" -v || goto :error + # :error - task: PublishTestResults@2 From f014c03137e416006fa9c623256217dd84947261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 00:47:58 +0000 Subject: [PATCH 091/141] turned Error into Warning --- Build/SQL/ExecuteAsCleanup.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/SQL/ExecuteAsCleanup.sql b/Build/SQL/ExecuteAsCleanup.sql index 6c1622ae6..c98e6cfe2 100644 --- a/Build/SQL/ExecuteAsCleanup.sql +++ b/Build/SQL/ExecuteAsCleanup.sql @@ -13,6 +13,6 @@ END IF @Counter >= @MaxAttempts BEGIN - RAISERROR('Impersonation could not be reverted after %d attempts.', 16, 1, @MaxAttempts); + RAISERROR('WARNING: Impersonation could not be reverted after %d attempts.', 0, 1, @MaxAttempts) WITH NOWAIT; END GO \ No newline at end of file From b2af2661d95d4ff3139ec51a4e8388a21ee2cb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 01:14:13 +0000 Subject: [PATCH 092/141] added debug output to CopyFilesToOutputDirs --- CI/Azure-DevOps/AZ_MainPipeline.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 7fd1b46aa..fe0676e15 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -492,7 +492,14 @@ stages: Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" - Get-ChildItem -Path "./output" -Recurse; + Write-Warning "CopyFilesToOutputDirs Results:" + Write-Warning "----------------------------------------------------------------" + Get-ChildItem "$(TSQLT_BUILD_DIR)" -Recurse; + Write-Warning "----------------------------------------------------------------" + Get-ChildItem "$(TSQLT_TESTS_DIR)" -Recurse; + Write-Warning "----------------------------------------------------------------" + Get-ChildItem "$(DACPAC_BUILD_DIR)" -Recurse; + Write-Warning "----------------------------------------------------------------" - task: PowerShell@2 name: BuildtSQLtZip From ed4c57765b0d029297d62dc1598652acf8d9b655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 19:52:57 +0000 Subject: [PATCH 093/141] added separators between stages --- CI/Azure-DevOps/AZ_MainPipeline.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index fe0676e15..5770a7e61 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -88,6 +88,11 @@ resources: stages: +########################################################################################################## +## CREATE VMs ## +########################################################################################################## + + - stage: Create_VMs dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel pool: @@ -237,6 +242,11 @@ stages: $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } +########################################################################################################## +## BUILD tSQLt - PART 1 ## +########################################################################################################## + + - stage: Build_tSQLt_Part1 dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel @@ -357,6 +367,12 @@ stages: artifact: 'tSQLtFilesArtifact' publishLocation: 'pipeline' + +########################################################################################################## +## BUILD tSQLt - PART 2 ## +########################################################################################################## + + - stage: Build_tSQLt_Part2 dependsOn: - Build_tSQLt_Part1 @@ -578,6 +594,12 @@ stages: } git status + +########################################################################################################## +## VALIDATE ## +########################################################################################################## + + - stage: Validate displayName: ValidateAll dependsOn: @@ -761,7 +783,11 @@ stages: throw "git failed. See prior errors."; } - ##--##--##--##--##--##--##--##--##--##---##--##--##--##--##--##--##--##--##--## + +########################################################################################################## +## DELETE RESOURCES ## +########################################################################################################## + - stage: Delete_Resources displayName: Delete Pipeline Resources From 080e1c78926c66f01146e018dcd50eecd74620c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 20:18:01 +0000 Subject: [PATCH 094/141] added logging to package step --- Build/tSQLt_BuildPackage.ps1 | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Build/tSQLt_BuildPackage.ps1 b/Build/tSQLt_BuildPackage.ps1 index 0bd1256aa..305a8038d 100644 --- a/Build/tSQLt_BuildPackage.ps1 +++ b/Build/tSQLt_BuildPackage.ps1 @@ -5,9 +5,18 @@ $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir try{ - $tSQLtBuildPath = '/output/tSQLtBuild/'; - $tSQLtTestsPath = '/output/tSQLtTests/'; - $DacpacBuildPath = '/output/DacpacBuild/'; + $tSQLtBuildPath = (Join-Path $invocationDir '/output/tSQLtBuild/'|Resolve-Path); + $tSQLtTestsPath = (Join-Path $invocationDir '/output/tSQLtTests/'|Resolve-Path); + $DacpacBuildPath = (Join-Path $invocationDir '/output/DacpacBuild/'|Resolve-Path); + Write-Warning "BuildPackage Inputs:" + Write-Warning "----------------------------------------------------------------" + Get-ChildItem $tSQLtBuildPath -Recurse |FT; + Write-Warning "----------------------------------------------------------------" + Get-ChildItem $tSQLtTestsPath -Recurse |FT; + Write-Warning "----------------------------------------------------------------" + Get-ChildItem $DacpacBuildPath -Recurse |FT; + Write-Warning "----------------------------------------------------------------" + $OutputPath = (Join-Path $invocationDir "/output/tSQLt/"); $TempPath = (Join-Path $invocationDir "/temp/tSQLt/"); @@ -51,16 +60,23 @@ try{ "$($tSQLtBuildPath)tSQLtSnippets(SQLPrompt).zip", "$($tSQLtBuildPath)tSQLtFiles.zip" ); - $files|%{(Join-Path $invocationDir $_ | Resolve-Path) | Copy-Item -Destination $SourcePath} - Get-ChildItem (Join-Path $invocationDir $DacpacBuildPath) | Copy-Item -Destination $DacpacSourcePath + $files | ForEach-Object{$_ | Copy-Item -Destination $SourcePath} + Get-ChildItem $DacpacBuildPath | Copy-Item -Destination $DacpacSourcePath <# Copy files to temp path #> Expand-Archive -Path (Join-Path $SourcePath "tSQLtFiles.zip" | Resolve-Path) -DestinationPath $PublicTempPath; # Get-ChildItem -Path ($dir + "/output/DacpacBuild/tSQLtFacade.*.dacpac") | Copy-Item -Destination $FacadeDacpacPath; - Get-ChildItem -Path ($DacpacSourcePath) -Filter 'tSQLt.*.dacpac' | Copy-Item -Destination $tSQLtDacpacPath; + Get-ChildItem -Path $DacpacSourcePath -Filter 'tSQLt.*.dacpac' | Copy-Item -Destination $tSQLtDacpacPath; Copy-Item (Join-Path $PublicTempPath "ReleaseNotes.txt" | Resolve-Path) -Destination (Join-Path $PublicTempPath "ReadMe.txt"); + Write-Warning "BuildPackage Pre-Zip:" + Write-Warning "----------------------------------------------------------------" + Get-ChildItem $PublicTempPath -Recurse |FT; + Write-Warning "----------------------------------------------------------------" + Get-ChildItem $ValidationOutputFiles -Recurse |FT; + Write-Warning "----------------------------------------------------------------" + <# Create the tSQLt.zip in the public output path #> $compress = @{ CompressionLevel = "Optimal" From 3503a6c98e2c413d941dae7d4a166282051097b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 20:31:08 +0000 Subject: [PATCH 095/141] removed debug prints --- Build/tSQLt_BuildPackage.ps1 | 28 ++++++++++++++-------------- CI/Azure-DevOps/AZ_MainPipeline.yml | 10 +++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Build/tSQLt_BuildPackage.ps1 b/Build/tSQLt_BuildPackage.ps1 index 305a8038d..9f2392fab 100644 --- a/Build/tSQLt_BuildPackage.ps1 +++ b/Build/tSQLt_BuildPackage.ps1 @@ -8,14 +8,14 @@ try{ $tSQLtBuildPath = (Join-Path $invocationDir '/output/tSQLtBuild/'|Resolve-Path); $tSQLtTestsPath = (Join-Path $invocationDir '/output/tSQLtTests/'|Resolve-Path); $DacpacBuildPath = (Join-Path $invocationDir '/output/DacpacBuild/'|Resolve-Path); - Write-Warning "BuildPackage Inputs:" - Write-Warning "----------------------------------------------------------------" - Get-ChildItem $tSQLtBuildPath -Recurse |FT; - Write-Warning "----------------------------------------------------------------" - Get-ChildItem $tSQLtTestsPath -Recurse |FT; - Write-Warning "----------------------------------------------------------------" - Get-ChildItem $DacpacBuildPath -Recurse |FT; - Write-Warning "----------------------------------------------------------------" + # Write-Warning "BuildPackage Inputs:" + # Write-Warning "----------------------------------------------------------------" + # Get-ChildItem $tSQLtBuildPath -Recurse |FT; + # Write-Warning "----------------------------------------------------------------" + # Get-ChildItem $tSQLtTestsPath -Recurse |FT; + # Write-Warning "----------------------------------------------------------------" + # Get-ChildItem $DacpacBuildPath -Recurse |FT; + # Write-Warning "----------------------------------------------------------------" $OutputPath = (Join-Path $invocationDir "/output/tSQLt/"); $TempPath = (Join-Path $invocationDir "/temp/tSQLt/"); @@ -70,12 +70,12 @@ try{ Copy-Item (Join-Path $PublicTempPath "ReleaseNotes.txt" | Resolve-Path) -Destination (Join-Path $PublicTempPath "ReadMe.txt"); - Write-Warning "BuildPackage Pre-Zip:" - Write-Warning "----------------------------------------------------------------" - Get-ChildItem $PublicTempPath -Recurse |FT; - Write-Warning "----------------------------------------------------------------" - Get-ChildItem $ValidationOutputFiles -Recurse |FT; - Write-Warning "----------------------------------------------------------------" + # Write-Warning "BuildPackage Pre-Zip:" + # Write-Warning "----------------------------------------------------------------" + # Get-ChildItem $PublicTempPath -Recurse |FT; + # Write-Warning "----------------------------------------------------------------" + # Get-ChildItem $ValidationOutputFiles -Recurse |FT; + # Write-Warning "----------------------------------------------------------------" <# Create the tSQLt.zip in the public output path #> $compress = @{ diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 5770a7e61..d106ad58f 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -508,14 +508,14 @@ stages: Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse; Get-ChildItem -Path "$(Pipeline.Workspace)/dacpacArtifactTmp" -Filter *.dacpac -Recurse | Copy-Item -Destination "$(DACPAC_BUILD_DIR)" - Write-Warning "CopyFilesToOutputDirs Results:" - Write-Warning "----------------------------------------------------------------" + Write-Host "CopyFilesToOutputDirs Results:" + Write-Host "----------------------------------------------------------------" Get-ChildItem "$(TSQLT_BUILD_DIR)" -Recurse; - Write-Warning "----------------------------------------------------------------" + Write-Host "----------------------------------------------------------------" Get-ChildItem "$(TSQLT_TESTS_DIR)" -Recurse; - Write-Warning "----------------------------------------------------------------" + Write-Host "----------------------------------------------------------------" Get-ChildItem "$(DACPAC_BUILD_DIR)" -Recurse; - Write-Warning "----------------------------------------------------------------" + Write-Host "----------------------------------------------------------------" - task: PowerShell@2 name: BuildtSQLtZip From a7502e4e3c5385ff42fe986c1ab4cc2435e2d8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Fri, 3 May 2024 20:38:08 +0000 Subject: [PATCH 096/141] fixed path in validation --- Build/tSQLt_ValidateRuntSQLtTests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/tSQLt_ValidateRuntSQLtTests.ps1 b/Build/tSQLt_ValidateRuntSQLtTests.ps1 index 9f5c89388..e51922e5e 100644 --- a/Build/tSQLt_ValidateRuntSQLtTests.ps1 +++ b/Build/tSQLt_ValidateRuntSQLtTests.ps1 @@ -27,7 +27,7 @@ if($DeploySource -eq "class"){ Log-Output('Deploying tSQLt from tSQLt DacPac...') $FriendlySQLServerVersion = Get-FriendlySQLServerVersion -SqlServerConnection $SqlServerConnection; - $DacpacFileName = (Join-Path $SourcePath ("tSQLtDacPacs/tSQLt."+$FriendlySQLServerVersion+".dacpac") | Resolve-Path); + $DacpacFileName = (Join-Path $SourcePath ("tSQLtDacpacs/tSQLt."+$FriendlySQLServerVersion+".dacpac") | Resolve-Path); $SqlConnectionString = $SqlServerConnection.GetConnectionString($TestDbName,'DeployDacpac') & sqlpackage /a:Publish /tcs:"$SqlConnectionString" /sf:"$DacpacFileName" if($LASTEXITCODE -ne 0) { From 785fba7da3dc7aefc17ce2099af974ac6cfaff2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 01:50:43 +0000 Subject: [PATCH 097/141] renamed create stage --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index d106ad58f..fa3f8740c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -89,7 +89,7 @@ resources: stages: ########################################################################################################## -## CREATE VMs ## +## CREATE VMs / Containers ## ########################################################################################################## @@ -99,7 +99,7 @@ stages: vmImage: 'windows-latest' jobs: - - job: Create_VM + - job: Create strategy: matrix: ${{ each version in parameters.VMMatrix }}: From 55f8ccd510d109be17178d2da09dbebb3c969cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 13:58:42 +0000 Subject: [PATCH 098/141] finished renaming and fixing references --- CI/Azure-DevOps/AZ_MainPipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index fa3f8740c..c00f33b1b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -93,7 +93,7 @@ stages: ########################################################################################################## -- stage: Create_VMs +- stage: Create_Environments dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel pool: vmImage: 'windows-latest' @@ -376,7 +376,7 @@ stages: - stage: Build_tSQLt_Part2 dependsOn: - Build_tSQLt_Part1 - - Create_VMs + - Create_Environments jobs: - job: Build_Dacpac @@ -388,7 +388,7 @@ stages: SQLVersionEdition: ${{ version.SQLVersionEdition }} variables: - databaseAccessDetails: $[convertToJson(stageDependencies.Create_VMs.Create_VM.outputs)] + databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] steps: - checkout: self @@ -604,7 +604,7 @@ stages: displayName: ValidateAll dependsOn: - Build_tSQLt_Part2 - - Create_VMs + - Create_Environments jobs: @@ -616,7 +616,7 @@ stages: SQLVersionEdition: ${{ version.SQLVersionEdition }} variables: - databaseAccessDetails: $[convertToJson(stageDependencies.Create_VMs.Create_VM.outputs)] + databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] steps: - checkout: self @@ -792,7 +792,7 @@ stages: - stage: Delete_Resources displayName: Delete Pipeline Resources dependsOn: - - Create_VMs + - Create_Environments - Validate condition: always() pool: @@ -809,7 +809,7 @@ stages: SQLVersionEdition: ${{ version.SQLVersionEdition }} variables: - databaseAccessDetails: $[convertToJson(stageDependencies.Create_VMs.Create_VM.outputs)] + databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] steps: - checkout: self From 2b3c6dedaf00063b013b63abf06892758b31e948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 14:15:26 +0000 Subject: [PATCH 099/141] fixed cfam import --- CI/Azure-DevOps/CreateSQLContainer.ps1 | 2 -- CI/Azure-DevOps/CreateSQLVM_azcli.ps1 | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CI/Azure-DevOps/CreateSQLContainer.ps1 b/CI/Azure-DevOps/CreateSQLContainer.ps1 index 6815598e3..b6a95919b 100644 --- a/CI/Azure-DevOps/CreateSQLContainer.ps1 +++ b/CI/Azure-DevOps/CreateSQLContainer.ps1 @@ -14,9 +14,7 @@ Write-Host "Starting execution of CreateSQLContainer.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir -Write-Warning 'GH1'; $cfam = (Join-Path (Join-Path $invocationDir "../../Build/") "CommonFunctionsAndMethods.psm1" | Resolve-Path) -Write-Warning 'GH2'; Write-Host "Attempting to load module from: $cfam" Import-Module "$cfam" -Force -Verbose Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded diff --git a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 index cc61a18bd..8a6b63938 100644 --- a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 +++ b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 @@ -19,15 +19,18 @@ Param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $VMPriority ); -$scriptpath = $MyInvocation.MyCommand.Path; -$dir = Split-Path $scriptpath; -$projectDir = Split-Path (Split-Path $dir); +Write-Host "Starting execution of CreateSQLContainer.ps1" +$__=$__ #quiesce warnings +$invocationDir = $PSScriptRoot +Push-Location -Path $invocationDir +$cfam = (Join-Path (Join-Path $invocationDir "../../Build/") "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Host "Attempting to load module from: $cfam" +Import-Module "$cfam" -Force -Verbose +Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded -.($projectDir+"\Build\CommonFunctionsAndMethods.ps1") Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->"; -Log-Output "FileLocation: ", $dir; -Log-Output "Project Location: ", $projectDir; +Log-Output "FileLocation: ", $invocationDir; Log-Output "Parameters: ---------------------------"; Log-Output "Location:", $Location; Log-Output "Size:", $Size; @@ -71,7 +74,7 @@ $SQLVersionEditionHash = @{ $SQLVersionEditionInfo = $SQLVersionEditionHash.$SQLVersionEdition; $ImageUrn = $SQLVersionEditionInfo.publisher+":"+$SQLVersionEditionInfo.offer+":"+$SQLVersionEditionInfo.sku+":"+$SQLVersionEditionInfo.version; -$TemplateFile = $dir + "/" + $SQLVersionEditionInfo.bicep; +$TemplateFile = (Join-Path $invocationDir $SQLVersionEditionInfo.bicep | Resolve-Path); Log-Output "ImageUrn: ", $ImageUrn; Log-Output "SQLVersionEditionInfo: ", $SQLVersionEditionInfo; Log-Output "TemplateFile: ", $TemplateFile; @@ -177,7 +180,8 @@ $SQLVM|Out-String|Log-Output; Log-Output 'DONE: Applying SqlVM Config' Log-Output 'START: Prep SQL Server for tSQLt Build' -$DS = Invoke-Sqlcmd -InputFile "$dir/GetSQLServerVersion.sql" -ServerInstance "$FQDN,$SQLPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate +$GetSQLServerVersionPath = (Join-Path $invocationDir "GetSQLServerVersion.sql" | Resolve-Path) +$DS = Invoke-Sqlcmd -InputFile $GetSQLServerVersionPath -ServerInstance "$FQDN,$SQLPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate $DS.Tables[0].Rows | %{ Log-Output "{ $($_['LoginName']), $($_['TimeStamp']), $($_['VersionDetail']), $($_['ProductVersion']), $($_['ProductLevel']), $($_['SqlVersion']), $($_['ServerCollation']) }" } $ActualSQLVersion = $DS.Tables[0].Rows[0]['SqlVersion']; From 4f82bd2c141e5de810ceb93e9127342573163703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 14:43:39 +0000 Subject: [PATCH 100/141] added SQL2022 --- CI/Azure-DevOps/CreateSQLVM_azcli.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 index 8a6b63938..e034b67e8 100644 --- a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 +++ b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 @@ -70,6 +70,7 @@ $SQLVersionEditionHash = @{ "2016"=@{"sqlversion"="2016";"offer"="SQL2016SP2-WS2016";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2016sp2-ws2019:sqldev:latest "2017"=@{"sqlversion"="2017";"offer"="sql2017-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2017-ws2019:sqldev:latest "2019"=@{"sqlversion"="2019";"offer"="sql2019-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2019-ws2019:sqldev:latest + "2022"=@{"sqlversion"="2022";"offer"="sql2022-ws2022";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2022-ws2022:sqldev:latest }; $SQLVersionEditionInfo = $SQLVersionEditionHash.$SQLVersionEdition; From 4f61cf67e0c8902ab8c85d6149b52d89ed4dffa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 15:03:58 +0000 Subject: [PATCH 101/141] upgraded SQL Server VersionEdition Info --- CI/Azure-DevOps/CreateSQLVM_azcli.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 index e034b67e8..914ab4f73 100644 --- a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 +++ b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 @@ -67,10 +67,10 @@ $SQLVersionEditionHash = @{ "2008R2Std"=@{"sqlversion"="2008R2";"offer"="SQL2008R2SP3-WS2008R2SP1";"publisher"="microsoftsqlserver";"sku"="Standard";"osType"="Windows";"version"="latest";"bicep"="CreateSqlVirtualMachineTemplate-2008R2.bicep"}; #MicrosoftSQLServer:SQL2008R2SP3-WS2008R2SP1:Standard:latest "2012Ent"=@{"sqlversion"="2012";"offer"="SQL2012SP4-WS2012R2";"publisher"="microsoftsqlserver";"sku"="Enterprise";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:SQL2012SP4-WS2012R2:Enterprise:latest "2014"=@{"sqlversion"="2014";"offer"="sql2014sp3-ws2012r2";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2014sp3-ws2012r2:sqldev:latest - "2016"=@{"sqlversion"="2016";"offer"="SQL2016SP2-WS2016";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2016sp2-ws2019:sqldev:latest + "2016"=@{"sqlversion"="2016";"offer"="sql2016sp3-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2016sp2-ws2019:sqldev:latest "2017"=@{"sqlversion"="2017";"offer"="sql2017-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2017-ws2019:sqldev:latest - "2019"=@{"sqlversion"="2019";"offer"="sql2019-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2019-ws2019:sqldev:latest - "2022"=@{"sqlversion"="2022";"offer"="sql2022-ws2022";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2022-ws2022:sqldev:latest + "2019"=@{"sqlversion"="2019";"offer"="sql2019-ws2022";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2019-ws2019:sqldev:latest + "2022"=@{"sqlversion"="2022";"offer"="sql2022-ws2022";"publisher"="microsoftsqlserver";"sku"="sqldev-gen2";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2022-ws2022:sqldev:latest }; $SQLVersionEditionInfo = $SQLVersionEditionHash.$SQLVersionEdition; From e1ceb7dd3b8e5702460007895b9ce057dddecfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 15:40:52 +0000 Subject: [PATCH 102/141] changed default to include all supported SQL Server versions on Windows and Linux --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c00f33b1b..2976e6cc2 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -30,6 +30,14 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau SQLVersionEdition: 2017 - name: SQL2019 SQLVersionEdition: 2019 + - name: SQL2022 + SQLVersionEdition: 2022 + - name: SQL2017Linux + SQLVersionEdition: 2017L + - name: SQL2019Linux + SQLVersionEdition: 2019L + - name: SQL2022Linux + SQLVersionEdition: 2022L - name: VMPriority displayName: VM Priority type: string From 926208ecff04c5668506212ff1873e398e6c6224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 16:17:30 +0000 Subject: [PATCH 103/141] local build now broken... --- Build/CommonFunctionsAndMethods.psm1 | 42 --------------------------- Build/LocalBuild.ps1 | 11 +++++-- Build/SQLServerConnection.ps1 | 2 +- CI/Azure-DevOps/CreateSQLVM_azcli.ps1 | 2 +- 4 files changed, 10 insertions(+), 47 deletions(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index ed3ad5a13..92b1eb98e 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -116,48 +116,6 @@ $dddafter-$dddbefore } } -Function Get-SqlConnectionString -{ - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $ServerName, - [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Login, - [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $DatabaseName - ); - - $ServerNameTrimmed = $ServerName.Trim(); - $LoginTrimmed = $Login.Trim(); - - <# - ☹️ - This is so questionable, but it looks like sqlpackage cannot handle valid connection strings that use a valid server alias. - The following snippet is meant to spelunk through the registry and extract the actual server from the alias. - ☹️ - #> - $resolvedServerName = $ServerNameTrimmed; - $serverAlias = Get-Item -Path HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo -ErrorAction SilentlyContinue; - if ($null -ne $serverAlias -And $serverAlias.GetValueNames() -contains $ServerNameTrimmed) { - $aliasValue = $serverAlias.GetValue($ServerNameTrimmed) - if ($aliasValue -match "DBMSSOCN[,](.*)"){ - $resolvedServerName = $Matches[1]; - } - } - - <# When using Windows Authentication, you must use "Integrated Security=SSPI" in the SqlConnectionString. Else use "User ID=;Password=;" #> - if ($LoginTrimmed -match '((.*[-][uU])|(.*[-][pP]))+.*'){ - $AuthenticationString = $LoginTrimmed -replace '^((\s*[-][uU]\s+(?\S+)\s*)|(\s*[-][pP]\s+)((?[''"])(?.*?)\k|(?\S+))\s*)+$', 'User Id=${user};Password="${password}"' - } - elseif ($LoginTrimmed -eq "-E"){ - $AuthenticationString = "Integrated Security=SSPI;"; - } - else{ - throw $LoginTrimmed + " is not supported here." - } - - $SqlConnectionString = "Data Source="+$resolvedServerName+";"+$AuthenticationString+";Connect Timeout=60;Initial Catalog="+$DatabaseName+";TrustServerCertificate=true;"; - $SqlConnectionString; -} - function Get-TempFileForQuery { [CmdletBinding()] [OutputType([string])] diff --git a/Build/LocalBuild.ps1 b/Build/LocalBuild.ps1 index 1e697873d..1075f0aad 100644 --- a/Build/LocalBuild.ps1 +++ b/Build/LocalBuild.ps1 @@ -1,5 +1,3 @@ -using module "./CommonFunctionsAndMethods.psm1"; - param( [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $ServerName = 'localhost,1433', [Parameter(Mandatory=$true, ParameterSetName = 'UserPass')][ValidateNotNullOrEmpty()][string] $UserName = "sa" , @@ -14,7 +12,14 @@ param( $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} -Get-Module -Name CommonFunctionsAndMethods | Select-Object Name, Path, Version +Write-Host "Starting execution of LocalBuild.ps1" +$__=$__ #quiesce warnings +$invocationDir = $PSScriptRoot +Push-Location -Path $invocationDir +$cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Host "Attempting to load module from: $cfam" +Import-Module "$cfam" -Force -Verbose +. (Join-Path $invocationDir 'SQLServerConnection.ps1'); function CleanTemp { param ( diff --git a/Build/SQLServerConnection.ps1 b/Build/SQLServerConnection.ps1 index d65240772..d199bfe91 100644 --- a/Build/SQLServerConnection.ps1 +++ b/Build/SQLServerConnection.ps1 @@ -6,7 +6,7 @@ if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) hidden [System.Security.SecureString]$Password hidden [bool]$TrustedConnection hidden [string]$ApplicationName - hidden [string]$BaseConnectionString = "Connect Timeout=60;TrustServerCertificate=true;" + hidden [string]$BaseConnectionString = "Connect Timeout=60;Encrypt=false;TrustServerCertificate=true;" SqlServerConnection([string]$ServerName, [string]$UserName, [System.Security.SecureString]$Password,[string]$ApplicationName) { $this.ServerName = $ServerName.Trim() diff --git a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 index 914ab4f73..c108e42f9 100644 --- a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 +++ b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 @@ -19,7 +19,7 @@ Param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $VMPriority ); -Write-Host "Starting execution of CreateSQLContainer.ps1" +Write-Host "Starting execution of CreateSQLVM_azcli.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir From 885e32a69162fa8d087cae9d975c878d32bf62a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 4 May 2024 18:38:16 +0000 Subject: [PATCH 104/141] testing no-encryption connection string --- Build/LocalValidate.ps1 | 13 ++++++++----- Build/SQLServerConnection.ps1 | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Build/LocalValidate.ps1 b/Build/LocalValidate.ps1 index d423be009..b317aea39 100644 --- a/Build/LocalValidate.ps1 +++ b/Build/LocalValidate.ps1 @@ -1,5 +1,3 @@ -using module "./CommonFunctionsAndMethods.psm1"; - param( [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $ServerName = 'localhost,1433', [Parameter(Mandatory=$true, ParameterSetName = 'UserPass')][ValidateNotNullOrEmpty()][string] $UserName = "sa" , @@ -11,11 +9,16 @@ param( $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} -Get-Module -Name CommonFunctionsAndMethods | Select-Object Name, Path, Version - - +Write-Host "Starting execution of LocalBuild.ps1" +$__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir +$cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) +Write-Host "Attempting to load module from: $cfam" +Import-Module "$cfam" -Force -Verbose +. (Join-Path $invocationDir 'SQLServerConnection.ps1'); + + try{ if($TrustedConnection){ diff --git a/Build/SQLServerConnection.ps1 b/Build/SQLServerConnection.ps1 index d199bfe91..d0d6281bb 100644 --- a/Build/SQLServerConnection.ps1 +++ b/Build/SQLServerConnection.ps1 @@ -6,7 +6,7 @@ if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) hidden [System.Security.SecureString]$Password hidden [bool]$TrustedConnection hidden [string]$ApplicationName - hidden [string]$BaseConnectionString = "Connect Timeout=60;Encrypt=false;TrustServerCertificate=true;" + hidden [string]$BaseConnectionString = "Connect Timeout=60;"#Encrypt=false;TrustServerCertificate=true;" SqlServerConnection([string]$ServerName, [string]$UserName, [System.Security.SecureString]$Password,[string]$ApplicationName) { $this.ServerName = $ServerName.Trim() From 49ea9e8f4daf86c32d239a8a023893758a24d91e Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 5 May 2024 09:20:42 -0400 Subject: [PATCH 105/141] Can we connect to sql 2014 from windows? --- CI/Azure-DevOps/AZ_MainPipeline.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 2976e6cc2..af2400947 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -469,6 +469,9 @@ stages: - job: Package_tSQLt_Artifact dependsOn: Build_Dacpac + pool: + vmImage: 'windows-latest' + steps: - checkout: self From 6c19095771ba69fa50ba4d859267bae72103909f Mon Sep 17 00:00:00 2001 From: Sebastian Meine Date: Sun, 5 May 2024 12:45:14 -0400 Subject: [PATCH 106/141] Fixed placement --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index af2400947..64e6e0f5d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -395,6 +395,9 @@ stages: ${{ format('{0}', version.name) }}: SQLVersionEdition: ${{ version.SQLVersionEdition }} + pool: + vmImage: 'windows-latest' + variables: databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] @@ -469,9 +472,6 @@ stages: - job: Package_tSQLt_Artifact dependsOn: Build_Dacpac - pool: - vmImage: 'windows-latest' - steps: - checkout: self From d586a4b27204255bfb831ff4628bac77c9da32d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 5 May 2024 22:24:12 +0000 Subject: [PATCH 107/141] Revert connection string --- Build/SQLServerConnection.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/SQLServerConnection.ps1 b/Build/SQLServerConnection.ps1 index d0d6281bb..d65240772 100644 --- a/Build/SQLServerConnection.ps1 +++ b/Build/SQLServerConnection.ps1 @@ -6,7 +6,7 @@ if (-not ([System.Management.Automation.PSTypeName]'SqlServerConnection').Type) hidden [System.Security.SecureString]$Password hidden [bool]$TrustedConnection hidden [string]$ApplicationName - hidden [string]$BaseConnectionString = "Connect Timeout=60;"#Encrypt=false;TrustServerCertificate=true;" + hidden [string]$BaseConnectionString = "Connect Timeout=60;TrustServerCertificate=true;" SqlServerConnection([string]$ServerName, [string]$UserName, [System.Security.SecureString]$Password,[string]$ApplicationName) { $this.ServerName = $ServerName.Trim() From d67fbd42de0ffa4af46bcd04ff3423cc4d37ec30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 9 May 2024 22:46:38 +0000 Subject: [PATCH 108/141] disabled delete vm --- CI/Azure-DevOps/AZ_MainPipeline.yml | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 64e6e0f5d..c5108c002 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -22,22 +22,22 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau default: # - name: SQL2012 # SQLVersionEdition: 2012Ent - - name: SQL2014 - SQLVersionEdition: 2014 + # - name: SQL2014 + # SQLVersionEdition: 2014 - name: SQL2016 SQLVersionEdition: 2016 - - name: SQL2017 - SQLVersionEdition: 2017 - - name: SQL2019 - SQLVersionEdition: 2019 - - name: SQL2022 - SQLVersionEdition: 2022 - - name: SQL2017Linux - SQLVersionEdition: 2017L - - name: SQL2019Linux - SQLVersionEdition: 2019L - - name: SQL2022Linux - SQLVersionEdition: 2022L + # - name: SQL2017 + # SQLVersionEdition: 2017 + # - name: SQL2019 + # SQLVersionEdition: 2019 + # - name: SQL2022 + # SQLVersionEdition: 2022 + # - name: SQL2017Linux + # SQLVersionEdition: 2017L + # - name: SQL2019Linux + # SQLVersionEdition: 2019L + # - name: SQL2022Linux + # SQLVersionEdition: 2022L - name: VMPriority displayName: VM Priority type: string @@ -805,7 +805,7 @@ stages: dependsOn: - Create_Environments - Validate - condition: always() + condition: false #always() pool: vmImage: 'windows-latest' From f805f25ca0a55f75b98b87b8d4060f9aa7cbc3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 01:33:12 +0000 Subject: [PATCH 109/141] added parameter to Create Environment Only --- CI/Azure-DevOps/AZ_MainPipeline.yml | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c5108c002..1da0a0067 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -46,6 +46,10 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau - Spot - Regular - Low + - name: CreateEnvOnly + displayName: Create Environment Only + default: false + type: boolean variables: - name: ArtifactBranchName @@ -249,6 +253,34 @@ stages: $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } + - job: PrintConnectionInfo + dependsOn: Create_Environments + condition: eq(${{ parameters.envonly }}, true) + strategy: + matrix: + ${{ each version in parameters.VMMatrix }}: + ${{ format('{0}', version.name) }}: + SQLVersionEdition: ${{ version.SQLVersionEdition }} + SQLVersionName: ${{ version.name }} + steps: + - task: PowerShell@2 + name: PrintConnectionInfo + inputs: + targetType: 'inline' + script: | + $SQLUserNameKey = "$(System.JobName).CreateSQLVMEnvironment.SQLUserName"; + $SQLPwdKey = "$(System.JobName).CreateSQLVMEnvironment.SQLPwd"; + $FQDNAndPortKey = "$(System.JobName).CreateSQLVMEnvironment.FQDNAndPort"; + $SQLUserName = $myJsonObject.$SQLUserNameKey; + $SQLPwd = (ConvertTo-SecureString $myJsonObject.$SQLPwdKey -AsPlainText); + $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; + Log-Output '=========================================================='; + Log-Output "Name: $(SQLVersionName)"; + Log-Output "FQDN: $FQDNAndPort"; + Log-Output "User: $SQLUserName"; + Log-Output "FQDN: $SQLPwd"; + Log-Output '=========================================================='; + ########################################################################################################## ## BUILD tSQLt - PART 1 ## @@ -263,6 +295,7 @@ stages: - job: CompileCLR timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 + condition: eq(${{ parameters.envonly }}, false) # variables: # CertificatePath: '$(Build.Repository.LocalPath)/tsqltclr/OfficialSigningKey/tSQLtOfficialSigningKey.pfx' @@ -805,7 +838,9 @@ stages: dependsOn: - Create_Environments - Validate - condition: false #always() + + condition: not(and(eq(${{ parameters.envonly }}, true), eq(stageDependencies.Create_Environments.Create.result, 'Succeeded'))) + pool: vmImage: 'windows-latest' From 038793aaa26b5655ea0268b5c89e2a0866c76257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 01:35:24 +0000 Subject: [PATCH 110/141] fixed typo --- CI/Azure-DevOps/AZ_MainPipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 1da0a0067..8767d6ccb 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -38,6 +38,10 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau # SQLVersionEdition: 2019L # - name: SQL2022Linux # SQLVersionEdition: 2022L + - name: CreateEnvOnly + displayName: Create Environment Only + default: false + type: boolean - name: VMPriority displayName: VM Priority type: string @@ -46,10 +50,6 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau - Spot - Regular - Low - - name: CreateEnvOnly - displayName: Create Environment Only - default: false - type: boolean variables: - name: ArtifactBranchName @@ -255,7 +255,7 @@ stages: - job: PrintConnectionInfo dependsOn: Create_Environments - condition: eq(${{ parameters.envonly }}, true) + condition: eq(${{ parameters.CreateEnvOnly }}, true) strategy: matrix: ${{ each version in parameters.VMMatrix }}: @@ -295,7 +295,7 @@ stages: - job: CompileCLR timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 - condition: eq(${{ parameters.envonly }}, false) + condition: eq(${{ parameters.CreateEnvOnly }}, false) # variables: # CertificatePath: '$(Build.Repository.LocalPath)/tsqltclr/OfficialSigningKey/tSQLtOfficialSigningKey.pfx' @@ -839,7 +839,7 @@ stages: - Create_Environments - Validate - condition: not(and(eq(${{ parameters.envonly }}, true), eq(stageDependencies.Create_Environments.Create.result, 'Succeeded'))) + condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.Create.result, 'Succeeded'))) pool: vmImage: 'windows-latest' From 46be2ad39700ac6528be204a49534aadfa74b06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 01:36:39 +0000 Subject: [PATCH 111/141] more typos --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 8767d6ccb..896408b49 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -254,7 +254,7 @@ stages: $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } - job: PrintConnectionInfo - dependsOn: Create_Environments + dependsOn: Create condition: eq(${{ parameters.CreateEnvOnly }}, true) strategy: matrix: From 490fc84a1ca1cb998939b13f7aab59bd26e779cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 01:45:28 +0000 Subject: [PATCH 112/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 896408b49..054c3598e 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -263,6 +263,7 @@ stages: SQLVersionEdition: ${{ version.SQLVersionEdition }} SQLVersionName: ${{ version.name }} steps: + - checkout: none - task: PowerShell@2 name: PrintConnectionInfo inputs: @@ -274,12 +275,12 @@ stages: $SQLUserName = $myJsonObject.$SQLUserNameKey; $SQLPwd = (ConvertTo-SecureString $myJsonObject.$SQLPwdKey -AsPlainText); $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; - Log-Output '=========================================================='; - Log-Output "Name: $(SQLVersionName)"; - Log-Output "FQDN: $FQDNAndPort"; - Log-Output "User: $SQLUserName"; - Log-Output "FQDN: $SQLPwd"; - Log-Output '=========================================================='; + Write-Info '=========================================================='; + Write-Warning "Name: $(SQLVersionName)"; + Write-Warning "FQDN: $FQDNAndPort"; + Write-Warning "User: $SQLUserName"; + Write-Warning "FQDN: $SQLPwd"; + Write-Host '=========================================================='; ########################################################################################################## @@ -289,13 +290,13 @@ stages: - stage: Build_tSQLt_Part1 dependsOn: [] # this removes the implicit dependency on previous stage and causes this to run in parallel + condition: eq(${{ parameters.CreateEnvOnly }}, false) jobs: - job: CompileCLR timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 - condition: eq(${{ parameters.CreateEnvOnly }}, false) # variables: # CertificatePath: '$(Build.Repository.LocalPath)/tsqltclr/OfficialSigningKey/tSQLtOfficialSigningKey.pfx' From 91dcdb39c38083e2585bb78d5193476bb82776ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 01:50:24 +0000 Subject: [PATCH 113/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 054c3598e..c107e9239 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -255,7 +255,7 @@ stages: - job: PrintConnectionInfo dependsOn: Create - condition: eq(${{ parameters.CreateEnvOnly }}, true) + condition: and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create')) strategy: matrix: ${{ each version in parameters.VMMatrix }}: From d603e65e0c47d82f3e87bd64df292dcb5cb1ab35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 02:02:13 +0000 Subject: [PATCH 114/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index c107e9239..8b2ee22ac 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -262,6 +262,8 @@ stages: ${{ format('{0}', version.name) }}: SQLVersionEdition: ${{ version.SQLVersionEdition }} SQLVersionName: ${{ version.name }} + variables: + databaseAccessDetails: $[convertToJson(Create.outputs)] steps: - checkout: none - task: PowerShell@2 @@ -269,11 +271,15 @@ stages: inputs: targetType: 'inline' script: | + $inputObject = @' + $(databaseAccessDetails) + '@; + $myJsonObject = ConvertFrom-JSON -InputObject $inputObject; $SQLUserNameKey = "$(System.JobName).CreateSQLVMEnvironment.SQLUserName"; $SQLPwdKey = "$(System.JobName).CreateSQLVMEnvironment.SQLPwd"; $FQDNAndPortKey = "$(System.JobName).CreateSQLVMEnvironment.FQDNAndPort"; $SQLUserName = $myJsonObject.$SQLUserNameKey; - $SQLPwd = (ConvertTo-SecureString $myJsonObject.$SQLPwdKey -AsPlainText); + $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; Write-Info '=========================================================='; Write-Warning "Name: $(SQLVersionName)"; @@ -281,6 +287,12 @@ stages: Write-Warning "User: $SQLUserName"; Write-Warning "FQDN: $SQLPwd"; Write-Host '=========================================================='; + - task: PowerShell@2 + name: fail + inputs: + targetType: 'inline' + script: | + 1/0 ########################################################################################################## From 59f0813ce0e494ca8305d3ecd588df7b0494155f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 02:25:14 +0000 Subject: [PATCH 115/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 8b2ee22ac..628531546 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -287,12 +287,6 @@ stages: Write-Warning "User: $SQLUserName"; Write-Warning "FQDN: $SQLPwd"; Write-Host '=========================================================='; - - task: PowerShell@2 - name: fail - inputs: - targetType: 'inline' - script: | - 1/0 ########################################################################################################## @@ -852,7 +846,7 @@ stages: - Create_Environments - Validate - condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.Create.result, 'Succeeded'))) + condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.PrintConnectionInfo.result, 'Succeeded'))) pool: vmImage: 'windows-latest' From 1b18dee316a71f69c51c130befe42190c088ccfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sat, 11 May 2024 02:29:27 +0000 Subject: [PATCH 116/141] .......... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 628531546..e357bae78 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -263,7 +263,7 @@ stages: SQLVersionEdition: ${{ version.SQLVersionEdition }} SQLVersionName: ${{ version.name }} variables: - databaseAccessDetails: $[convertToJson(Create.outputs)] + databaseAccessDetails: $[convertToJson(dependencies.Create.outputs)] steps: - checkout: none - task: PowerShell@2 From e62dafcc49c2c639210952481fc255f029ced9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 18:14:23 +0000 Subject: [PATCH 117/141] .......... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index e357bae78..8ef52b09d 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -281,12 +281,12 @@ stages: $SQLUserName = $myJsonObject.$SQLUserNameKey; $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; - Write-Info '=========================================================='; + Write-Host '==========================================================' -ForegroundColor Yellow; Write-Warning "Name: $(SQLVersionName)"; Write-Warning "FQDN: $FQDNAndPort"; Write-Warning "User: $SQLUserName"; Write-Warning "FQDN: $SQLPwd"; - Write-Host '=========================================================='; + Write-Host '==========================================================' -ForegroundColor Yellow; ########################################################################################################## From 290a3636e487e7e5a08d8d1780f60f4ba3bdd59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 18:29:32 +0000 Subject: [PATCH 118/141] do we eed an addition job? --- CI/Azure-DevOps/AZ_MainPipeline.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 8ef52b09d..840f445bd 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -241,6 +241,16 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; + if eq(${{ parameters.CreateEnvOnly }}, true){ + Write-Host '==========================================================' -ForegroundColor Yellow; + Write-Warning "Name: $(SQLVersionName)"; + Write-Warning "RGNm: $ResourceGroupName"; + Write-Warning "FQDN: $FQDNAndPort"; + Write-Warning "User: $SQLUserName"; + Write-Warning "Pass: $SQLPwd"; + Write-Host '==========================================================' -ForegroundColor Yellow; + } + - task: PowerShell@2 name: PrintSQLVersionInfo @@ -285,7 +295,7 @@ stages: Write-Warning "Name: $(SQLVersionName)"; Write-Warning "FQDN: $FQDNAndPort"; Write-Warning "User: $SQLUserName"; - Write-Warning "FQDN: $SQLPwd"; + Write-Warning "Pass: $SQLPwd"; Write-Host '==========================================================' -ForegroundColor Yellow; From bdd3d316b0031e45ad1338d88bd4ae11152db2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 18:33:18 +0000 Subject: [PATCH 119/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 840f445bd..b9717e221 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -241,7 +241,7 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - if eq(${{ parameters.CreateEnvOnly }}, true){ + if(eq(${{ parameters.CreateEnvOnly }}, true)){ Write-Host '==========================================================' -ForegroundColor Yellow; Write-Warning "Name: $(SQLVersionName)"; Write-Warning "RGNm: $ResourceGroupName"; From 85210cd44410f61b30daaed63d9a8d0928f6ccc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 18:37:15 +0000 Subject: [PATCH 120/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index b9717e221..add3224fc 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -241,7 +241,7 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - if(eq(${{ parameters.CreateEnvOnly }}, true)){ + if(eq("${{ parameters.CreateEnvOnly }}", "True")){ Write-Host '==========================================================' -ForegroundColor Yellow; Write-Warning "Name: $(SQLVersionName)"; Write-Warning "RGNm: $ResourceGroupName"; From 524fe641ff23e58511e9ff3bd4a50457ec7a76ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 18:44:36 +0000 Subject: [PATCH 121/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index add3224fc..72271e4c2 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -241,7 +241,7 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - if(eq("${{ parameters.CreateEnvOnly }}", "True")){ + if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ Write-Host '==========================================================' -ForegroundColor Yellow; Write-Warning "Name: $(SQLVersionName)"; Write-Warning "RGNm: $ResourceGroupName"; From de15c4a31863a2160ea67d924d05f21246a32c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 19:20:31 +0000 Subject: [PATCH 122/141] ....... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 72271e4c2..113860e80 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -241,16 +241,6 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ - Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning "Name: $(SQLVersionName)"; - Write-Warning "RGNm: $ResourceGroupName"; - Write-Warning "FQDN: $FQDNAndPort"; - Write-Warning "User: $SQLUserName"; - Write-Warning "Pass: $SQLPwd"; - Write-Host '==========================================================' -ForegroundColor Yellow; - } - - task: PowerShell@2 name: PrintSQLVersionInfo @@ -263,6 +253,16 @@ stages: $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } + if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ + Write-Host '==========================================================' -ForegroundColor Yellow; + Write-Warning "Name: $(SQLVersionName)"; + Write-Warning "RGNm: $(CreateSQLVMEnvironment.ResourceGroupName)"; + Write-Warning "FQDN: $(CreateSQLVMEnvironment.FQDNAndPort)"; + Write-Warning "User: $(CreateSQLVMEnvironment.SQLUserName)"; + Write-Warning "Pass: $(CreateSQLVMEnvironment.SQLPwd)"; + Write-Host '==========================================================' -ForegroundColor Yellow; + } + - job: PrintConnectionInfo dependsOn: Create condition: and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create')) From 7a3633a7ec7b277ee92cf405a55e5eff467b5320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 19:34:18 +0000 Subject: [PATCH 123/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 42 +++++++++-------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 113860e80..fbae3fd1c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -225,14 +225,12 @@ stages: # $SerializedVMDetails; #-----------------------------------------------------------------------# - # IMPORTANT (and, you've got to be kidding me): # - # The space below is absolutely required to make the ANT Task work. # + # The space below is required to make ANT work. (Not currently in use.) # #---------------------------------------|-------------------------------# $FQDNAndPort = $VMDetails.SQLVmFQDN + ", " + $VMDetails.SQLVmPort; #---------------------------------------|-------------------------------# #-----------------------------------------------------------------------# - #TODO refactor such that the resourcegroupname is created in a previous step, so that it can be used by the delete job, even if this one is cancelled/failed. $ResourceGroupName = $VMDetails.ResourceGroupName; Write-Host "##vso[task.setvariable variable=SQLUserName;isOutput=true]$SQLUserName" Write-Host "##vso[task.setvariable variable=SQLPwd;isOutput=true]$SQLPwd" @@ -242,27 +240,6 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - - task: PowerShell@2 - name: PrintSQLVersionInfo - env: - USER_NAME: $(tSQLt-UserForCIEnvironment-UserName) - PASSWORD: $(tSQLt-UserForCIEnvironment-Password) - inputs: - targetType: 'inline' - script: | - $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate - $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } - - if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ - Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning "Name: $(SQLVersionName)"; - Write-Warning "RGNm: $(CreateSQLVMEnvironment.ResourceGroupName)"; - Write-Warning "FQDN: $(CreateSQLVMEnvironment.FQDNAndPort)"; - Write-Warning "User: $(CreateSQLVMEnvironment.SQLUserName)"; - Write-Warning "Pass: $(CreateSQLVMEnvironment.SQLPwd)"; - Write-Host '==========================================================' -ForegroundColor Yellow; - } - - job: PrintConnectionInfo dependsOn: Create condition: and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create')) @@ -291,12 +268,17 @@ stages: $SQLUserName = $myJsonObject.$SQLUserNameKey; $SQLPwd = $myJsonObject.$SQLPwdKey; $FQDNAndPort = $myJsonObject.$FQDNAndPortKey; - Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning "Name: $(SQLVersionName)"; - Write-Warning "FQDN: $FQDNAndPort"; - Write-Warning "User: $SQLUserName"; - Write-Warning "Pass: $SQLPwd"; - Write-Host '==========================================================' -ForegroundColor Yellow; + + $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$FQDNAndPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate + $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } + if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ + Write-Host '==========================================================' -ForegroundColor Yellow; + Write-Warning "Name: $(SQLVersionName)"; + Write-Warning "FQDN: $FQDNAndPort"; + Write-Warning "User: $SQLUserName"; + Write-Warning "Pass: $SQLPwd"; + Write-Host '==========================================================' -ForegroundColor Yellow; + } ########################################################################################################## From 72a496abe3e93988ba31cf98164d9f09e7b36d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 19:53:08 +0000 Subject: [PATCH 124/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index fbae3fd1c..a79fc2405 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -273,11 +273,20 @@ stages: $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning "Name: $(SQLVersionName)"; - Write-Warning "FQDN: $FQDNAndPort"; - Write-Warning "User: $SQLUserName"; - Write-Warning "Pass: $SQLPwd"; + Write-Host "Name: $(SQLVersionName)"; + Write-Host "FQDN: $FQDNAndPort"; + Write-Host "User: $SQLUserName"; + Write-Host "Pass: $SQLPwd"; Write-Host '==========================================================' -ForegroundColor Yellow; + + Write-Warning 'This information is now public! Run the following statement to change the password immediately!' -ForegroundColor Yellow; + + $Command = '$NewPwd = -join ((33..126) * 3 | Get-Random -Count 12 | % {[char]$_}); Write-Output "New Password: $NewPwd"; Invoke-Sqlcmd -Query "ALTER LOGIN [$($myJsonObject.$SQLUserNameKey)] WITH PASSWORD = ''$NewPwd'' REUSE;" -ServerInstance $myJsonObject.$FQDNAndPortKey -Username $myJsonObject.$SQLUserNameKey -Password $myJsonObject.$SQLPwdKey' + $EscapedCommand = $Command -replace '"', '""' + Write-Host '==========================================================' -ForegroundColor Yellow; + Write-Host $EscapedCommand + Write-Host '==========================================================' -ForegroundColor Yellow; + } From 65a32a88c40d1fb259551e187f697a350dfb3dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 19:53:58 +0000 Subject: [PATCH 125/141] ........ --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index a79fc2405..630eb15f8 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -279,7 +279,7 @@ stages: Write-Host "Pass: $SQLPwd"; Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning 'This information is now public! Run the following statement to change the password immediately!' -ForegroundColor Yellow; + Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!' -ForegroundColor Yellow; $Command = '$NewPwd = -join ((33..126) * 3 | Get-Random -Count 12 | % {[char]$_}); Write-Output "New Password: $NewPwd"; Invoke-Sqlcmd -Query "ALTER LOGIN [$($myJsonObject.$SQLUserNameKey)] WITH PASSWORD = ''$NewPwd'' REUSE;" -ServerInstance $myJsonObject.$FQDNAndPortKey -Username $myJsonObject.$SQLUserNameKey -Password $myJsonObject.$SQLPwdKey' $EscapedCommand = $Command -replace '"', '""' From 87488df65410163b953567da71be3a99e36f8f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 19:56:37 +0000 Subject: [PATCH 126/141] took condition out and renamed PrintSQLInfo --- CI/Azure-DevOps/AZ_MainPipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 630eb15f8..004987ad0 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -240,9 +240,8 @@ stages: # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails"; - - job: PrintConnectionInfo + - job: PrintSQLInfo dependsOn: Create - condition: and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create')) strategy: matrix: ${{ each version in parameters.VMMatrix }}: @@ -254,7 +253,7 @@ stages: steps: - checkout: none - task: PowerShell@2 - name: PrintConnectionInfo + name: PrintSQLInfo inputs: targetType: 'inline' script: | @@ -271,6 +270,7 @@ stages: $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$FQDNAndPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" } + if("${{ parameters.CreateEnvOnly }}" -ieq "true"){ Write-Host '==========================================================' -ForegroundColor Yellow; Write-Host "Name: $(SQLVersionName)"; @@ -847,7 +847,7 @@ stages: - Create_Environments - Validate - condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.PrintConnectionInfo.result, 'Succeeded'))) + condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.PrintSQLInfo.result, 'Succeeded'))) pool: vmImage: 'windows-latest' From 618df71a265427fc5bcbb40cb7c3fe4b6252a87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 20:00:08 +0000 Subject: [PATCH 127/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 004987ad0..b5a21ea1c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -279,7 +279,7 @@ stages: Write-Host "Pass: $SQLPwd"; Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!' -ForegroundColor Yellow; + Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!'; $Command = '$NewPwd = -join ((33..126) * 3 | Get-Random -Count 12 | % {[char]$_}); Write-Output "New Password: $NewPwd"; Invoke-Sqlcmd -Query "ALTER LOGIN [$($myJsonObject.$SQLUserNameKey)] WITH PASSWORD = ''$NewPwd'' REUSE;" -ServerInstance $myJsonObject.$FQDNAndPortKey -Username $myJsonObject.$SQLUserNameKey -Password $myJsonObject.$SQLPwdKey' $EscapedCommand = $Command -replace '"', '""' From 5d0f197797e4356cb34420ed511c6a358bd80a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 23:21:55 +0000 Subject: [PATCH 128/141] ...... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index b5a21ea1c..fd87ab6dc 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -281,10 +281,9 @@ stages: Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!'; - $Command = '$NewPwd = -join ((33..126) * 3 | Get-Random -Count 12 | % {[char]$_}); Write-Output "New Password: $NewPwd"; Invoke-Sqlcmd -Query "ALTER LOGIN [$($myJsonObject.$SQLUserNameKey)] WITH PASSWORD = ''$NewPwd'' REUSE;" -ServerInstance $myJsonObject.$FQDNAndPortKey -Username $myJsonObject.$SQLUserNameKey -Password $myJsonObject.$SQLPwdKey' - $EscapedCommand = $Command -replace '"', '""' - Write-Host '==========================================================' -ForegroundColor Yellow; - Write-Host $EscapedCommand + $PwdChngCommand = "`$NewPwd = -join ((33..126) * 3 | Get-Random - Count 12 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [abc] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`";"; + Write-Host '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' -ForegroundColor Yellow; + Write-Host $PwdChngCommand Write-Host '==========================================================' -ForegroundColor Yellow; } @@ -847,7 +846,7 @@ stages: - Create_Environments - Validate - condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), eq(stageDependencies.Create_Environments.PrintSQLInfo.result, 'Succeeded'))) + condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create_Environments.PrintSQLInfo'))) pool: vmImage: 'windows-latest' From 85baf742c44c21d7066ba44f6b0b1fd7a3caa5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Sun, 12 May 2024 23:58:01 +0000 Subject: [PATCH 129/141] fixed password generation --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index fd87ab6dc..d4510c24c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -281,7 +281,7 @@ stages: Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!'; - $PwdChngCommand = "`$NewPwd = -join ((33..126) * 3 | Get-Random - Count 12 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [abc] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`";"; + $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 30 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [abc] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;"; Write-Host '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' -ForegroundColor Yellow; Write-Host $PwdChngCommand Write-Host '==========================================================' -ForegroundColor Yellow; From c571a5b134aebfb04bb94b6719e355b1e988d21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 00:13:09 +0000 Subject: [PATCH 130/141] debugging --- CI/Azure-DevOps/AZ_MainPipeline.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index d4510c24c..01212d2e0 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -852,6 +852,19 @@ stages: vmImage: 'windows-latest' jobs: + - job: DebugInfo + variables: + - name: CreateEnvOnly + value: ${{ parameters.CreateEnvOnly }} + - name: PrintSQLInfoStat + value: "${{ dependencies.Create_Environments.PrintSQLInfo.result }}" + - name: PrintSQLInfoSuc + value: succeeded('Create_Environments.PrintSQLInfo') + steps: + - script: | + echo "CreateEnvOnly: $(CreateEnvOnly)" + echo "PrintSQLInfoSuc: $(PrintSQLInfoSuc)" + echo "PrintSQLInfoStat: $(PrintSQLInfoStat)" - job: Delete_VM From 00fc4e325ac04da17e2e74874f55634a85cecadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 00:16:02 +0000 Subject: [PATCH 131/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 01212d2e0..d1a3ed405 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -853,18 +853,21 @@ stages: jobs: - job: DebugInfo - variables: - - name: CreateEnvOnly - value: ${{ parameters.CreateEnvOnly }} - - name: PrintSQLInfoStat - value: "${{ dependencies.Create_Environments.PrintSQLInfo.result }}" - - name: PrintSQLInfoSuc - value: succeeded('Create_Environments.PrintSQLInfo') + dependsOn: + - Create_Environments steps: - - script: | - echo "CreateEnvOnly: $(CreateEnvOnly)" - echo "PrintSQLInfoSuc: $(PrintSQLInfoSuc)" - echo "PrintSQLInfoStat: $(PrintSQLInfoStat)" + - pwsh: | + # Access the parameter directly + Write-Host "CreateEnvOnly: ${{ parameters.CreateEnvOnly }}" + + # Access the outcome of a job from another stage, assuming `Create_Environments` is a stage and `PrintSQLInfo` is a job within that stage. + $printSQLInfoStatus = '$(stageDependencies.Create_Environments.PrintSQLInfo.result)' + Write-Host "PrintSQLInfo Status: $printSQLInfoStatus" + + # Determine if the specific job succeeded + $printSQLInfoSucceeded = '$[eq(variables[''stageDependencies.Create_Environments.PrintSQLInfo.result''], ''Succeeded'')]' + Write-Host "PrintSQLInfo Succeeded: $printSQLInfoSucceeded" + - job: Delete_VM From 534e0e26253ab8435a46473f7052af43cc1c397a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 00:16:49 +0000 Subject: [PATCH 132/141] ..... --- CI/Azure-DevOps/AZ_MainPipeline.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index d1a3ed405..25bc3e843 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -853,8 +853,6 @@ stages: jobs: - job: DebugInfo - dependsOn: - - Create_Environments steps: - pwsh: | # Access the parameter directly From 7d72f983b407f04cb7d271b0651daea5b1034216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 00:41:34 +0000 Subject: [PATCH 133/141] moved the condition to the delete job --- CI/Azure-DevOps/AZ_MainPipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 25bc3e843..5b29a323c 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -281,7 +281,7 @@ stages: Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!'; - $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 30 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [abc] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;"; + $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 30 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [$SQLUserName] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;"; Write-Host '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' -ForegroundColor Yellow; Write-Host $PwdChngCommand Write-Host '==========================================================' -ForegroundColor Yellow; @@ -846,8 +846,6 @@ stages: - Create_Environments - Validate - condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded('Create_Environments.PrintSQLInfo'))) - pool: vmImage: 'windows-latest' @@ -875,6 +873,8 @@ stages: ${{ format('{0}', version.name) }}: SQLVersionEdition: ${{ version.SQLVersionEdition }} + condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded(format('Create_Environments.PrintSQLInfo_{0}', version.name)))) + variables: databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] From 802203283f5860811e0b2a3ce93e1791ef159dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 00:45:25 +0000 Subject: [PATCH 134/141] simplified condition broken VMs will now not get cleaned up --- CI/Azure-DevOps/AZ_MainPipeline.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 5b29a323c..6d808c264 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -846,25 +846,12 @@ stages: - Create_Environments - Validate + condition: not(eq(${{ parameters.CreateEnvOnly }}, true)) + pool: vmImage: 'windows-latest' jobs: - - job: DebugInfo - steps: - - pwsh: | - # Access the parameter directly - Write-Host "CreateEnvOnly: ${{ parameters.CreateEnvOnly }}" - - # Access the outcome of a job from another stage, assuming `Create_Environments` is a stage and `PrintSQLInfo` is a job within that stage. - $printSQLInfoStatus = '$(stageDependencies.Create_Environments.PrintSQLInfo.result)' - Write-Host "PrintSQLInfo Status: $printSQLInfoStatus" - - # Determine if the specific job succeeded - $printSQLInfoSucceeded = '$[eq(variables[''stageDependencies.Create_Environments.PrintSQLInfo.result''], ''Succeeded'')]' - Write-Host "PrintSQLInfo Succeeded: $printSQLInfoSucceeded" - - - job: Delete_VM strategy: @@ -872,8 +859,6 @@ stages: ${{ each version in parameters.VMMatrix }}: ${{ format('{0}', version.name) }}: SQLVersionEdition: ${{ version.SQLVersionEdition }} - - condition: not(and(eq(${{ parameters.CreateEnvOnly }}, true), succeeded(format('Create_Environments.PrintSQLInfo_{0}', version.name)))) variables: databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] From 7212e8927f418293c40b75580a05f26bb2a890cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Mon, 13 May 2024 01:21:25 +0000 Subject: [PATCH 135/141] increased new password length, removed selection of windows agent from dacpac step --- CI/Azure-DevOps/AZ_MainPipeline.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CI/Azure-DevOps/AZ_MainPipeline.yml b/CI/Azure-DevOps/AZ_MainPipeline.yml index 6d808c264..9863f621b 100644 --- a/CI/Azure-DevOps/AZ_MainPipeline.yml +++ b/CI/Azure-DevOps/AZ_MainPipeline.yml @@ -281,7 +281,7 @@ stages: Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!'; - $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 30 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [$SQLUserName] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;"; + $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 40 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [$SQLUserName] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;"; Write-Host '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' -ForegroundColor Yellow; Write-Host $PwdChngCommand Write-Host '==========================================================' -ForegroundColor Yellow; @@ -435,9 +435,6 @@ stages: ${{ format('{0}', version.name) }}: SQLVersionEdition: ${{ version.SQLVersionEdition }} - pool: - vmImage: 'windows-latest' - variables: databaseAccessDetails: $[convertToJson(stageDependencies.Create_Environments.Create.outputs)] From dc2562be4416c4bf1666190b86f360b750206f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 15 May 2024 01:34:35 +0000 Subject: [PATCH 136/141] fixed 2016 --- Build/SQL/DisableExternalAccess.sql | 1 + Build/SQL/EnableExternalAccess.sql | 2 +- Build/tSQLt_BuildTests.ps1 | 1 + Build/tSQLt_ValidateRuntSQLtTests.ps1 | 36 +++++++++++++++++++++++++++ CI/Azure-DevOps/CreateSQLVM_azcli.ps1 | 3 ++- 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Build/SQL/DisableExternalAccess.sql diff --git a/Build/SQL/DisableExternalAccess.sql b/Build/SQL/DisableExternalAccess.sql new file mode 100644 index 000000000..14d50d76f --- /dev/null +++ b/Build/SQL/DisableExternalAccess.sql @@ -0,0 +1 @@ +EXEC tSQLt.EnableExternalAccess @try = 0, @enable=0; diff --git a/Build/SQL/EnableExternalAccess.sql b/Build/SQL/EnableExternalAccess.sql index e1e8b36e3..556413f0e 100644 --- a/Build/SQL/EnableExternalAccess.sql +++ b/Build/SQL/EnableExternalAccess.sql @@ -1 +1 @@ -EXEC tSQLt.EnableExternalAccess @try = 1; +EXEC tSQLt.EnableExternalAccess @try = 0, @enable=1; diff --git a/Build/tSQLt_BuildTests.ps1 b/Build/tSQLt_BuildTests.ps1 index df7ebd650..d7dbbea51 100644 --- a/Build/tSQLt_BuildTests.ps1 +++ b/Build/tSQLt_BuildTests.ps1 @@ -140,6 +140,7 @@ try{ "Install(tSQLtAssemblyKey).sql", "ChangeDbAndExecuteStatement(tSQLt.Build).sql", "EnableExternalAccess.sql", + "DisableExternalAccess.sql", "Drop(master.tSQLt_testutil).sql", "Install(master.tSQLt_testutil).sql", "GetFailedTestCount.sql", diff --git a/Build/tSQLt_ValidateRuntSQLtTests.ps1 b/Build/tSQLt_ValidateRuntSQLtTests.ps1 index e51922e5e..de54c2288 100644 --- a/Build/tSQLt_ValidateRuntSQLtTests.ps1 +++ b/Build/tSQLt_ValidateRuntSQLtTests.ps1 @@ -38,6 +38,18 @@ if($DeploySource -eq "class"){ # Write-Warning('-->>------------>>--') # Get-FriendlySQLServerVersion -SqlServerConnection $SqlServerConnection # Write-Warning('--<<------------<<--') +Log-Output('Run All Tests... Disabling External Access...') +$parameters = @{ + SqlServerConnection = $SqlServerConnection + HelperSQLPath = $HelperSQLPath + Elevated = $true + Files = @( + (Join-Path $TestsPath "DisableExternalAccess.sql" | Resolve-Path) + ) + DatabaseName = $TestDbName +} +Invoke-SQLFileOrQuery @parameters; + Log-Output('Run All Tests... Run Bootstrap Tests...') $parameters = @{ SqlServerConnection = $SqlServerConnection @@ -112,6 +124,18 @@ $parameters = @{ } Invoke-TestsFromFile @parameters; +Log-Output('Run All Tests... Installing Assembly Key (needed for 2016 only)...') +$parameters = @{ + SqlServerConnection = $SqlServerConnection + HelperSQLPath = $HelperSQLPath + Elevated = $true + Files = @( + (Join-Path $TestsPath "Install(tSQLtAssemblyKey).sql" | Resolve-Path) + ) + DatabaseName = $TestDbName +} +Invoke-SQLFileOrQuery @parameters; + Log-Output('Run All Tests... tSQLt EXTERNAL_ACCESS_KEY_EXISTS Tests...') $parameters = @{ SqlServerConnection = $SqlServerConnection @@ -123,6 +147,18 @@ $parameters = @{ } Invoke-TestsFromFile @parameters; +Log-Output('Run All Tests... Enabling External Access...') +$parameters = @{ + SqlServerConnection = $SqlServerConnection + HelperSQLPath = $HelperSQLPath + Elevated = $true + Files = @( + (Join-Path $TestsPath "EnableExternalAccess.sql" | Resolve-Path) + ) + DatabaseName = $TestDbName +} +Invoke-SQLFileOrQuery @parameters; + Log-Output('Run All Tests... tSQLt EXTERNAL_ACCESS Tests...') $parameters = @{ SqlServerConnection = $SqlServerConnection diff --git a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 index c108e42f9..4376c65ff 100644 --- a/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 +++ b/CI/Azure-DevOps/CreateSQLVM_azcli.ps1 @@ -81,7 +81,8 @@ Log-Output "SQLVersionEditionInfo: ", $SQLVersionEditionInfo; Log-Output "TemplateFile: ", $TemplateFile; Log-Output "START: Creating Resource Group $ResourceGroupName"; -$output = az group create --location "$Location" --name "$ResourceGroupName" | ConvertFrom-Json; + +$output = az group create --location "$Location" --name "$ResourceGroupName" --tags Department="tSQLtCI" Ephemeral="True" | ConvertFrom-Json; if (!$output) { Write-Error "Error creating Resource Group"; return From 79ac4120dfe421eac2993bdee8219699dd6efc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 15 May 2024 10:48:31 +0000 Subject: [PATCH 137/141] Disabled setting external access on Linux --- Build/SQL/DisableExternalAccess.sql | 5 ++++- Build/SQL/EnableExternalAccess.sql | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Build/SQL/DisableExternalAccess.sql b/Build/SQL/DisableExternalAccess.sql index 14d50d76f..4f05b11b2 100644 --- a/Build/SQL/DisableExternalAccess.sql +++ b/Build/SQL/DisableExternalAccess.sql @@ -1 +1,4 @@ -EXEC tSQLt.EnableExternalAccess @try = 0, @enable=0; +IF(EXISTS(SELECT 1 FROM tSQLt.Info() WHERE HostPlatform NOT IN ('Linux'))) +BEGIN + EXEC tSQLt.EnableExternalAccess @try = 0, @enable=0; +END; diff --git a/Build/SQL/EnableExternalAccess.sql b/Build/SQL/EnableExternalAccess.sql index 556413f0e..2b1223f7f 100644 --- a/Build/SQL/EnableExternalAccess.sql +++ b/Build/SQL/EnableExternalAccess.sql @@ -1 +1,4 @@ -EXEC tSQLt.EnableExternalAccess @try = 0, @enable=1; +IF(EXISTS(SELECT 1 FROM tSQLt.Info() WHERE HostPlatform NOT IN ('Linux'))) +BEGIN + EXEC tSQLt.EnableExternalAccess @try = 0, @enable=1; +END; From 21fa0bad0e6adfff3ae563da3aa4955904c2ed7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Wed, 15 May 2024 22:08:18 +0000 Subject: [PATCH 138/141] Cleand Up Build Output --- Build/CommonFunctionsAndMethods.psm1 | 36 +++++++++++++------------- Build/LocalBuild.ps1 | 21 ++++++++------- Build/tSQLt_Build/ConcatenateFiles.ps1 | 24 ++++++++--------- Build/tSQLt_BuildCLR.ps1 | 2 +- Build/tSQLt_BuildDacpac.ps1 | 4 +-- 5 files changed, 44 insertions(+), 43 deletions(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index 92b1eb98e..c389f6403 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -1,6 +1,6 @@ $__=$__ #quiesce warnings $CommonFunctionsAndMethodsDir = $PSScriptRoot -Write-Host "Loading CommonFunctionsAndMethods.psm1 from: $PSCommandPath" +Write-Verbose "Loading CommonFunctionsAndMethods.psm1 from: $PSCommandPath" . (Join-Path $CommonFunctionsAndMethodsDir 'SQLServerConnection.ps1'); $MergeHashTables = {param([HashTable]$base,[HashTable]$new);$new.GetEnumerator()|%{$base.remove($_.Key);$base += @{$_.Key=$_.Value}};$base;}; @@ -40,10 +40,10 @@ Function Invoke-SqlFile $parameters['Verbose'] = $true } - $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $results = (Invoke-SqlCmd @parameters) - $dddafter = Get-Date;Write-Warning("------->>After<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") - Write-Warning("Runtime in Milliseconds: $(($dddafter-$dddbefore).TotalMilliseconds)") + $dddafter = Get-Date;Write-Verbose("------->>After<<-------(CommonFunctionsAndMethods.p1:Invoke-SqlFile:Invoke-SqlCommand[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + Write-Verbose("Runtime in Milliseconds: $(($dddafter-$dddbefore).TotalMilliseconds)") return $results } @@ -100,9 +100,9 @@ Function Invoke-SQLFileOrQuery AdditionalParameters = $AdditionalParameters PrintSqlOutput = $PrintSqlOutput } -$dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") +$dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $QueryOutput = Invoke-SqlFile @parameters -$dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") +$dddafter = Get-Date;Write-Verbose("------->>After<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $dddafter-$dddbefore return $QueryOutput } @@ -186,8 +186,8 @@ Function Remove-ResourceGroup{ [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $ResourceGroupName, [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $BuildId); - Write-Output "▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-"; - Write-Output ("[{0}]Start processing delete for {1}" -f ((get-date).toString("O")), ($ResourceGroupName)); + Write-Verbose "▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-"; + Write-Verbose ("[{0}]Start processing delete for {1}" -f ((get-date).toString("O")), ($ResourceGroupName)); $MyAzResourceGroup = (Get-AzResourceGroup -name "$ResourceGroupName"); if(("RemovalBy" -in $MyAzResourceGroup.tags.keys) -and (![string]::isnullorempty($MyAzResourceGroup.tags.RemovalBy))) { @@ -195,37 +195,37 @@ Function Remove-ResourceGroup{ } if($null -ne $MyAzResourceGroup) { $Tags = @{}; - Write-Output ("Add Tag to {0}" -f $ResourceGroupName); + Write-Verbose ("Add Tag to {0}" -f $ResourceGroupName); $Tags = $MyAzResourceGroup.Tags; $Tags.remove("RemovalBy"); $Tags += @{"RemovalBy"="$BuildId"}; $MyAzResourceGroup | Set-AzResourceGroup -Tags $Tags; Start-Sleep 10; - Write-Output ("Confirming Tags are still in place for {0}" -f $ResourceGroupName); + Write-Verbose ("Confirming Tags are still in place for {0}" -f $ResourceGroupName); $MyAzResourceGroup = $MyAzResourceGroup | Get-AZResourceGroup | Where-Object {$_.Tags.RemovalBy -eq "$BuildId"}; $MyAzResourceGroup.Tags | Format-Table; if($null -ne $MyAzResourceGroup) { - Write-Output "Removing Locks" + Write-Verbose "Removing Locks" $retrievedResourceGroupName = $MyAzResourceGroup.ResourceGroupName; Get-AzResource -ResourceGroupName $retrievedResourceGroupName | ForEach-Object { Get-AzResourceLock -ResourceType $_.ResourceType -ResourceName $_.Name -ResourceGroupName $_.ResourceGroupName | ForEach-Object{ - Write-Output ("{0} -> {1}" -f $_.ResourceType, $_.ResourceName); + Write-Verbose ("{0} -> {1}" -f $_.ResourceType, $_.ResourceName); $_ | Remove-AzResourceLock -Force } } - Write-Output ("Removing RG {0}" -f $retrievedResourceGroupName); + Write-Verbose ("Removing RG {0}" -f $retrievedResourceGroupName); $MyAzResourceGroup | Remove-AzResourceGroup -Force; } else { - Write-Output ("Tags changed by another process. Resource Group {0} is no longer eligible to be deleted." -f $ResourceGroupName); + Write-Verbose ("Tags changed by another process. Resource Group {0} is no longer eligible to be deleted." -f $ResourceGroupName); } } else { - Write-Output ("Processing skipped for Resource Group: {0} Build Id: {1}" -f $ResourceGroupName, $BuildId); + Write-Verbose ("Processing skipped for Resource Group: {0} Build Id: {1}" -f $ResourceGroupName, $BuildId); } - Write-Output ("[{0}]Done processing delete for {1}" -f ((get-date).toString("O")), ($ResourceGroupName)) - Write-Output "▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-"; + Write-Verbose ("[{0}]Done processing delete for {1}" -f ((get-date).toString("O")), ($ResourceGroupName)) + Write-Verbose "▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-▀-▄-_-▄-"; } Function Get-SnipContent { @@ -267,7 +267,7 @@ Function Replace-InFile { $isRegex = $true $rv = $rv[0] } - Write-Host("Replacing >$_< with >$rv<..."); + Write-Verbose("Replacing >$_< with >$rv<..."); if($isRegex){ $fileContent = $fileContent -replace $_, $rv }else{ diff --git a/Build/LocalBuild.ps1 b/Build/LocalBuild.ps1 index 1075f0aad..e8bd67647 100644 --- a/Build/LocalBuild.ps1 +++ b/Build/LocalBuild.ps1 @@ -1,3 +1,4 @@ +[CmdletBinding()] param( [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $ServerName = 'localhost,1433', [Parameter(Mandatory=$true, ParameterSetName = 'UserPass')][ValidateNotNullOrEmpty()][string] $UserName = "sa" , @@ -12,12 +13,12 @@ param( $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} -Write-Host "Starting execution of LocalBuild.ps1" +Write-Verbose "Starting execution of LocalBuild.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir $cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) -Write-Host "Attempting to load module from: $cfam" +Write-Verbose "Attempting to load module from: $cfam" Import-Module "$cfam" -Force -Verbose . (Join-Path $invocationDir 'SQLServerConnection.ps1'); @@ -36,20 +37,20 @@ $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir try{ - if($TrustedConnection){ - Write-Warning('GH:TC') - $SqlServerConnection = [SqlServerConnection]::new($ServerName,"LocalBuild"); - }else{ - Write-Warning('GH:UP') - $SqlServerConnection = [SqlServerConnection]::new($ServerName,$UserName,$Password,"LocalBuild"); - } - Log-Output(''); Log-Output("+--------------------------------------------------------------------+"); Log-Output("| ***** Executing Local tSQLt Build ***** |"); Log-Output("+--------------------------------------------------------------------+"); Log-Output(''); + if($TrustedConnection){ + Log-Output('Selecting Trusted Connection') + $SqlServerConnection = [SqlServerConnection]::new($ServerName,"LocalBuild"); + }else{ + Log-Output('Selecting UserName/Password Connection') + $SqlServerConnection = [SqlServerConnection]::new($ServerName,$UserName,$Password,"LocalBuild"); + } + Log-Output('+ - - - - - - - - - - - - - - - - - +') Log-Output(': Cleaning Environment :') diff --git a/Build/tSQLt_Build/ConcatenateFiles.ps1 b/Build/tSQLt_Build/ConcatenateFiles.ps1 index ac7fdf527..1375262b6 100644 --- a/Build/tSQLt_Build/ConcatenateFiles.ps1 +++ b/Build/tSQLt_Build/ConcatenateFiles.ps1 @@ -58,7 +58,7 @@ function Concatenate-Files { $output = @() foreach ($file in $fileIterator) { - Write-Host("-->$file") + Write-Verbose("-->$file") $fileContent = Get-FileContent -filePath $file -bracket $bracket -includeFromStart $includeFromStart -separator $separator $output += $fileContent } @@ -66,9 +66,9 @@ function Concatenate-Files { return $output } -Write-Host("OutputFile: $OutputFile") -Write-Host("SeparatorTemplate: >$SeparatorTemplate<") -Write-Host("Input: $InputPath") +Write-Verbose("OutputFile: $OutputFile") +Write-Verbose("SeparatorTemplate: >$SeparatorTemplate<") +Write-Verbose("Input: $InputPath") if([string]::IsNullOrWhiteSpace($SeparatorTemplate)){ if($null -eq $SeparatorContent){ @@ -78,9 +78,9 @@ if([string]::IsNullOrWhiteSpace($SeparatorTemplate)){ else{ $SeparatorContent = Get-Content $SeparatorTemplate -ErrorAction Stop } -Write-Host(">--Separator Template-->") -$SeparatorContent|%{Write-Host(">:$_")} -Write-Host("<--Separator Template--<") +Write-Verbose(">--Separator Template-->") +$SeparatorContent|%{Write-Verbose(">:$_")} +Write-Verbose("<--Separator Template--<") if($Bracket -eq ''){ $IncludeFromStart = $true; } @@ -88,20 +88,20 @@ if($Bracket -eq ''){ try{ if($null -eq $InputPath){ - Write-Host("scriptPath: ") + Write-Verbose("scriptPath: ") $fileIterator = @() } elseif($InputPath -is [System.Collections.IEnumerable]){ - Write-Host("scriptPath: /") + Write-Verbose("scriptPath: /") $fileIterator = $InputPath } elseif (Test-Path $InputPath -PathType Container) { - Write-Host("scriptPath: $InputPath") + Write-Verbose("scriptPath: $InputPath") $fileIterator = Get-ChildItem $InputPath -Filter $IncludePattern } else { $scriptPath = (Split-Path $InputPath) - Write-Host("scriptPath: $scriptPath") + Write-Verbose("scriptPath: $scriptPath") $fileList = Get-Content $InputPath -ErrorAction Stop $fileIterator = $fileList | ForEach-Object { Join-Path $scriptPath $_ | Resolve-Path} } @@ -111,7 +111,7 @@ try{ $sv = $_["s"] $rv=$_["r"]; $isRegex = $_.ContainsKey("isRegex") -and $_["isRegex"]; - Write-Host("Replacing >$sv< with >$rv< [regex:$isRegex]..."); + Write-Verbose("Replacing >$sv< with >$rv< [regex:$isRegex]..."); if($isRegex){ $concatenatedContent = $concatenatedContent -replace $sv, $rv }else{ diff --git a/Build/tSQLt_BuildCLR.ps1 b/Build/tSQLt_BuildCLR.ps1 index c7afc2333..7acc1733a 100644 --- a/Build/tSQLt_BuildCLR.ps1 +++ b/Build/tSQLt_BuildCLR.ps1 @@ -4,7 +4,7 @@ param( [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][securestring] $pfxPassword ) Push-Location -Path $PSScriptRoot -Write-Warning((Get-Location).Path) +Write-Verbose((Get-Location).Path) try{ $OutputPath = "./output/tSQLtCLR/"; $TempPath = "./temp/tSQLtCLR/"; diff --git a/Build/tSQLt_BuildDacpac.ps1 b/Build/tSQLt_BuildDacpac.ps1 index 823138ec3..b23e6daa1 100644 --- a/Build/tSQLt_BuildDacpac.ps1 +++ b/Build/tSQLt_BuildDacpac.ps1 @@ -12,7 +12,7 @@ $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir $cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) -Write-Host "Attempting to load module from: $cfam" +Write-Verbose "Attempting to load module from: $cfam" Import-Module "$cfam" -Force Get-Module -Name CommonFunctionsAndMethods # Verify if module is loaded @@ -41,7 +41,7 @@ try{ Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "CreateBuildDb.sql" -Database "tempdb" -AdditionalParameters @{NewDbName=$DacPacDatabaseName} -PrintSqlOutput $true; Log-Output('-- Executing tSQLt.class.sql') Invoke-SqlFile -SqlServerConnection $SqlServerConnection -FileNames "tSQLt.class.sql" -Database "$DacPacDatabaseName"; - Write-Host('Building DACPAC') + Log-Output('Building DACPAC') $FriendlySQLServerVersion = Get-FriendlySQLServerVersion -SqlServerConnection $SqlServerConnection; $tSQLtDacpacFileName = "tSQLt."+$FriendlySQLServerVersion+".dacpac"; $tSQLtApplicationName = "tSQLt."+$FriendlySQLServerVersion; From 2c6018827019bf7deb9606c9d71c417072313366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 16 May 2024 00:07:34 +0000 Subject: [PATCH 139/141] Cleaned up Validate --- Build/CommonFunctionsAndMethods.psm1 | 4 ++-- Build/LocalValidate.ps1 | 9 +++++---- Build/tSQLt_Validate.ps1 | 18 +++++++++++++----- Build/tSQLt_ValidateRunAll.ps1 | 18 +++++++++--------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Build/CommonFunctionsAndMethods.psm1 b/Build/CommonFunctionsAndMethods.psm1 index c389f6403..63f51d5ee 100644 --- a/Build/CommonFunctionsAndMethods.psm1 +++ b/Build/CommonFunctionsAndMethods.psm1 @@ -103,8 +103,8 @@ Function Invoke-SQLFileOrQuery $dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $QueryOutput = Invoke-SqlFile @parameters $dddafter = Get-Date;Write-Verbose("------->>After<<-------(tSQLt_Validate.ps1:Invoke-SQLFileOrQuery:Invoke-SqlFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") -$dddafter-$dddbefore - return $QueryOutput +Write-Verbose("Runtime in Milliseconds: $(($dddafter-$dddbefore).TotalMilliseconds)") + return $QueryOutput } catch{ throw diff --git a/Build/LocalValidate.ps1 b/Build/LocalValidate.ps1 index b317aea39..dd14882a0 100644 --- a/Build/LocalValidate.ps1 +++ b/Build/LocalValidate.ps1 @@ -1,3 +1,4 @@ +[CmdletBinding()] param( [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][string] $ServerName = 'localhost,1433', [Parameter(Mandatory=$true, ParameterSetName = 'UserPass')][ValidateNotNullOrEmpty()][string] $UserName = "sa" , @@ -9,12 +10,12 @@ param( $PSDefaultParameterValues = $PSDefaultParameterValues.clone() $PSDefaultParameterValues += @{'*:ErrorAction' = 'Stop'} -Write-Host "Starting execution of LocalBuild.ps1" +Write-Verbose "Starting execution of LocalBuild.ps1" $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot Push-Location -Path $invocationDir $cfam = (Join-Path $invocationDir "CommonFunctionsAndMethods.psm1" | Resolve-Path) -Write-Host "Attempting to load module from: $cfam" +Write-Verbose "Attempting to load module from: $cfam" Import-Module "$cfam" -Force -Verbose . (Join-Path $invocationDir 'SQLServerConnection.ps1'); @@ -22,10 +23,10 @@ Import-Module "$cfam" -Force -Verbose try{ if($TrustedConnection){ - Write-Warning('GH:TC') + Log-Output('Selecting Trusted Connection') $SqlServerConnection = [SqlServerConnection]::new($ServerName,"LocalBuild"); }else{ - Write-Warning('GH:UP') + Log-Output('Selecting UserName/Password Connection') $SqlServerConnection = [SqlServerConnection]::new($ServerName,$UserName,$Password,"LocalBuild"); } diff --git a/Build/tSQLt_Validate.ps1 b/Build/tSQLt_Validate.ps1 index 28203f6d0..9e2bedd28 100644 --- a/Build/tSQLt_Validate.ps1 +++ b/Build/tSQLt_Validate.ps1 @@ -9,7 +9,7 @@ Param( ); - +$validateStartTime = Get-Date; $__=$__ #quiesce warnings $invocationDir = $PSScriptRoot @@ -206,15 +206,23 @@ try{ $matchingFiles = ($ActualTestResultFiles|Where-Object{$ExpectedTestResultFiles -Contains $_}) Write-Warning("Matching Files:") $matchingFiles - Write-Warning("Missing Files:") - $missingFiles - Write-Warning("Unexpected Files:") - $superfluousFiles + if($missingFiles.length -gt 0){ + Write-Warning("There are files missing:"); + $missingFiles + } + if($superfluousFiles.length -gt 0){ + Write-Warning("There are unexpected files:") + $superfluousFiles + } if($missingFiles.Length + $superfluousFiles.Length -gt 0){ Write-Error("Missing or Unexpected Test Result Files!") } } finally{ Pop-Location + $validateEndTime = Get-Date; + Log-Output("------------------------------------") + Log-Output("Total Duration: $($validateEndTime-$validateStartTime)") + Log-Output("------------------------------------") } diff --git a/Build/tSQLt_ValidateRunAll.ps1 b/Build/tSQLt_ValidateRunAll.ps1 index 10e54f9a2..963cc6553 100644 --- a/Build/tSQLt_ValidateRunAll.ps1 +++ b/Build/tSQLt_ValidateRunAll.ps1 @@ -67,16 +67,16 @@ Function Invoke-Tests DatabaseName = $DatabaseName PrintSqlOutput = $true } - $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") $parameters; Invoke-SQLFileOrQuery @parameters; - $dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") - $dddafter-$dddbefore + $dddafter = Get-Date;Write-Verbose("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + Write-Verbose("Duration: $($dddafter-$dddbefore)") - $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Copy-SQLXmlToFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Copy-SQLXmlToFile[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") Copy-SQLXmlToFile $SqlServerConnection $DatabaseName "EXEC [tSQLt].[XmlResultFormatter]" $OutputFile - $dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Copy-SQLXmlToFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") - $dddafter-$dddbefore + $dddafter = Get-Date;Write-Verbose("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Copy-SQLXmlToFile[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + Write-Verbose("Duration: $($dddafter-$dddbefore)") $parameters = @{ SqlServerConnection = $SqlServerConnection @@ -84,11 +84,11 @@ Function Invoke-Tests DatabaseName = $DatabaseName Query = "EXEC tSQLt_testutil.LogMultiRunResult '$TestSetName';" } - $dddbefore = Get-Date;Write-Warning("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + $dddbefore = Get-Date;Write-Verbose("------->>BEFORE<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddbefore|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") # $parameters; Invoke-SQLFileOrQuery @parameters; - $dddafter = Get-Date;Write-Warning("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") - $dddafter-$dddbefore + $dddafter = Get-Date;Write-Verbose("------->>After<<-------(tSQLt_Validate.ps1:Invoke-Tests:Invoke-SQLFileOrQuery[$($dddafter|Get-Date -Format "yyyy:MM:dd;HH:mm:ss.fff")])") + Write-Verbose("Duration: $($dddafter-$dddbefore)") } Function Invoke-TestsFromFile From a256930f975f6ee73a52418a303acc59840cb906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmbt1=E2=80=9D?= Date: Thu, 16 May 2024 01:06:00 +0000 Subject: [PATCH 140/141] cleaned up final output --- Build/tSQLt_Validate.ps1 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Build/tSQLt_Validate.ps1 b/Build/tSQLt_Validate.ps1 index 9e2bedd28..22ff1d02b 100644 --- a/Build/tSQLt_Validate.ps1 +++ b/Build/tSQLt_Validate.ps1 @@ -204,16 +204,24 @@ try{ $missingFiles = ($ExpectedTestResultFiles|Where-Object{$ActualTestResultFiles -NotContains $_}) $superfluousFiles = ($ActualTestResultFiles|Where-Object{$ExpectedTestResultFiles -NotContains $_}) $matchingFiles = ($ActualTestResultFiles|Where-Object{$ExpectedTestResultFiles -Contains $_}) - Write-Warning("Matching Files:") - $matchingFiles + Log-Output("+------------------------------------------------"); + Log-Output("| Expected Test Result Files:"); + $matchingFiles|%{Log-Output("| - $_");} + Log-Output("+------------------------------------------------"); if($missingFiles.length -gt 0){ - Write-Warning("There are files missing:"); - $missingFiles + Log-Output("| Missing Test Result Files:"); + $missingFiles|%{Log-Output("| - $_");} + }else{ + Log-Output("| No Missing Test Result Files"); } + Log-Output("+------------------------------------------------"); if($superfluousFiles.length -gt 0){ - Write-Warning("There are unexpected files:") - $superfluousFiles + Log-Output("| Unexpected Test Result Files:") + $superfluousFiles|%{Log-Output("| - $_");} + }else{ + Log-Output("| No Unexpected Test Result Files"); } + Log-Output("+------------------------------------------------"); if($missingFiles.Length + $superfluousFiles.Length -gt 0){ Write-Error("Missing or Unexpected Test Result Files!") } From 47741ea96cf977e60c872d3c2e5fdd487ce84228 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:03:42 +0000 Subject: [PATCH 141/141] Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/aks_build_and_test.yml | 2 +- .github/workflows/build_and_test_on_spawn.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/aks_build_and_test.yml b/.github/workflows/aks_build_and_test.yml index a52e93491..99be52e65 100644 --- a/.github/workflows/aks_build_and_test.yml +++ b/.github/workflows/aks_build_and_test.yml @@ -243,7 +243,7 @@ jobs: Write-Host ('::set-output name=osType::'+$osType); - name: download tSQLtAndTests artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: tSQLtAndTests path: "${{ github.workspace }}\\tSQLt\\Build_Artifact" diff --git a/.github/workflows/build_and_test_on_spawn.yml b/.github/workflows/build_and_test_on_spawn.yml index 406af07b5..c87d6fa45 100644 --- a/.github/workflows/build_and_test_on_spawn.yml +++ b/.github/workflows/build_and_test_on_spawn.yml @@ -184,7 +184,7 @@ jobs: Write-Host "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "; - name: download tSQLtBuildArtifact artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: tSQLtBuildArtifact path: "${{ github.workspace }}\\tSQLt\\Build\\output\\tSQLtBuild" @@ -226,13 +226,13 @@ jobs: path: tSQLt - name: download tSQLtBuildArtifact artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: tSQLtBuildArtifact path: "${{ github.workspace }}\\tSQLt\\Build\\output\\tSQLtBuild" - name: download tSQLt dacpac artifact(s) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: dacpacs path: "${{ github.workspace }}\\tSQLt\\Build\\output\\DacpacBuild" @@ -290,13 +290,13 @@ jobs: path: tSQLt - name: download public tSQLt artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: tSQLtPublic path: "${{ github.workspace }}\\tSQLt\\Build\\output\\tSQLt\\public" - name: download validation tSQLt artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: tSQLtValidation path: "${{ github.workspace }}\\tSQLt\\Build\\output\\tSQLt\\validation"