From 3fa56066dc975a65245ae020ae4f60a397feecec Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 12 Jul 2022 11:22:13 -0700 Subject: [PATCH 01/29] Set up for testing of template pipeline --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 21f35c8ad6..27615ca7fc 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -96,7 +96,7 @@ stages: vmImage: MMS2019 variables: - VcpkgPrRepoOwner: Microsoft + VcpkgPrRepoOwner: azure-sdk VcpkgPrRepoName: vcpkg strategy: From 1c008cf1f9b0bfca7162020632fef6aca108a39c Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 12 Jul 2022 12:32:45 -0700 Subject: [PATCH 02/29] Override branches, set up for template GA release --- .../templates/stages/archetype-cpp-release.yml | 12 +++++++++--- .../templates/stages/archetype-sdk-client.yml | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 27615ca7fc..55ace1b2b8 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -173,9 +173,15 @@ stages: condition: and(succeeded(), eq(variables['PublishToVcpkg'], 'true')) displayName: Set $(HasChanges) to $true for create-pull-request.yml - - template: /eng/common/pipelines/templates/steps/set-default-branch.yml - parameters: - WorkingDirectory: $(Pipeline.Workspace)/vcpkg + # TODO: Enable before merge + # - template: /eng/common/pipelines/templates/steps/set-default-branch.yml + # parameters: + # WorkingDirectory: $(Pipeline.Workspace)/vcpkg + + # TODO: Remove before merge + - pwsh: Write-Host "##vso[task.setvariable variable=DefaultBranch]test-vcpkg-beta-release" + displayName: Override default branch to test vcpkg beta release + # SkipCheckingForChanges is true to skip the commit step # (which is already done by Update-VcpkgPort.ps1) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index a9bc6a575c..bf76371c7b 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -126,5 +126,6 @@ stages: - LiveTest_${{ cloud.key }} Artifacts: ${{ parameters.Artifacts }} ArtifactName: packages - ${{ if eq(parameters.ServiceDirectory, 'template') }}: - TestPipeline: true + # TODO: Enable before merge + # ${{ if eq(parameters.ServiceDirectory, 'template') }}: + # TestPipeline: true From 3d3a6ee660398109a9c5e4898cb9cc8446799dac Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 12 Jul 2022 12:33:43 -0700 Subject: [PATCH 03/29] More TODOs to prevent merging an unintended change --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 55ace1b2b8..2568f61247 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -96,6 +96,7 @@ stages: vmImage: MMS2019 variables: + # TODO: Revert to Microsoft before merge VcpkgPrRepoOwner: azure-sdk VcpkgPrRepoName: vcpkg From d674489c68604a7f4422b40ba2b9f1d91725eae0 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 12 Jul 2022 13:25:23 -0700 Subject: [PATCH 04/29] More removal of TestPipeline --- eng/pipelines/templates/stages/archetype-sdk-client.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index bf76371c7b..d4a5608010 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -93,8 +93,9 @@ stages: CoverageReportPath: ${{ parameters.CoverageReportPath }} LineCoverageTarget: ${{ parameters.LineCoverageTarget }} BranchCoverageTarget: ${{ parameters.BranchCoverageTarget }} - ${{ if eq(parameters.ServiceDirectory, 'template') }}: - TestPipeline: true + # TODO: Uncomment before merge + # ${{ if eq(parameters.ServiceDirectory, 'template') }}: + # TestPipeline: true TestEnv: ${{ parameters.TestEnv }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(parameters.LiveTestCtestRegex, '')) }}: From 6b7d21631e894f60371916efd2111606e0e063ca Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 13 Jul 2022 08:29:38 -0700 Subject: [PATCH 05/29] Increment template version number --- sdk/template/azure-template/src/private/package_version.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index 4d3ab24461..c0f700cd1f 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -9,9 +9,9 @@ #pragma once #define AZURE_TEMPLATE_VERSION_MAJOR 1 -#define AZURE_TEMPLATE_VERSION_MINOR 0 +#define AZURE_TEMPLATE_VERSION_MINOR 1 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "1" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 882876a281392a55b96064bbdc89e7f3c515a67d Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 13 Jul 2022 08:38:41 -0700 Subject: [PATCH 06/29] Use script to set package version --- sdk/template/azure-template/CHANGELOG.md | 2 +- sdk/template/azure-template/src/private/package_version.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index 1b05d63a90..419e476357 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0 (2021-06-03) +## 1.1.0-beta.1 (2022-07-13) * Validate template project ahead of release diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index c0f700cd1f..f93bd16bad 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -11,7 +11,7 @@ #define AZURE_TEMPLATE_VERSION_MAJOR 1 #define AZURE_TEMPLATE_VERSION_MINOR 1 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "1" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From be3bcb92ffa2c6ad9221666aaf7ddf0fedb5aa52 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 14 Jul 2022 07:16:57 -0700 Subject: [PATCH 07/29] Check out the correct branch --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 1 + eng/pipelines/templates/steps/vcpkg-clone.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 2568f61247..552615f626 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -139,6 +139,7 @@ stages: parameters: RepoOwner: azure-sdk PRBranchName: $(PrBranchName) + BaseBranchName: test-vcpkg-beta-release # Clone Vcpkg Betas - template: /eng/pipelines/templates/steps/vcpkg-clone.yml diff --git a/eng/pipelines/templates/steps/vcpkg-clone.yml b/eng/pipelines/templates/steps/vcpkg-clone.yml index b374bee15d..70367f1f88 100644 --- a/eng/pipelines/templates/steps/vcpkg-clone.yml +++ b/eng/pipelines/templates/steps/vcpkg-clone.yml @@ -2,11 +2,12 @@ parameters: Workspace: $(Pipeline.Workspace) RepoOwner: not-set RepoName: vcpkg + BaseBranchName: main PRBranchName: not-set steps: - pwsh: | - Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" + Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" --branch "${{ parameters.BaseBranchName }}" git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} if ($LASTEXITCODE -ne 0) { Write-Error "Unable to check out vcpkg fork repo" From b5e7dfb92e77123e238a695f4cb2b123beaa7ff2 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 14 Jul 2022 08:17:25 -0700 Subject: [PATCH 08/29] branch parameter in the command --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 3 ++- eng/pipelines/templates/steps/vcpkg-clone.yml | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 552615f626..b91084a463 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -109,7 +109,7 @@ stages: - pwsh: | $branchName = "azure-sdk-for-cpp-${{ artifact.Name }}-$(Build.BuildId)" if ('$(VcpkgForkBranchName)') { - Write-Host "Using queue time branch name" + Write-Host "Using queue time branch name" $branchName = '$(VcpkgForkBranchName)' } Write-Host "##vso[task.setvariable variable=PrBranchName]$branchName" @@ -139,6 +139,7 @@ stages: parameters: RepoOwner: azure-sdk PRBranchName: $(PrBranchName) + # TODO: Use default branch before merge BaseBranchName: test-vcpkg-beta-release # Clone Vcpkg Betas diff --git a/eng/pipelines/templates/steps/vcpkg-clone.yml b/eng/pipelines/templates/steps/vcpkg-clone.yml index 70367f1f88..72a1fa61ae 100644 --- a/eng/pipelines/templates/steps/vcpkg-clone.yml +++ b/eng/pipelines/templates/steps/vcpkg-clone.yml @@ -8,16 +8,18 @@ parameters: steps: - pwsh: | Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" --branch "${{ parameters.BaseBranchName }}" - git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} + git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} --branch "${{ parameters.BaseBranchName }}" if ($LASTEXITCODE -ne 0) { Write-Error "Unable to check out vcpkg fork repo" exit $LASTEXITCODE } + Write-Host "Current branch: $(git branch --show-current)" displayName: Clone vcpkg (${{ parameters.RepoOwner }}/${{ parameters.RepoName }}) # Check out the PR branch if it's already in remote. Ignore failures. - pwsh: | $ErrorActionPreference = "Continue" + Write-Host 'git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null' git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null $LASTEXITCODE = 0 # This ignores any error from git checkout git status From f5cd1b1f4b742f87b17a4efcb20bb84fdde7011d Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 14 Jul 2022 09:37:25 -0700 Subject: [PATCH 09/29] Use $(PublishToVcpkg) to determine if we should check for changes --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index b91084a463..c27be77f1e 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -196,7 +196,7 @@ stages: PrBranchName: $(PrBranchName) PRTitle: $(PrTitle) PRBody: Update vcpkg ports for Azure SDK release. This release may contain multiple ports. - SkipCheckingForChanges: true + SkipCheckingForChanges: $(PublishToVcpkg) BaseBranchName: $(DefaultBranch) OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" From 62a24cfbb4679ae8c77ca9b54620fbd494af08f4 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 14 Jul 2022 14:35:22 -0700 Subject: [PATCH 10/29] dictionary syntax --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index c27be77f1e..7d65c700d9 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -196,7 +196,13 @@ stages: PrBranchName: $(PrBranchName) PRTitle: $(PrTitle) PRBody: Update vcpkg ports for Azure SDK release. This release may contain multiple ports. - SkipCheckingForChanges: $(PublishToVcpkg) + # If PublishToVcpkg is true, this template blindly attempts to create a PR. In that case + # changes must already be checked into the branch for this template to succeed. + # If PublishToVcpkg is false, the non-skipped checking for changes will result in no attempt + # to open a PR because there will be no detected changes. + # Use dictionary syntax because the template inserts the literal string into a `condition:` + # element. + SkipCheckingForChanges: variables['PublishToVcpkg'] BaseBranchName: $(DefaultBranch) OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" From 76c5a9f75d92502ebb93ca0eb3512962b7e4c5c0 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 08:19:39 -0700 Subject: [PATCH 11/29] Set GA package version to validate GA publish scenario --- sdk/template/azure-template/src/private/package_version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index f93bd16bad..03d605e4d9 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -11,7 +11,7 @@ #define AZURE_TEMPLATE_VERSION_MAJOR 1 #define AZURE_TEMPLATE_VERSION_MINOR 1 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 3a74a317c488f5f5787959d47f54ffd0f231ee78 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 08:31:38 -0700 Subject: [PATCH 12/29] Update changelog --- sdk/template/azure-template/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index 419e476357..5a2964960c 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.0 (2022-07-18) + +* Validate template project ahead of release + ## 1.1.0-beta.1 (2022-07-13) * Validate template project ahead of release From 243f42a1ecdad28e2a5b96f8ca8cdea5238735c9 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 10:15:47 -0700 Subject: [PATCH 13/29] create-pull-request.yml optionally pushes changes --- .../templates/steps/create-pull-request.yml | 26 +++++++++++-------- .../stages/archetype-cpp-release.yml | 11 +------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/eng/common/pipelines/templates/steps/create-pull-request.yml b/eng/common/pipelines/templates/steps/create-pull-request.yml index df364d4478..64f8c23a70 100644 --- a/eng/common/pipelines/templates/steps/create-pull-request.yml +++ b/eng/common/pipelines/templates/steps/create-pull-request.yml @@ -21,19 +21,23 @@ parameters: SkipCheckingForChanges: false CloseAfterOpenForTesting: false OpenAsDraft: false + # If PushWorkingDirectoryChanges is set to false, something else must set + # $(HasChanges) == true to open a PR + PushWorkingDirectoryChanges: true steps: -- template: /eng/common/pipelines/templates/steps/git-push-changes.yml - parameters: - BaseRepoBranch: ${{ parameters.PRBranchName }} - BaseRepoOwner: ${{ parameters.PROwner }} - CommitMsg: ${{ parameters.CommitMsg }} - TargetRepoOwner: ${{ parameters.RepoOwner }} - TargetRepoName: ${{ parameters.RepoName }} - PushArgs: ${{ parameters.PushArgs }} - WorkingDirectory: ${{ parameters.WorkingDirectory }} - ScriptDirectory: ${{ parameters.ScriptDirectory }} - SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }} +- ${{ if eq('true', parameters.PushWorkingDirectoryChanges) }}: + - template: /eng/common/pipelines/templates/steps/git-push-changes.yml + parameters: + BaseRepoBranch: ${{ parameters.PRBranchName }} + BaseRepoOwner: ${{ parameters.PROwner }} + CommitMsg: ${{ parameters.CommitMsg }} + TargetRepoOwner: ${{ parameters.RepoOwner }} + TargetRepoName: ${{ parameters.RepoName }} + PushArgs: ${{ parameters.PushArgs }} + WorkingDirectory: ${{ parameters.WorkingDirectory }} + ScriptDirectory: ${{ parameters.ScriptDirectory }} + SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }} - task: PowerShell@2 displayName: Create pull request diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 7d65c700d9..65a29b846e 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -185,24 +185,15 @@ stages: - pwsh: Write-Host "##vso[task.setvariable variable=DefaultBranch]test-vcpkg-beta-release" displayName: Override default branch to test vcpkg beta release - - # SkipCheckingForChanges is true to skip the commit step - # (which is already done by Update-VcpkgPort.ps1) - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: + PushWorkingDirectoryChanges: false RepoOwner: $(VcpkgPrRepoOwner) RepoName: $(VcpkgPrRepoName) WorkingDirectory: $(Pipeline.Workspace)/vcpkg PrBranchName: $(PrBranchName) PRTitle: $(PrTitle) PRBody: Update vcpkg ports for Azure SDK release. This release may contain multiple ports. - # If PublishToVcpkg is true, this template blindly attempts to create a PR. In that case - # changes must already be checked into the branch for this template to succeed. - # If PublishToVcpkg is false, the non-skipped checking for changes will result in no attempt - # to open a PR because there will be no detected changes. - # Use dictionary syntax because the template inserts the literal string into a `condition:` - # element. - SkipCheckingForChanges: variables['PublishToVcpkg'] BaseBranchName: $(DefaultBranch) OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" From c5b3adc0a8eabe9e659bfea91822a369b004f5c4 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 11:24:10 -0700 Subject: [PATCH 14/29] Output GH PR URI --- eng/common/scripts/Invoke-GitHubAPI.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/common/scripts/Invoke-GitHubAPI.ps1 b/eng/common/scripts/Invoke-GitHubAPI.ps1 index 504ac51ada..a38cdc6272 100644 --- a/eng/common/scripts/Invoke-GitHubAPI.ps1 +++ b/eng/common/scripts/Invoke-GitHubAPI.ps1 @@ -60,6 +60,8 @@ function Get-GitHubPullRequests { if ($Sort) { $uri += "sort=$Sort&" } if ($Direction){ $uri += "direction=$Direction&" } + Write-Host "Get PRs: $uri" + return Invoke-RestMethod ` -Method GET ` -Uri $uri ` From be3f7a17ea9e57a08ae92295900713c3dbd6e8d0 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 13:46:13 -0700 Subject: [PATCH 15/29] Macro syntax with a variable set earlier --- .../templates/steps/create-pull-request.yml | 26 ++++++++----------- .../templates/steps/git-push-changes.yml | 14 +++++++++- eng/common/scripts/Invoke-GitHubAPI.ps1 | 2 -- .../stages/archetype-cpp-release.yml | 7 +++++ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/eng/common/pipelines/templates/steps/create-pull-request.yml b/eng/common/pipelines/templates/steps/create-pull-request.yml index 64f8c23a70..df364d4478 100644 --- a/eng/common/pipelines/templates/steps/create-pull-request.yml +++ b/eng/common/pipelines/templates/steps/create-pull-request.yml @@ -21,23 +21,19 @@ parameters: SkipCheckingForChanges: false CloseAfterOpenForTesting: false OpenAsDraft: false - # If PushWorkingDirectoryChanges is set to false, something else must set - # $(HasChanges) == true to open a PR - PushWorkingDirectoryChanges: true steps: -- ${{ if eq('true', parameters.PushWorkingDirectoryChanges) }}: - - template: /eng/common/pipelines/templates/steps/git-push-changes.yml - parameters: - BaseRepoBranch: ${{ parameters.PRBranchName }} - BaseRepoOwner: ${{ parameters.PROwner }} - CommitMsg: ${{ parameters.CommitMsg }} - TargetRepoOwner: ${{ parameters.RepoOwner }} - TargetRepoName: ${{ parameters.RepoName }} - PushArgs: ${{ parameters.PushArgs }} - WorkingDirectory: ${{ parameters.WorkingDirectory }} - ScriptDirectory: ${{ parameters.ScriptDirectory }} - SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }} +- template: /eng/common/pipelines/templates/steps/git-push-changes.yml + parameters: + BaseRepoBranch: ${{ parameters.PRBranchName }} + BaseRepoOwner: ${{ parameters.PROwner }} + CommitMsg: ${{ parameters.CommitMsg }} + TargetRepoOwner: ${{ parameters.RepoOwner }} + TargetRepoName: ${{ parameters.RepoName }} + PushArgs: ${{ parameters.PushArgs }} + WorkingDirectory: ${{ parameters.WorkingDirectory }} + ScriptDirectory: ${{ parameters.ScriptDirectory }} + SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }} - task: PowerShell@2 displayName: Create pull request diff --git a/eng/common/pipelines/templates/steps/git-push-changes.yml b/eng/common/pipelines/templates/steps/git-push-changes.yml index a922b203a9..5c4b7309b4 100644 --- a/eng/common/pipelines/templates/steps/git-push-changes.yml +++ b/eng/common/pipelines/templates/steps/git-push-changes.yml @@ -25,11 +25,22 @@ steps: echo "##vso[task.setvariable variable=HasChanges]$false" echo "No changes so skipping code push" } + + # Conditions determined that SkipCheckingForChanges is 'false', set this + # as a variable which can be passed into the "Push Changes" step + echo "##vso[task.setvariable variable=SkipCheckingForChanges]false" displayName: Check for changes condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false)) workingDirectory: ${{ parameters.WorkingDirectory }} ignoreLASTEXITCODE: true +- pwsh: | + # Checking for changes was skipped, set a variable which can be passed into + # the "Push Changes" step + Write-Host "##vso[task.setvariable variable=SkipCheckingForChanges]true" + condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, true)) + displayName: Set SkipCheckingForChanges to true + - pwsh: | # Remove the repo owner from the front of the repo name if it exists there $repoName = "${{ parameters.TargetRepoName }}" -replace "^${{ parameters.TargetRepoOwner }}/", "" @@ -39,6 +50,7 @@ steps: condition: succeeded() workingDirectory: ${{ parameters.WorkingDirectory }} +# $(SkipCheckingForChanges) is set in an earlier step - task: PowerShell@2 displayName: Push changes condition: and(succeeded(), eq(variables['HasChanges'], 'true')) @@ -51,4 +63,4 @@ steps: -CommitMsg "${{ parameters.CommitMsg }}" -GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.BaseRepoOwner }}/$(RepoNameWithoutOwner).git" -PushArgs "${{ parameters.PushArgs }}" - -SkipCommit $${{ parameters.SkipCheckingForChanges }} + -SkipCommit $$(SkipCheckingForChanges) diff --git a/eng/common/scripts/Invoke-GitHubAPI.ps1 b/eng/common/scripts/Invoke-GitHubAPI.ps1 index a38cdc6272..504ac51ada 100644 --- a/eng/common/scripts/Invoke-GitHubAPI.ps1 +++ b/eng/common/scripts/Invoke-GitHubAPI.ps1 @@ -60,8 +60,6 @@ function Get-GitHubPullRequests { if ($Sort) { $uri += "sort=$Sort&" } if ($Direction){ $uri += "direction=$Direction&" } - Write-Host "Get PRs: $uri" - return Invoke-RestMethod ` -Method GET ` -Uri $uri ` diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 65a29b846e..597418346c 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -198,6 +198,13 @@ stages: OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}' + # If PublishToVcpkg is true, this template blindly attempts to create a PR. In that case + # changes must already be checked into the branch for this template to succeed. + # If PublishToVcpkg is false, the non-skipped checking for changes will result in no attempt + # to open a PR because there will be no detected changes. + # Use dictionary syntax because the template inserts the literal string into a `condition:` + # element. + SkipCheckingForChanges: variables['PublishToVcpkg'] - pwsh: | $codeOwnersToNotify = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 ` From d4b5b56cf279481ca784c87c86b0d7327fc8f2e3 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 14:06:37 -0700 Subject: [PATCH 16/29] Move up to 1.2.0-beta.2 --- sdk/template/azure-template/CHANGELOG.md | 4 ++++ sdk/template/azure-template/src/private/package_version.hpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index 5a2964960c..e0de590c00 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.2.0-beta.1 (2022-07-18) + +* Validate template project ahead of release + ## 1.1.0 (2022-07-18) * Validate template project ahead of release diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index 03d605e4d9..a657113c57 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -9,9 +9,9 @@ #pragma once #define AZURE_TEMPLATE_VERSION_MAJOR 1 -#define AZURE_TEMPLATE_VERSION_MINOR 1 +#define AZURE_TEMPLATE_VERSION_MINOR 2 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.2" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 8e64e853c7963a951db3da778c9e239f32dcd090 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 14:17:59 -0700 Subject: [PATCH 17/29] beta.1 --- sdk/template/azure-template/src/private/package_version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index a657113c57..227c2c344d 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -11,7 +11,7 @@ #define AZURE_TEMPLATE_VERSION_MAJOR 1 #define AZURE_TEMPLATE_VERSION_MINOR 2 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.2" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 79d7e3041f03ef274f01c1a06a5279f91ab49712 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 14:35:30 -0700 Subject: [PATCH 18/29] Revert changelog --- sdk/template/azure-template/CHANGELOG.md | 10 +--------- .../azure-template/src/private/package_version.hpp | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index e0de590c00..1b05d63a90 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,14 +1,6 @@ # Release History -## 1.2.0-beta.1 (2022-07-18) - -* Validate template project ahead of release - -## 1.1.0 (2022-07-18) - -* Validate template project ahead of release - -## 1.1.0-beta.1 (2022-07-13) +## 1.0.0 (2021-06-03) * Validate template project ahead of release diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index 227c2c344d..4d3ab24461 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -9,9 +9,9 @@ #pragma once #define AZURE_TEMPLATE_VERSION_MAJOR 1 -#define AZURE_TEMPLATE_VERSION_MINOR 2 +#define AZURE_TEMPLATE_VERSION_MINOR 0 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 086447775ed9aeb294b7e457887a17fa139c8fe0 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 14:35:52 -0700 Subject: [PATCH 19/29] Revert testing-related changes --- .../templates/stages/archetype-cpp-release.yml | 16 ++++------------ .../templates/stages/archetype-sdk-client.yml | 10 ++++------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 597418346c..53a321193f 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -96,8 +96,7 @@ stages: vmImage: MMS2019 variables: - # TODO: Revert to Microsoft before merge - VcpkgPrRepoOwner: azure-sdk + VcpkgPrRepoOwner: Microsoft VcpkgPrRepoName: vcpkg strategy: @@ -139,8 +138,6 @@ stages: parameters: RepoOwner: azure-sdk PRBranchName: $(PrBranchName) - # TODO: Use default branch before merge - BaseBranchName: test-vcpkg-beta-release # Clone Vcpkg Betas - template: /eng/pipelines/templates/steps/vcpkg-clone.yml @@ -176,14 +173,9 @@ stages: condition: and(succeeded(), eq(variables['PublishToVcpkg'], 'true')) displayName: Set $(HasChanges) to $true for create-pull-request.yml - # TODO: Enable before merge - # - template: /eng/common/pipelines/templates/steps/set-default-branch.yml - # parameters: - # WorkingDirectory: $(Pipeline.Workspace)/vcpkg - - # TODO: Remove before merge - - pwsh: Write-Host "##vso[task.setvariable variable=DefaultBranch]test-vcpkg-beta-release" - displayName: Override default branch to test vcpkg beta release + - template: /eng/common/pipelines/templates/steps/set-default-branch.yml + parameters: + WorkingDirectory: $(Pipeline.Workspace)/vcpkg - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index d4a5608010..a9bc6a575c 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -93,9 +93,8 @@ stages: CoverageReportPath: ${{ parameters.CoverageReportPath }} LineCoverageTarget: ${{ parameters.LineCoverageTarget }} BranchCoverageTarget: ${{ parameters.BranchCoverageTarget }} - # TODO: Uncomment before merge - # ${{ if eq(parameters.ServiceDirectory, 'template') }}: - # TestPipeline: true + ${{ if eq(parameters.ServiceDirectory, 'template') }}: + TestPipeline: true TestEnv: ${{ parameters.TestEnv }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(parameters.LiveTestCtestRegex, '')) }}: @@ -127,6 +126,5 @@ stages: - LiveTest_${{ cloud.key }} Artifacts: ${{ parameters.Artifacts }} ArtifactName: packages - # TODO: Enable before merge - # ${{ if eq(parameters.ServiceDirectory, 'template') }}: - # TestPipeline: true + ${{ if eq(parameters.ServiceDirectory, 'template') }}: + TestPipeline: true From 566ce4030a496f2a5f9912c3020210b9476c0311 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 18 Jul 2022 14:46:40 -0700 Subject: [PATCH 20/29] Revert vcpkg-clone.yml --- eng/pipelines/templates/steps/vcpkg-clone.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/steps/vcpkg-clone.yml b/eng/pipelines/templates/steps/vcpkg-clone.yml index 72a1fa61ae..b374bee15d 100644 --- a/eng/pipelines/templates/steps/vcpkg-clone.yml +++ b/eng/pipelines/templates/steps/vcpkg-clone.yml @@ -2,24 +2,21 @@ parameters: Workspace: $(Pipeline.Workspace) RepoOwner: not-set RepoName: vcpkg - BaseBranchName: main PRBranchName: not-set steps: - pwsh: | - Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" --branch "${{ parameters.BaseBranchName }}" - git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} --branch "${{ parameters.BaseBranchName }}" + Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" + git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} if ($LASTEXITCODE -ne 0) { Write-Error "Unable to check out vcpkg fork repo" exit $LASTEXITCODE } - Write-Host "Current branch: $(git branch --show-current)" displayName: Clone vcpkg (${{ parameters.RepoOwner }}/${{ parameters.RepoName }}) # Check out the PR branch if it's already in remote. Ignore failures. - pwsh: | $ErrorActionPreference = "Continue" - Write-Host 'git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null' git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null $LASTEXITCODE = 0 # This ignores any error from git checkout git status From 50042119a66fcc6db31b27acf73dd5e5f23e8bb3 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 09:00:20 -0700 Subject: [PATCH 21/29] Revert eng/common changes, ensure global $(HasChanges) is set properly --- .../templates/steps/git-push-changes.yml | 14 +------------ .../stages/archetype-cpp-release.yml | 20 ++++++------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/eng/common/pipelines/templates/steps/git-push-changes.yml b/eng/common/pipelines/templates/steps/git-push-changes.yml index 5c4b7309b4..a922b203a9 100644 --- a/eng/common/pipelines/templates/steps/git-push-changes.yml +++ b/eng/common/pipelines/templates/steps/git-push-changes.yml @@ -25,22 +25,11 @@ steps: echo "##vso[task.setvariable variable=HasChanges]$false" echo "No changes so skipping code push" } - - # Conditions determined that SkipCheckingForChanges is 'false', set this - # as a variable which can be passed into the "Push Changes" step - echo "##vso[task.setvariable variable=SkipCheckingForChanges]false" displayName: Check for changes condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false)) workingDirectory: ${{ parameters.WorkingDirectory }} ignoreLASTEXITCODE: true -- pwsh: | - # Checking for changes was skipped, set a variable which can be passed into - # the "Push Changes" step - Write-Host "##vso[task.setvariable variable=SkipCheckingForChanges]true" - condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, true)) - displayName: Set SkipCheckingForChanges to true - - pwsh: | # Remove the repo owner from the front of the repo name if it exists there $repoName = "${{ parameters.TargetRepoName }}" -replace "^${{ parameters.TargetRepoOwner }}/", "" @@ -50,7 +39,6 @@ steps: condition: succeeded() workingDirectory: ${{ parameters.WorkingDirectory }} -# $(SkipCheckingForChanges) is set in an earlier step - task: PowerShell@2 displayName: Push changes condition: and(succeeded(), eq(variables['HasChanges'], 'true')) @@ -63,4 +51,4 @@ steps: -CommitMsg "${{ parameters.CommitMsg }}" -GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.BaseRepoOwner }}/$(RepoNameWithoutOwner).git" -PushArgs "${{ parameters.PushArgs }}" - -SkipCommit $$(SkipCheckingForChanges) + -SkipCommit $${{ parameters.SkipCheckingForChanges }} diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 53a321193f..bbe7f92fec 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -164,13 +164,11 @@ stages: CommitMsg: Update vcpkg-configuration.json BaseRepoBranch: $(DefaultBranch) - # Set $(HasChanges) to $true so that - # create-pull-request.yml completes the push and PR - # submission steps. This is contegnent upon - # `$(PublishToVcpkg)` being `true`. `$(PublishToVcpkg)` is - # set in `vcpkg-publish.yml` - - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$true" - condition: and(succeeded(), eq(variables['PublishToVcpkg'], 'true')) + # Set $(HasChanges) to $(PublishToVcpkg) so that + # create-pull-request.yml creates or does not create a PR + # based on the deicision of the step that determines + # whether to publish to vcpkg. + - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$(PublishToVcpkg)" displayName: Set $(HasChanges) to $true for create-pull-request.yml - template: /eng/common/pipelines/templates/steps/set-default-branch.yml @@ -190,13 +188,7 @@ stages: OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}' - # If PublishToVcpkg is true, this template blindly attempts to create a PR. In that case - # changes must already be checked into the branch for this template to succeed. - # If PublishToVcpkg is false, the non-skipped checking for changes will result in no attempt - # to open a PR because there will be no detected changes. - # Use dictionary syntax because the template inserts the literal string into a `condition:` - # element. - SkipCheckingForChanges: variables['PublishToVcpkg'] + SkipCheckingForChanges: true - pwsh: | $codeOwnersToNotify = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 ` From ce5bc5c473e984d6cbfcf2e84645ec60f7a7ea78 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 09:15:37 -0700 Subject: [PATCH 22/29] Changes to enable testing --- .../templates/stages/archetype-cpp-release.yml | 16 ++++++++++++---- .../templates/stages/archetype-sdk-client.yml | 10 ++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index bbe7f92fec..189615c26b 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -96,7 +96,8 @@ stages: vmImage: MMS2019 variables: - VcpkgPrRepoOwner: Microsoft + # TODO: Revert to Microsoft before merge + VcpkgPrRepoOwner: azure-sdk VcpkgPrRepoName: vcpkg strategy: @@ -138,6 +139,8 @@ stages: parameters: RepoOwner: azure-sdk PRBranchName: $(PrBranchName) + # TODO: Use default branch before merge + BaseBranchName: test-vcpkg-beta-release # Clone Vcpkg Betas - template: /eng/pipelines/templates/steps/vcpkg-clone.yml @@ -171,9 +174,14 @@ stages: - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$(PublishToVcpkg)" displayName: Set $(HasChanges) to $true for create-pull-request.yml - - template: /eng/common/pipelines/templates/steps/set-default-branch.yml - parameters: - WorkingDirectory: $(Pipeline.Workspace)/vcpkg + # TODO: Enable before merge + # - template: /eng/common/pipelines/templates/steps/set-default-branch.yml + # parameters: + # WorkingDirectory: $(Pipeline.Workspace)/vcpkg + + # TODO: Remove before merge + - pwsh: Write-Host "##vso[task.setvariable variable=DefaultBranch]test-vcpkg-beta-release" + displayName: Override default branch to test vcpkg beta release - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index a9bc6a575c..336f6937c7 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -93,8 +93,9 @@ stages: CoverageReportPath: ${{ parameters.CoverageReportPath }} LineCoverageTarget: ${{ parameters.LineCoverageTarget }} BranchCoverageTarget: ${{ parameters.BranchCoverageTarget }} - ${{ if eq(parameters.ServiceDirectory, 'template') }}: - TestPipeline: true + # TODO: Uncomment before merge + # ${{ if eq(parameters.ServiceDirectory, 'template') }}: + # TestPipeline: true TestEnv: ${{ parameters.TestEnv }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(parameters.LiveTestCtestRegex, '')) }}: @@ -126,5 +127,6 @@ stages: - LiveTest_${{ cloud.key }} Artifacts: ${{ parameters.Artifacts }} ArtifactName: packages - ${{ if eq(parameters.ServiceDirectory, 'template') }}: - TestPipeline: true + # TODO: Enable before merge + # ${{ if eq(parameters.ServiceDirectory, 'template') }}: + # TestPipeline: true \ No newline at end of file From 7dc258d74278ebe3d3d5db7e94ebd105ff1bc678 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 11:28:41 -0700 Subject: [PATCH 23/29] 1.1.0-beta.1 --- sdk/template/azure-template/CHANGELOG.md | 3 +++ sdk/template/azure-template/src/private/package_version.hpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index 1b05d63a90..123c655941 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History +## 1.1.0-beta.1 (2022-07-20) + +* Validate template project ahead of release ## 1.0.0 (2021-06-03) * Validate template project ahead of release diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index 4d3ab24461..f93bd16bad 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -9,9 +9,9 @@ #pragma once #define AZURE_TEMPLATE_VERSION_MAJOR 1 -#define AZURE_TEMPLATE_VERSION_MINOR 0 +#define AZURE_TEMPLATE_VERSION_MINOR 1 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 285f2904858a2c41044144fac385b14485dda68e Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 15:24:55 -0700 Subject: [PATCH 24/29] vcpkg clone should clone at configured branch --- eng/pipelines/templates/steps/vcpkg-clone.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/vcpkg-clone.yml b/eng/pipelines/templates/steps/vcpkg-clone.yml index b374bee15d..b6f99b5315 100644 --- a/eng/pipelines/templates/steps/vcpkg-clone.yml +++ b/eng/pipelines/templates/steps/vcpkg-clone.yml @@ -2,21 +2,25 @@ parameters: Workspace: $(Pipeline.Workspace) RepoOwner: not-set RepoName: vcpkg + # Default branch name for vcpkg at this time is still "master" + BaseBranchName: master PRBranchName: not-set steps: - pwsh: | - Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" - git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} + Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" --branch "${{ parameters.BaseBranchName }}" + git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} --branch "${{ parameters.BaseBranchName }}" if ($LASTEXITCODE -ne 0) { Write-Error "Unable to check out vcpkg fork repo" exit $LASTEXITCODE } + Write-Host "Current branch: $(git branch --show-current)" displayName: Clone vcpkg (${{ parameters.RepoOwner }}/${{ parameters.RepoName }}) # Check out the PR branch if it's already in remote. Ignore failures. - pwsh: | $ErrorActionPreference = "Continue" + Write-Host 'git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null' git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null $LASTEXITCODE = 0 # This ignores any error from git checkout git status From ec7725dcb79f078462ebe7403957a9fbed9b7b4b Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 15:39:27 -0700 Subject: [PATCH 25/29] Clone "main" branch of vcpkg betas --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 189615c26b..f2c518703d 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -147,6 +147,7 @@ stages: parameters: RepoOwner: Azure RepoName: azure-sdk-vcpkg-betas + BaseBranchName: main - template: /eng/pipelines/templates/steps/vcpkg-publish.yml parameters: From dae9eca1256f51e47e980a32c5230704c56ed80b Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 15:55:02 -0700 Subject: [PATCH 26/29] Undo test-specific changes --- .../templates/stages/archetype-cpp-release.yml | 16 ++++------------ .../templates/stages/archetype-sdk-client.yml | 10 ++++------ eng/pipelines/templates/steps/vcpkg-clone.yml | 8 ++------ 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index f2c518703d..5f17df5d21 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -96,8 +96,7 @@ stages: vmImage: MMS2019 variables: - # TODO: Revert to Microsoft before merge - VcpkgPrRepoOwner: azure-sdk + VcpkgPrRepoOwner: Microsoft VcpkgPrRepoName: vcpkg strategy: @@ -139,8 +138,6 @@ stages: parameters: RepoOwner: azure-sdk PRBranchName: $(PrBranchName) - # TODO: Use default branch before merge - BaseBranchName: test-vcpkg-beta-release # Clone Vcpkg Betas - template: /eng/pipelines/templates/steps/vcpkg-clone.yml @@ -175,14 +172,9 @@ stages: - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$(PublishToVcpkg)" displayName: Set $(HasChanges) to $true for create-pull-request.yml - # TODO: Enable before merge - # - template: /eng/common/pipelines/templates/steps/set-default-branch.yml - # parameters: - # WorkingDirectory: $(Pipeline.Workspace)/vcpkg - - # TODO: Remove before merge - - pwsh: Write-Host "##vso[task.setvariable variable=DefaultBranch]test-vcpkg-beta-release" - displayName: Override default branch to test vcpkg beta release + - template: /eng/common/pipelines/templates/steps/set-default-branch.yml + parameters: + WorkingDirectory: $(Pipeline.Workspace)/vcpkg - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 336f6937c7..21a3d0f572 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -93,9 +93,8 @@ stages: CoverageReportPath: ${{ parameters.CoverageReportPath }} LineCoverageTarget: ${{ parameters.LineCoverageTarget }} BranchCoverageTarget: ${{ parameters.BranchCoverageTarget }} - # TODO: Uncomment before merge - # ${{ if eq(parameters.ServiceDirectory, 'template') }}: - # TestPipeline: true + ${{ if eq(parameters.ServiceDirectory, 'template') }}: + TestPipeline: true TestEnv: ${{ parameters.TestEnv }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(parameters.LiveTestCtestRegex, '')) }}: @@ -127,6 +126,5 @@ stages: - LiveTest_${{ cloud.key }} Artifacts: ${{ parameters.Artifacts }} ArtifactName: packages - # TODO: Enable before merge - # ${{ if eq(parameters.ServiceDirectory, 'template') }}: - # TestPipeline: true \ No newline at end of file + ${{ if eq(parameters.ServiceDirectory, 'template') }}: + TestPipeline: true \ No newline at end of file diff --git a/eng/pipelines/templates/steps/vcpkg-clone.yml b/eng/pipelines/templates/steps/vcpkg-clone.yml index b6f99b5315..b374bee15d 100644 --- a/eng/pipelines/templates/steps/vcpkg-clone.yml +++ b/eng/pipelines/templates/steps/vcpkg-clone.yml @@ -2,25 +2,21 @@ parameters: Workspace: $(Pipeline.Workspace) RepoOwner: not-set RepoName: vcpkg - # Default branch name for vcpkg at this time is still "master" - BaseBranchName: master PRBranchName: not-set steps: - pwsh: | - Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" --branch "${{ parameters.BaseBranchName }}" - git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} --branch "${{ parameters.BaseBranchName }}" + Write-Host "git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }}" + git clone https://github.com/${{ parameters.RepoOwner }}/${{ parameters.RepoName }} ${{ parameters.Workspace }}/${{ parameters.RepoName }} if ($LASTEXITCODE -ne 0) { Write-Error "Unable to check out vcpkg fork repo" exit $LASTEXITCODE } - Write-Host "Current branch: $(git branch --show-current)" displayName: Clone vcpkg (${{ parameters.RepoOwner }}/${{ parameters.RepoName }}) # Check out the PR branch if it's already in remote. Ignore failures. - pwsh: | $ErrorActionPreference = "Continue" - Write-Host 'git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null' git checkout "origin/${{ parameters.PRBranchName }}" 2>&1 | Out-Null $LASTEXITCODE = 0 # This ignores any error from git checkout git status From 1d98689c38b46f4f682d64c64bfcd433c1468b1c Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 15:57:53 -0700 Subject: [PATCH 27/29] More PR cleanup --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 4 +--- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- sdk/template/azure-template/CHANGELOG.md | 3 --- sdk/template/azure-template/src/private/package_version.hpp | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 5f17df5d21..38f4f1d492 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -144,7 +144,6 @@ stages: parameters: RepoOwner: Azure RepoName: azure-sdk-vcpkg-betas - BaseBranchName: main - template: /eng/pipelines/templates/steps/vcpkg-publish.yml parameters: @@ -178,18 +177,17 @@ stages: - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: - PushWorkingDirectoryChanges: false RepoOwner: $(VcpkgPrRepoOwner) RepoName: $(VcpkgPrRepoName) WorkingDirectory: $(Pipeline.Workspace)/vcpkg PrBranchName: $(PrBranchName) PRTitle: $(PrTitle) PRBody: Update vcpkg ports for Azure SDK release. This release may contain multiple ports. + SkipCheckingForChanges: true BaseBranchName: $(DefaultBranch) OpenAsDraft: ${{ parameters.TestPipeline }} PRLabels: "auto-merge" CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}' - SkipCheckingForChanges: true - pwsh: | $codeOwnersToNotify = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 ` diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 21a3d0f572..a9bc6a575c 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -127,4 +127,4 @@ stages: Artifacts: ${{ parameters.Artifacts }} ArtifactName: packages ${{ if eq(parameters.ServiceDirectory, 'template') }}: - TestPipeline: true \ No newline at end of file + TestPipeline: true diff --git a/sdk/template/azure-template/CHANGELOG.md b/sdk/template/azure-template/CHANGELOG.md index 123c655941..1b05d63a90 100644 --- a/sdk/template/azure-template/CHANGELOG.md +++ b/sdk/template/azure-template/CHANGELOG.md @@ -1,8 +1,5 @@ # Release History -## 1.1.0-beta.1 (2022-07-20) - -* Validate template project ahead of release ## 1.0.0 (2021-06-03) * Validate template project ahead of release diff --git a/sdk/template/azure-template/src/private/package_version.hpp b/sdk/template/azure-template/src/private/package_version.hpp index f93bd16bad..4d3ab24461 100644 --- a/sdk/template/azure-template/src/private/package_version.hpp +++ b/sdk/template/azure-template/src/private/package_version.hpp @@ -9,9 +9,9 @@ #pragma once #define AZURE_TEMPLATE_VERSION_MAJOR 1 -#define AZURE_TEMPLATE_VERSION_MINOR 1 +#define AZURE_TEMPLATE_VERSION_MINOR 0 #define AZURE_TEMPLATE_VERSION_PATCH 0 -#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.1" +#define AZURE_TEMPLATE_VERSION_PRERELEASE "" #define AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) #i #define AZURE_TEMPLATE_VERSION_ITOA(i) AZURE_TEMPLATE_VERSION_ITOA_HELPER(i) From 6d30f349ef32b6c0bf525e4f3c7d13416edf9bdb Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 20 Jul 2022 15:58:32 -0700 Subject: [PATCH 28/29] PR cleanup --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 38f4f1d492..068dc27c9c 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -175,6 +175,8 @@ stages: parameters: WorkingDirectory: $(Pipeline.Workspace)/vcpkg + # SkipCheckingForChanges is true to skip the commit step + # (which is already done by Update-VcpkgPort.ps1) - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: RepoOwner: $(VcpkgPrRepoOwner) From 540d806268525da81c4ed4d9aa16536f2bb3edf2 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 21 Jul 2022 10:54:05 -0700 Subject: [PATCH 29/29] displayName --- eng/pipelines/templates/stages/archetype-cpp-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 068dc27c9c..e4070400a6 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -169,7 +169,7 @@ stages: # based on the deicision of the step that determines # whether to publish to vcpkg. - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$(PublishToVcpkg)" - displayName: Set $(HasChanges) to $true for create-pull-request.yml + displayName: Set $(HasChanges) to $(PublishToVcpkg) for create-pull-request.yml - template: /eng/common/pipelines/templates/steps/set-default-branch.yml parameters: