From 0cb642abd322e0f9f4d35ac7ef77f755c0035540 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Fri, 21 Oct 2022 18:11:51 +0530 Subject: [PATCH 01/10] Initialize versionTag for release pipeline --- build/azure-pipelines/build-product.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 6913a742..6052e14b 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -7,7 +7,7 @@ pr: none parameters: - name: PushToGithub - default: true + default: false type: boolean displayName: Push packages to github @@ -74,7 +74,8 @@ stages: pool: vmImage: 'windows-latest' variables: - versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ] + - name: versionTag + value: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ] steps: - task: DownloadPipelineArtifact@2 inputs: From 7661d87f95e89b3bcc503f7ce7882480f5f34cf8 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Fri, 21 Oct 2022 21:19:07 +0530 Subject: [PATCH 02/10] Set isOutput=true to export VERSION_TAG --- build/azure-pipelines/build-product.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 6052e14b..9c1c8235 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -7,7 +7,7 @@ pr: none parameters: - name: PushToGithub - default: false + default: true type: boolean displayName: Push packages to github @@ -58,7 +58,7 @@ stages: targetType: 'inline' script: | $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) - Write-Host("##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG") + Write-Host("##vso[task.setvariable variable=VERSION_TAG;isOutput=true]$VERSION_TAG") Write-Host($VERSION_TAG) - template: build-common.yml parameters: @@ -74,8 +74,7 @@ stages: pool: vmImage: 'windows-latest' variables: - - name: versionTag - value: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ] + versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['Sqlcmd.getVersion.VERSION_TAG'] ] steps: - task: DownloadPipelineArtifact@2 inputs: From b3b0c46de7dd9b4810a3d307320bef21f740bfdc Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Fri, 4 Nov 2022 18:38:00 +0530 Subject: [PATCH 03/10] Fix output property for variable --- build/azure-pipelines/build-product.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 9c1c8235..214b69d2 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -58,7 +58,7 @@ stages: targetType: 'inline' script: | $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) - Write-Host("##vso[task.setvariable variable=VERSION_TAG;isOutput=true]$VERSION_TAG") + Write-Host("##vso[task.setvariable variable=VERSION_TAG;isoutput=true]$VERSION_TAG") Write-Host($VERSION_TAG) - template: build-common.yml parameters: @@ -74,7 +74,7 @@ stages: pool: vmImage: 'windows-latest' variables: - versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['Sqlcmd.getVersion.VERSION_TAG'] ] + versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ] steps: - task: DownloadPipelineArtifact@2 inputs: From 56ed1cb6861110ab7be1683aece20631d7d0d484 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Mon, 7 Nov 2022 15:10:23 +0530 Subject: [PATCH 04/10] Set tag via template --- build/azure-pipelines/build-product.yml | 27 +++++++++---------------- build/azure-pipelines/build-tag.yml | 11 ++++++++++ 2 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 build/azure-pipelines/build-tag.yml diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index f5e78f2b..8d07a329 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -51,15 +51,7 @@ stages: pool: vmImage: $(imageName) steps: - - task: PowerShell@2 - displayName: Set last tag to variable - name: getVersion - inputs: - targetType: 'inline' - script: | - $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) - Write-Host("##vso[task.setvariable variable=VERSION_TAG;isoutput=true]$VERSION_TAG") - Write-Host($VERSION_TAG) + - template: build-tag.yml - template: build-common.yml parameters: OS: $(os) @@ -73,9 +65,8 @@ stages: - job: Sign_and_pack pool: vmImage: 'windows-latest' - variables: - versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['Sqlcmd.getVersion.VERSION_TAG'] ] steps: + - template: build-common.yml - task: DownloadPipelineArtifact@2 inputs: buildType: 'current' @@ -139,7 +130,7 @@ stages: rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindowsAmd64\Sqlcmd.exe' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-windows-x64.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows-x64.zip' - task: ArchiveFiles@2 displayName: Zip Windows arm binary @@ -147,7 +138,7 @@ stages: rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindowsArm\Sqlcmd.exe' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-windows-arm.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows-arm.zip' - task: ArchiveFiles@2 displayName: Tar Linux amd64 binary @@ -156,7 +147,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-linux-x64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-x64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Darwin binary @@ -165,7 +156,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-darwin-x64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-darwin-x64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Linux arm64 binary @@ -174,7 +165,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-linux-arm64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-arm64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Linux s390x binary @@ -183,7 +174,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(versionTag)-linux-s390x.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-s390x.tar.bz2' - task: PublishPipelineArtifact@1 displayName: 'Publish release archives' @@ -199,6 +190,6 @@ stages: action: 'create' target: '$(Build.SourceVersion)' tagSource: 'userSpecifiedTag' - tag: '$(versionTag)' + tag: '$(VERSION_TAG)' changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' diff --git a/build/azure-pipelines/build-tag.yml b/build/azure-pipelines/build-tag.yml new file mode 100644 index 00000000..ed6296d4 --- /dev/null +++ b/build/azure-pipelines/build-tag.yml @@ -0,0 +1,11 @@ + +steps: + - task: PowerShell@2 + displayName: Set last tag to variable + name: getVersion + inputs: + targetType: 'inline' + script: | + $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) + Write-Host("##vso[task.setvariable variable=VERSION_TAG;isoutput=true]$VERSION_TAG") + Write-Host($VERSION_TAG) From 1ea82aa9cbb0b2db41e73374b40797a4eae30243 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Mon, 7 Nov 2022 15:48:00 +0530 Subject: [PATCH 05/10] Use template for variables --- build/azure-pipelines/build-product.yml | 5 ++++- build/azure-pipelines/build-tag.yml | 14 +++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 8d07a329..d1239f9b 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -50,8 +50,9 @@ stages: arch: s390x pool: vmImage: $(imageName) - steps: + variables: - template: build-tag.yml + steps: - template: build-common.yml parameters: OS: $(os) @@ -65,6 +66,8 @@ stages: - job: Sign_and_pack pool: vmImage: 'windows-latest' + variables: + - template: build-tag.yml steps: - template: build-common.yml - task: DownloadPipelineArtifact@2 diff --git a/build/azure-pipelines/build-tag.yml b/build/azure-pipelines/build-tag.yml index ed6296d4..94960d4b 100644 --- a/build/azure-pipelines/build-tag.yml +++ b/build/azure-pipelines/build-tag.yml @@ -1,11 +1,3 @@ - -steps: - - task: PowerShell@2 - displayName: Set last tag to variable - name: getVersion - inputs: - targetType: 'inline' - script: | - $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) - Write-Host("##vso[task.setvariable variable=VERSION_TAG;isoutput=true]$VERSION_TAG") - Write-Host($VERSION_TAG) +variables: +- name: VERSION_TAG + value: git describe --tags (git rev-list --tags --max-count=1) From cec10a1094d9dafe0ef577c32a927a31a6107b23 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Mon, 7 Nov 2022 16:06:21 +0530 Subject: [PATCH 06/10] Revert to setting variable via step in template --- build/azure-pipelines/build-product.yml | 8 ++++---- build/azure-pipelines/build-tag.yml | 14 +++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index d1239f9b..70d5ac10 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -50,9 +50,10 @@ stages: arch: s390x pool: vmImage: $(imageName) - variables: - - template: build-tag.yml steps: + - template: build-tag.yml + - script: | + echo $(VERSION_TAG) - template: build-common.yml parameters: OS: $(os) @@ -66,9 +67,8 @@ stages: - job: Sign_and_pack pool: vmImage: 'windows-latest' - variables: - - template: build-tag.yml steps: + - template: build-tag.yml - template: build-common.yml - task: DownloadPipelineArtifact@2 inputs: diff --git a/build/azure-pipelines/build-tag.yml b/build/azure-pipelines/build-tag.yml index 94960d4b..38796860 100644 --- a/build/azure-pipelines/build-tag.yml +++ b/build/azure-pipelines/build-tag.yml @@ -1,3 +1,11 @@ -variables: -- name: VERSION_TAG - value: git describe --tags (git rev-list --tags --max-count=1) + +steps: +- task: PowerShell@2 + displayName: Set last tag to variable + name: getVersion + inputs: + targetType: 'inline' + script: | + $VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1) + Write-Host("##vso[task.setvariable variable=VERSION_TAG;isoutput=true]$VERSION_TAG") + Write-Host($VERSION_TAG) From e24f9739a54b2b6fadd3229305a414d0790b3d62 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Mon, 7 Nov 2022 16:18:25 +0530 Subject: [PATCH 07/10] Add default value for ArtifactName --- build/azure-pipelines/build-common.yml | 1 + build/azure-pipelines/build-product.yml | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build/azure-pipelines/build-common.yml b/build/azure-pipelines/build-common.yml index 62e91668..4b08a24e 100644 --- a/build/azure-pipelines/build-common.yml +++ b/build/azure-pipelines/build-common.yml @@ -7,6 +7,7 @@ parameters: default: - name: ArtifactName type: string + default: - name: VersionTag type: string default: $(Build.BuildNumber) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 70d5ac10..74a26a96 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -52,8 +52,6 @@ stages: vmImage: $(imageName) steps: - template: build-tag.yml - - script: | - echo $(VERSION_TAG) - template: build-common.yml parameters: OS: $(os) From 23606f11db2e8d1713d284cf0a3236c6518db75b Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Mon, 7 Nov 2022 16:46:45 +0530 Subject: [PATCH 08/10] Fix version_tag dereferencing --- build/azure-pipelines/build-product.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 74a26a96..8bf3e736 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -52,12 +52,14 @@ stages: vmImage: $(imageName) steps: - template: build-tag.yml + - script: | + echo $(getVersion.VERSION_TAG) - template: build-common.yml parameters: OS: $(os) Arch: $(arch) ArtifactName: $(artifact) - VersionTag: $(VERSION_TAG) + VersionTag: $(getVersion.VERSION_TAG) - stage: CreatePackages displayName: Create packages to publish @@ -131,7 +133,7 @@ stages: rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindowsAmd64\Sqlcmd.exe' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows-x64.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-windows-x64.zip' - task: ArchiveFiles@2 displayName: Zip Windows arm binary @@ -139,7 +141,7 @@ stages: rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindowsArm\Sqlcmd.exe' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows-arm.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-windows-arm.zip' - task: ArchiveFiles@2 displayName: Tar Linux amd64 binary @@ -148,7 +150,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-x64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-linux-x64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Darwin binary @@ -157,7 +159,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-darwin-x64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-darwin-x64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Linux arm64 binary @@ -166,7 +168,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-arm64.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-linux-arm64.tar.bz2' - task: ArchiveFiles@2 displayName: Tar Linux s390x binary @@ -175,7 +177,7 @@ stages: includeRootFolder: false archiveType: 'tar' tarCompression: 'bz2' - archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux-s390x.tar.bz2' + archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(getVersion.VERSION_TAG)-linux-s390x.tar.bz2' - task: PublishPipelineArtifact@1 displayName: 'Publish release archives' @@ -191,6 +193,6 @@ stages: action: 'create' target: '$(Build.SourceVersion)' tagSource: 'userSpecifiedTag' - tag: '$(VERSION_TAG)' + tag: '$(getVersion.VERSION_TAG)' changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' From c10241477058d78e809843d49d6957d42ed9ffb4 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Thu, 10 Nov 2022 19:37:12 +0530 Subject: [PATCH 09/10] Remove duplicate build step in final stage --- build/azure-pipelines/build-product.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/build/azure-pipelines/build-product.yml b/build/azure-pipelines/build-product.yml index 8bf3e736..c028c4ae 100644 --- a/build/azure-pipelines/build-product.yml +++ b/build/azure-pipelines/build-product.yml @@ -69,7 +69,6 @@ stages: vmImage: 'windows-latest' steps: - template: build-tag.yml - - template: build-common.yml - task: DownloadPipelineArtifact@2 inputs: buildType: 'current' From b19ad6eb2d3d744aac88c382614be4380366d193 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Thu, 10 Nov 2022 20:07:02 +0530 Subject: [PATCH 10/10] Remove default val for ArtifactName --- build/azure-pipelines/build-common.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/build/azure-pipelines/build-common.yml b/build/azure-pipelines/build-common.yml index 4b08a24e..62e91668 100644 --- a/build/azure-pipelines/build-common.yml +++ b/build/azure-pipelines/build-common.yml @@ -7,7 +7,6 @@ parameters: default: - name: ArtifactName type: string - default: - name: VersionTag type: string default: $(Build.BuildNumber)