From 84a7f56682939c73097ddd26bac6346b3c674b0b Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu <31145988+chidozieononiwu@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:36:03 -0700 Subject: [PATCH] Call eng/common/scripts/SetTestPipelineVersion.ps1 (#14138) * Call eng/common/scripts/SetTestPipelineVersion.ps1 * call set-test-pipeline-version.yml instead * Remove unreleased entries from CHANGELOG.md * Remove unreleased entries from CHANGELOG.md * Add set-test-pipeine-version.yml to analyze stage --- .../templates/jobs/archetype-sdk-client.yml | 1 + .../templates/stages/archetype-js-release.yml | 14 +++---- eng/pipelines/templates/steps/analyze.yml | 7 ++++ eng/pipelines/templates/steps/build.yml | 14 +++---- eng/scripts/SetTestPipelineVersion.ps1 | 39 ------------------- sdk/template/template/CHANGELOG.md | 6 --- 6 files changed, 18 insertions(+), 63 deletions(-) delete mode 100644 eng/scripts/SetTestPipelineVersion.ps1 diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index df5f2c295e5b..9f4ee19bcc74 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -84,6 +84,7 @@ jobs: parameters: Artifacts: ${{ parameters.Artifacts }} ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestPipeline: ${{ parameters.TestPipeline }} # Only run tests if the matrix has entries - ${{ if ne(parameters.RunUnitTests, false) }}: diff --git a/eng/pipelines/templates/stages/archetype-js-release.yml b/eng/pipelines/templates/stages/archetype-js-release.yml index a8604ebeea15..58b9860d3114 100644 --- a/eng/pipelines/templates/stages/archetype-js-release.yml +++ b/eng/pipelines/templates/stages/archetype-js-release.yml @@ -32,15 +32,11 @@ stages: deploy: steps: - checkout: self - - ${{if eq(parameters.TestPipeline, 'true')}}: - - task: PowerShell@2 - displayName: Prep template pipeline for release - condition: succeeded() - inputs: - pwsh: true - workingDirectory: $(Build.SourcesDirectory) - filePath: eng/scripts/SetTestPipelineVersion.ps1 - arguments: '-BuildID $(Build.BuildId)' + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "@azure/template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} - template: /eng/common/pipelines/templates/steps/verify-changelog.yml parameters: PackageName: ${{artifact.name}} diff --git a/eng/pipelines/templates/steps/analyze.yml b/eng/pipelines/templates/steps/analyze.yml index 6e188f962672..c08fcbe6600d 100644 --- a/eng/pipelines/templates/steps/analyze.yml +++ b/eng/pipelines/templates/steps/analyze.yml @@ -1,8 +1,15 @@ parameters: Artifacts: [] ServiceDirectory: not-specified + TestPipeline: false steps: + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "@azure/template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} + - task: PublishPipelineArtifact@1 condition: succeededOrFailed() displayName: "Publish Report Artifacts" diff --git a/eng/pipelines/templates/steps/build.yml b/eng/pipelines/templates/steps/build.yml index d833540f7303..477c02375916 100644 --- a/eng/pipelines/templates/steps/build.yml +++ b/eng/pipelines/templates/steps/build.yml @@ -4,15 +4,11 @@ parameters: ServiceDirectory: not-specified steps: - - ${{if eq(parameters.TestPipeline, 'true')}}: - - task: PowerShell@2 - displayName: Prep template pipeline for release - condition: succeeded() - inputs: - pwsh: true - workingDirectory: $(Build.SourcesDirectory) - filePath: eng/scripts/SetTestPipelineVersion.ps1 - arguments: '-BuildID $(Build.BuildId)' + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "@azure/template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} - pwsh: | $folder = "${{parameters.ServiceDirectory}}" diff --git a/eng/scripts/SetTestPipelineVersion.ps1 b/eng/scripts/SetTestPipelineVersion.ps1 deleted file mode 100644 index 9a36861780be..000000000000 --- a/eng/scripts/SetTestPipelineVersion.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# Overides the project file and CHANGELOG.md for the template project. -# This is to help with testing the release pipeline. - -param ( - [Parameter(mandatory = $true)] - $BuildID -) - -. "${PSScriptRoot}\..\common\scripts\common.ps1" -$latestTags = git tag -l "@azure/template_*" -$semVars = @() - -$packageDirectory = "${PSScriptRoot}\..\..\sdk\template\template" -$templatePackageFile = "${packageDirectory}\package.json" -$changeLogFile = "${packageDirectory}\CHANGELOG.md" - -Foreach ($tags in $latestTags) -{ - $semVars += $tags.Replace("@azure/template_", "") -} - -$semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars) -LogDebug "Last Published Version $($semVarsSorted[0])" - -$newVersion = [AzureEngSemanticVersion]::ParseVersionString($semVarsSorted[0]) -$newVersion.PrereleaseLabel = "beta" -$newVersion.PrereleaseNumber = $BuildID - -$packageFileContent = Get-Content -Path $templatePackageFile | ConvertFrom-Json -LogDebug "Version in Source $($packageFileContent.version)" -$packageFileContent.version = $newVersion.ToString() -LogDebug "Version to publish $($packageFileContent.version)" - -Set-Content -Path $templatePackageFile -Value ($packageFileContent | ConvertTo-Json) -Set-Content -Path $changeLogFile -Value @" -# Release History -## $($newVersion.ToString()) ($(Get-Date -f "yyyy-MM-dd")) -- Test Release Pipeline -"@ diff --git a/sdk/template/template/CHANGELOG.md b/sdk/template/template/CHANGELOG.md index 6a7473963bfe..d8b8443cb988 100644 --- a/sdk/template/template/CHANGELOG.md +++ b/sdk/template/template/CHANGELOG.md @@ -1,9 +1,5 @@ # Release History -## 1.0.11-beta.1 (Unreleased) - -- Restructured the template package to use the Client SDK developer training materials. - ## 1.0.10-beta.1 (2020-11-16) - Test Release Pipeline @@ -24,8 +20,6 @@ - Testing prerelease versioning changes -## 1.0.8 (Unreleased) - ## 1.0.7 (2020-04-01) ## 1.0.6 (2020-03-26)