From 0eb6892ca69798e86fa97a6866a2680ef0aefd90 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Thu, 7 Jan 2021 21:36:38 -0500 Subject: [PATCH 01/18] can I check this in? --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 448fb7e6a..276c7c6dc 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -17,7 +17,7 @@ resources: type: github name: tSQLt/tmp6 endpoint: GitHub-tSQLt-Robot - ref: (https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops) -- {{ $ArtifactBranchName }} + ref: ${{ variables.ArtifactBranchName }} stages: From cec3e64fb529d378dd26114b07ae36b02170b526 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:35:26 -0500 Subject: [PATCH 02/18] but does this fix it? --- CI/AZ_MainPipeline.yml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 276c7c6dc..4445e7522 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -17,7 +17,6 @@ resources: type: github name: tSQLt/tmp6 endpoint: GitHub-tSQLt-Robot - ref: ${{ variables.ArtifactBranchName }} stages: @@ -33,9 +32,41 @@ stages: persistCredentials: true path: tSQLtArtifacts + - task: PowerShell@2 + name: list_remote_branch + env: + GITHUB_USERNAME: $(GitHubUserName) + GITHUB_EMAIL: $(GitHubEmail) + inputs: + targetType: 'inline' + failOnStderr: false + script: | + Write-Host ("Build.Repository.Uri: {0}" -f "$(Build.Repository.Uri)"); + Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); + try{ + git config --global user.email "$env:GITHUB_EMAIL" + git config --global user.name "$env:GITHUB_USERNAME" + + $B = (git ls-remote --heads $(Build.Repository.Uri) $(ArtifactBranchName)) + + if( -not [string]::IsNullOrEmpty($B) ) + { + Write-Host "##vso[task.setvariable variable=BuiltAlready;isOutput=true]true"; + Write-Host "Build Branch Found"; + } + else + { + Write-Host "##vso[task.setvariable variable=BuiltAlready;isOutput=true]false"; + Write-Host "Build Branch NOT Found"; + }; + }catch{ + throw "Git Failed. See prior errors."; + } + git status + - job: CompileCLR dependsOn: Check_If_Built_Already - condition: failed() + condition: and(succeeded(),eq(dependencies.Check_If_Built_Already.outputs['the_test.BuiltAlready'], 'false')) timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 From e600c621763a692c31e2ab2a024239754aec49ef Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:38:26 -0500 Subject: [PATCH 03/18] using the right job name is important when trying to use output variables --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 4445e7522..484940da1 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -66,7 +66,7 @@ stages: - job: CompileCLR dependsOn: Check_If_Built_Already - condition: and(succeeded(),eq(dependencies.Check_If_Built_Already.outputs['the_test.BuiltAlready'], 'false')) + condition: and(succeeded(),eq(dependencies.Check_If_Built_Already.outputs['list_remote_branch.BuiltAlready'], 'false')) timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 From 1a1062549e1b8eaca0011a22f961ccf6648aaddf Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:53:25 -0500 Subject: [PATCH 04/18] are resources.repositories.tSQLtArtifacts variables available? --- CI/AZ_MainPipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 484940da1..b6af00d2b 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -42,6 +42,7 @@ stages: failOnStderr: false script: | Write-Host ("Build.Repository.Uri: {0}" -f "$(Build.Repository.Uri)"); + Write-Host ("resources.repositories.tSQLtArtifacts: {0}" -f "$(resources.repositories.tSQLtArtifacts)"); Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ git config --global user.email "$env:GITHUB_EMAIL" From 0cb47161f3c816c2f2917f58aaa25a4226944bdd Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:55:23 -0500 Subject: [PATCH 05/18] what env vars do I have again? --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index b6af00d2b..728186772 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -42,8 +42,8 @@ stages: failOnStderr: false script: | Write-Host ("Build.Repository.Uri: {0}" -f "$(Build.Repository.Uri)"); - Write-Host ("resources.repositories.tSQLtArtifacts: {0}" -f "$(resources.repositories.tSQLtArtifacts)"); Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); + Get-Item -Path Env: try{ git config --global user.email "$env:GITHUB_EMAIL" git config --global user.name "$env:GITHUB_USERNAME" From c2b3fa8948b53bd3946abb59fe7802c2461b1411 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Fri, 8 Jan 2021 22:05:15 -0500 Subject: [PATCH 06/18] github uri is not available in the env --- CI/AZ_MainPipeline.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 728186772..2494d8938 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -41,16 +41,24 @@ stages: targetType: 'inline' failOnStderr: false script: | - Write-Host ("Build.Repository.Uri: {0}" -f "$(Build.Repository.Uri)"); + $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "git failed!"}}; + + Get-Location; + Set-Location "$(Pipeline.Workspace)\tSQLtArtifacts\"; + Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); Get-Item -Path Env: try{ - git config --global user.email "$env:GITHUB_EMAIL" - git config --global user.name "$env:GITHUB_USERNAME" + # git config --global user.email "$env:GITHUB_EMAIL" + # git config --global user.name "$env:GITHUB_USERNAME" - $B = (git ls-remote --heads $(Build.Repository.Uri) $(ArtifactBranchName)) + $remoteURL = git config remote.origin.url + $CheckIfGitOk.invoke($?); + + $branch = (git ls-remote --heads $remoteURL $(ArtifactBranchName)) + $CheckIfGitOk.invoke($?); - if( -not [string]::IsNullOrEmpty($B) ) + if( -not [string]::IsNullOrEmpty($branch) ) { Write-Host "##vso[task.setvariable variable=BuiltAlready;isOutput=true]true"; Write-Host "Build Branch Found"; @@ -61,7 +69,7 @@ stages: Write-Host "Build Branch NOT Found"; }; }catch{ - throw "Git Failed. See prior errors."; + throw "git failed. See prior errors."; } git status From 5fe713c6a3cb91e6a1c7d3f480b3a75bd4150b50 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 07:05:41 -0500 Subject: [PATCH 07/18] git magic --- CI/AZ_MainPipeline.yml | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 2494d8938..f80405aac 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -34,23 +34,17 @@ stages: - task: PowerShell@2 name: list_remote_branch - env: - GITHUB_USERNAME: $(GitHubUserName) - GITHUB_EMAIL: $(GitHubEmail) inputs: targetType: 'inline' failOnStderr: false script: | $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "git failed!"}}; - Get-Location; Set-Location "$(Pipeline.Workspace)\tSQLtArtifacts\"; Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); Get-Item -Path Env: try{ - # git config --global user.email "$env:GITHUB_EMAIL" - # git config --global user.name "$env:GITHUB_USERNAME" $remoteURL = git config remote.origin.url $CheckIfGitOk.invoke($?); @@ -188,6 +182,7 @@ stages: - checkout: tSQLtArtifacts clean: true lfs: false + fetchDepth: 1 persistCredentials: true path: tSQLtArtifacts @@ -198,6 +193,11 @@ stages: artifactName: 'tSQLtAndTests' targetPath: '$(Pipeline.Workspace)\tmp' + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'tSQLt CI Subscription(58c04a99-5b92-410c-9e41-10262f68ca80)' + KeyVaultName: 'tSQLtSigningKey' + - task: PowerShell@2 name: StoreInArtifactRepo env: @@ -210,7 +210,6 @@ stages: script: | $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "GIT Failed!"}}; - Get-Location; Set-Location "$(Pipeline.Workspace)\tSQLtArtifacts\"; Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ @@ -282,8 +281,9 @@ stages: - checkout: tSQLtArtifacts clean: true lfs: false + fetchDepth: 1 persistCredentials: true - path: tSQLtArtifacts + path: dontUse - task: PowerShell@2 name: GetArtifact @@ -293,21 +293,19 @@ stages: $ArtifactTargetPath= '$(Pipeline.Workspace)/tSQLt/Build_Artifact' $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "GIT Failed!"}}; - Set-Location "$(Pipeline.Workspace)\tSQLtArtifacts\"; - - # Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); - # try{ - # git status - # git remote show origin + Set-Location "$(Pipeline.Workspace)"; - # git fetch - # git checkout "$(ArtifactBranchName)" - # $CheckIfGitOk.invoke($?); + Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); + try{ + + $remoteURL = git config -f .\dontUse\.git\config remote.origin.url + $CheckIfGitOk.invoke($?); - # git status - # }catch{ - # throw "Git Failed. See prior errors."; - # } + git clone --depth=1 $remoteURL -b $(ArtifactBranchName) tSQLtArtifacts + $CheckIfGitOk.invoke($?); + }catch{ + throw "Git Failed. See prior errors."; + } New-Item -Path $ArtifactTargetPath -ItemType directory -Force From 3a0cf5f98f64454cf1a2846ea12f103a008429f6 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 07:08:53 -0500 Subject: [PATCH 08/18] do not need to list env vars --- CI/AZ_MainPipeline.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index f80405aac..236c74d13 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -43,7 +43,6 @@ stages: Set-Location "$(Pipeline.Workspace)\tSQLtArtifacts\"; Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); - Get-Item -Path Env: try{ $remoteURL = git config remote.origin.url @@ -297,7 +296,7 @@ stages: Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ - + $remoteURL = git config -f .\dontUse\.git\config remote.origin.url $CheckIfGitOk.invoke($?); From 9da57f5961c5dbf7c070b5a267693233aaa98e5a Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 07:18:09 -0500 Subject: [PATCH 09/18] why do we appear to have more branches than expected for depth=1 --- CI/AZ_MainPipeline.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 236c74d13..adc1392e8 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -217,6 +217,12 @@ stages: git status git remote show origin + Write-Host "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "; + Write-Host ""; + git branch --remotes + Write-Host ""; + Write-Host "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "; + git switch -c "$(ArtifactBranchName)" $CheckIfGitOk.invoke($?); From 470a265d2e88c15729843d32d530c917961d27d0 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 10:35:31 -0500 Subject: [PATCH 10/18] Update AZ_MainPipeline.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specify full path of validate build 🐜 file --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index adc1392e8..55d793d3c 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -406,7 +406,7 @@ stages: - task: Ant@1 name: Run_tSQLt_validatebuild_xml inputs: - buildFile: '../tSQLt/Build/tSQLt.validatebuild.xml' + buildFile: '$(Pipeline.Workspace)/tSQLt/tSQLt/Build/tSQLt.validatebuild.xml' options: '-Ddb.version="$(SQLVersion)" -Ddb.server="$(FQDNAndPort)" -Ddb.name=tSQLt_dev -Ddb.login="-U $(tSQLt-UserForCIEnvironment-UserName) -P $(tSQLt-UserForCIEnvironment-Password)" -Dsqlcmd.path="$(SQLCMDPath)"' targets: 'all' publishJUnitResults: true From f6a96e0137552a5cf6855a944e86dcb1e097dd51 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 11:37:30 -0500 Subject: [PATCH 11/18] tsqlt is the right path --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 55d793d3c..4a443ea03 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -406,7 +406,7 @@ stages: - task: Ant@1 name: Run_tSQLt_validatebuild_xml inputs: - buildFile: '$(Pipeline.Workspace)/tSQLt/tSQLt/Build/tSQLt.validatebuild.xml' + buildFile: '$(Pipeline.Workspace)/tSQLt/Build/tSQLt.validatebuild.xml' options: '-Ddb.version="$(SQLVersion)" -Ddb.server="$(FQDNAndPort)" -Ddb.name=tSQLt_dev -Ddb.login="-U $(tSQLt-UserForCIEnvironment-UserName) -P $(tSQLt-UserForCIEnvironment-Password)" -Dsqlcmd.path="$(SQLCMDPath)"' targets: 'all' publishJUnitResults: true From 1f9364da5ce6354d1b1e3bc8c86af2d2d22725ac Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 11:45:29 -0500 Subject: [PATCH 12/18] attempt to simplify paths --- CI/AZ_MainPipeline.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 4a443ea03..1fc143085 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -331,12 +331,7 @@ stages: azurePowerShellVersion: 'LatestVersion' ScriptType: 'InlineScript' Inline: | - Write-Host '$(Build.Repository.LocalPath)'; - (Get-ChildItem); - Set-Location $(Build.Repository.LocalPath)/.. - (Get-ChildItem); - Set-Location $(Build.Repository.LocalPath)/../tSQLt - (Get-ChildItem); + Set-Location $(Pipeline.Workspace)/tSQLt .("CI/CommonFunctionsAndMethods.ps1") $SqlPort = Get-Random -minimum $env:SQLPORTMINIMUM -maximum $env:SQLPORTMAXIMUM @@ -410,7 +405,7 @@ stages: options: '-Ddb.version="$(SQLVersion)" -Ddb.server="$(FQDNAndPort)" -Ddb.name=tSQLt_dev -Ddb.login="-U $(tSQLt-UserForCIEnvironment-UserName) -P $(tSQLt-UserForCIEnvironment-Password)" -Dsqlcmd.path="$(SQLCMDPath)"' targets: 'all' publishJUnitResults: true - testResultsFiles: '../**/?(Example)TestResults*.xml' + testResultsFiles: '$(Pipeline.Workspace)/tSQLt/**/?(Example)TestResults*.xml' testRunTitle: '$(SQLVersionEdition)' javaHomeOption: 'JDKVersion' @@ -420,11 +415,8 @@ stages: targetType: 'inline' failOnStderr: true script: | - "---------------------------------------------------" - $BasePath = "$(Build.SourcesDirectory)\.."; - $BasePath; "===================================================" - $ArtifactPath = ($BasePath+"\tSQLt\Build\output\TestResults\"); + $ArtifactPath = ($(Pipeline.Workspace)+"\tSQLt\Build\output\TestResults\"); $ArtifactPath; "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" New-Item -Path $ArtifactPath -ItemType directory -Force @@ -440,7 +432,7 @@ stages: - task: PublishPipelineArtifact@1 name: PublishTestResultArtifact inputs: - targetPath: '$(Build.SourcesDirectory)/../tSQLt/Build/output/TestResults' + targetPath: '$(Pipeline.Workspace)/tSQLt/Build/output/TestResults' artifact: 'TestResults_$(SQLVersionEdition)' publishLocation: 'pipeline' From f372f69b50a7859717418393dbd1ed9e75593cd5 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 12:09:36 -0500 Subject: [PATCH 13/18] goodbye sql server 2008R2E --- CI/AZ_MainPipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 1fc143085..9993012a9 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -261,7 +261,6 @@ stages: strategy: matrix: { '2008R2':{'SQLVersionEdition':'2008R2Std'}, - '2008R2E':{'SQLVersionEdition':'2008R2Ent'}, '2012':{'SQLVersionEdition':'2012Ent'}, '2014':{'SQLVersionEdition':'2014'}, '2016':{'SQLVersionEdition':'2016'}, From 8d1cdbd3c3ac16247e01cdba1e712e40216e1eed Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 12:42:58 -0500 Subject: [PATCH 14/18] fewer git shenanigans --- CI/AZ_MainPipeline.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 9993012a9..2456ae150 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -287,32 +287,29 @@ stages: lfs: false fetchDepth: 1 persistCredentials: true - path: dontUse + path: tSQLtArtifacts - task: PowerShell@2 name: GetArtifact inputs: targetType: 'inline' script: | - $ArtifactTargetPath= '$(Pipeline.Workspace)/tSQLt/Build_Artifact' $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "GIT Failed!"}}; - Set-Location "$(Pipeline.Workspace)"; + Set-Location "$(Pipeline.Workspace)/tSQLtArtifacts"; + $ArtifactTargetPath= '$(Pipeline.Workspace)/tSQLt/Build_Artifact' + Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); - Write-Host ("ArtifactBranchName: {0}" -f "$(ArtifactBranchName)"); try{ - - $remoteURL = git config -f .\dontUse\.git\config remote.origin.url + git fetch origin $(ArtifactBranchName):$(ArtifactBranchName) $CheckIfGitOk.invoke($?); - - git clone --depth=1 $remoteURL -b $(ArtifactBranchName) tSQLtArtifacts + git checkout $(ArtifactBranchName) $CheckIfGitOk.invoke($?); }catch{ - throw "Git Failed. See prior errors."; + throw "git failed. See prior errors."; } New-Item -Path $ArtifactTargetPath -ItemType directory -Force - Copy-Item -Path "*" -Verbose -Destination $ArtifactTargetPath - task: AzurePowerShell@4 @@ -443,7 +440,7 @@ stages: inputs: targetType: 'inline' script: | - $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]GIT Failed!";throw "GIT Failed!"}}; + $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]git gailed!";throw "git failed!"}}; $TagName = "$(SQLVersionEdition)_$(Build.BuildId)" @@ -465,7 +462,7 @@ stages: git status }catch{ - throw "Git Failed. See prior errors."; + throw "git failed. See prior errors."; } ##--##--##--##--##--##--##--##--##--##---##--##--##--##--##--##--##--##--##--## From b76fab3ab190b76175e33abe3690baeef409dc35 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 13:17:59 -0500 Subject: [PATCH 15/18] NO --> D:\a\1+\tSQLt\Build\output\TestResults\ --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 2456ae150..33c6ded7c 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -412,7 +412,7 @@ stages: failOnStderr: true script: | "===================================================" - $ArtifactPath = ($(Pipeline.Workspace)+"\tSQLt\Build\output\TestResults\"); + $ArtifactPath = ($(Pipeline.Workspace)"\tSQLt\Build\output\TestResults\"); $ArtifactPath; "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" New-Item -Path $ArtifactPath -ItemType directory -Force From 729dcbe35c8d997ea206c87d4d99971ffdfb7215 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 14:01:23 -0500 Subject: [PATCH 16/18] concatenating strings is hard --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 33c6ded7c..58bb12ce7 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -412,7 +412,7 @@ stages: failOnStderr: true script: | "===================================================" - $ArtifactPath = ($(Pipeline.Workspace)"\tSQLt\Build\output\TestResults\"); + $ArtifactPath = "$(Pipeline.Workspace)\tSQLt\Build\output\TestResults\"; $ArtifactPath; "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" New-Item -Path $ArtifactPath -ItemType directory -Force From 8d31310bbb0c8077e03e7d2ae9b420106c8d31ad Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sat, 9 Jan 2021 15:19:23 -0500 Subject: [PATCH 17/18] It is too much trouble and probably not a great pattern to get rid of $basePath --- CI/AZ_MainPipeline.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 58bb12ce7..67be30bff 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -158,12 +158,12 @@ stages: targetType: 'inline' failOnStderr: true script: | - $BasePath = "$(Build.SourcesDirectory)\Build\output\"; - $ArtifactPath = ($BasePath+"Artifact\"); - New-Item -Path $ArtifactPath -ItemType directory -Force - $ArtifactFiles = (@("Version.txt","tSQLt.zip","tSQLt.tests.zip")|%{$BasePath+$_}); - $ArtifactFiles|Copy-Item -Verbose -Destination $ArtifactPath; - Set-Content -Path ($ArtifactPath+"CommitId.txt") -Value "$(Build.SourceVersion)" + $basePath = "$(Build.SourcesDirectory)\Build\output\"; + $artifactPath = ($basePath+"Artifact\"); + New-Item -Path $artifactPath -ItemType directory -Force + $ArtifactFiles = (@("Version.txt","tSQLt.zip","tSQLt.tests.zip")|%{$basePath+$_}); + $ArtifactFiles|Copy-Item -Verbose -Destination $artifactPath; + Set-Content -Path ($artifactPath+"CommitId.txt") -Value "$(Build.SourceVersion)" - task: PublishPipelineArtifact@1 inputs: @@ -411,18 +411,20 @@ stages: targetType: 'inline' failOnStderr: true script: | + "---------------------------------------------------" + $basePath = "$(Pipeline.Workspace)"; + $basePath; "===================================================" - $ArtifactPath = "$(Pipeline.Workspace)\tSQLt\Build\output\TestResults\"; - $ArtifactPath; + $artifactPath = "$basePath\tSQLt\Build\output\TestResults\"; + $artifactPath; "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" - New-Item -Path $ArtifactPath -ItemType directory -Force - (Get-ChildItem $BasePath -recurse); + New-Item -Path $artifactPath -ItemType directory -Force "== == == == == == == == == == == == == == == == == " - (Get-ChildItem $BasePath -recurse)|Out-File -FilePath $ArtifactPath+"dir.txt" - (Get-ChildItem $BasePath -recurse -include "*TestResults*.xml").FullName; + (Get-ChildItem $basePath -recurse)|Out-File -FilePath $artifactPath+"dir.txt" + (Get-ChildItem $basePath -recurse -include "*TestResults*.xml").FullName; "==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-" - (Get-ChildItem $BasePath -recurse -include "*TestResults*.xml").FullName|Copy-Item -Destination $ArtifactPath -recurse -PassThru - Set-Content -Path ($ArtifactPath+"CommitId.txt") -Value "$(Build.SourceVersion)" + (Get-ChildItem $basePath -recurse -include "*TestResults*.xml").FullName|Copy-Item -Destination $artifactPath -recurse -PassThru + Set-Content -Path ($artifactPath+"CommitId.txt") -Value "$(Build.SourceVersion)" "=== === === === === === === === === === === === ===" - task: PublishPipelineArtifact@1 From fc09c6506ca1f95849f55f1df88b56cf8fa1baf3 Mon Sep 17 00:00:00 2001 From: Liz Baron <10554+lizbaron@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:29:34 -0500 Subject: [PATCH 18/18] fixed spelling error --- CI/AZ_MainPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/AZ_MainPipeline.yml b/CI/AZ_MainPipeline.yml index 67be30bff..aabfc3506 100644 --- a/CI/AZ_MainPipeline.yml +++ b/CI/AZ_MainPipeline.yml @@ -442,7 +442,7 @@ stages: inputs: targetType: 'inline' script: | - $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]git gailed!";throw "git failed!"}}; + $CheckIfGitOk = {param($isOk);if(-not $isOk){Write-Host "##vso[task.logissue type=error]git failed!";throw "git failed!"}}; $TagName = "$(SQLVersionEdition)_$(Build.BuildId)"