From 614499aa2ff2de5db2c3d425df6966a3af2e2a05 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:45:03 -0500 Subject: [PATCH] azure-pipelines: Add templateContext to extension release pipeline (#1864) --- azure-pipelines/README.md | 15 +++++----- azure-pipelines/release-extension.yml | 43 ++++++++++----------------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/azure-pipelines/README.md b/azure-pipelines/README.md index b020045609..f6e3bd6514 100644 --- a/azure-pipelines/README.md +++ b/azure-pipelines/README.md @@ -151,7 +151,7 @@ parameters: resources: pipelines: - - pipeline: build + - pipeline: build # This *must* be exactly "build" source: \Azure Tools\VSCode\Extensions\vscode-azurecontainerapps # CUSTOMIZE - location of the pipeline that produces the artifacts repositories: - repository: azExtTemplates @@ -169,8 +169,6 @@ variables: extends: template: azure-pipelines/release-extension.yml@azExtTemplates parameters: - pipelineID: $(resources.pipeline.build.pipelineID) - runID: $(resources.pipeline.build.runID) publishVersion: ${{ parameters.publishVersion }} dryRun: ${{ parameters.dryRun }} environmentName: AzCodeDeploy # CUSTOMIZE @@ -179,13 +177,14 @@ extends: The extension release pipeline has the following parameters. ```yaml -# pipelineID and runID are used to download the artifacts from a specific build pipeline -- name: pipelineID +- name: pipelineID # No longer used type: string -- name: runID + default: unused +- name: runID # No longer used type: string + default: unused -# Customize the environment to associate the deployment with. +# Customize the environment to associate the deployment with. # Useful to control which group of people should be required to approve the deployment. - name: environmentName type: string @@ -193,7 +192,7 @@ The extension release pipeline has the following parameters. # The following parameters are meant to be provded by the user when initiating a pipeline run -# The intended extension version to publish. +# The intended extension version to publish. # This is used to verify the version in package.json matches the version to publish to avoid accidental publishing. - name: publishVersion type: string diff --git a/azure-pipelines/release-extension.yml b/azure-pipelines/release-extension.yml index 24b888f0bc..0e6a42ce09 100644 --- a/azure-pipelines/release-extension.yml +++ b/azure-pipelines/release-extension.yml @@ -1,9 +1,10 @@ parameters: - # pipelineID and runID are used to download the artifacts from a specific build pipeline - - name: pipelineID + - name: pipelineID # No longer used but kept to avoid needing to change the downstream templates type: string - - name: runID + default: unused + - name: runID # No longer used but kept to avoid needing to change the downstream templates type: string + default: unused # The intended extension version to publish. # This is used to verify the version in package.json matches the version to publish to avoid accidental publishing. @@ -32,16 +33,6 @@ resources: extends: template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines parameters: - sdl: - tsa: - enabled: true - configFile: '$(Build.SourcesDirectory)\.azure-pipelines\compliance\tsaoptions.json' - suppression: - suppressionFile: $(Build.SourcesDirectory)\.config\guardian\.gdnsuppress - credscan: - suppressionsFile: $(Build.SourcesDirectory)\.azure-pipelines\compliance\CredScanSuppressions.json - codeql: - enabled: false pool: name: VSEngSS-MicroBuild2022-1ES # Name of your hosted pool image: server2022-microbuildVS2022-1es # Name of the image in your pool. If not specified, first image of the pool is used @@ -54,30 +45,26 @@ extends: - deployment: Publish displayName: Publish extension environment: ${{ parameters.environmentName }} + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + pipeline: build + targetPath: $(System.DefaultWorkingDirectory) + artifactName: Build Root strategy: runOnce: deploy: steps: - - download: none - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: "\U0001F449 Download artifacts from Build pipeline" - inputs: - source: specific # download from a specific pipelines run - project: DevDiv - definition: ${{ parameters.pipelineID }} - buildVersionToDownload: specific - runId: ${{ parameters.runID }} - artifact: Build Root - targetPath: $(System.DefaultWorkingDirectory) - # Modify the build number to include repo name, extension version, and if dry run is true - powershell: | # Get the version from package.json - $packageJsonPath = "$(Build.SourcesDirectory)/package.json" + $packageJsonPath = "$(System.DefaultWorkingDirectory)/package.json" $npmVersionString = (Get-Content $packageJsonPath | ConvertFrom-Json).version $isDryRun = "$env:dryRun" $currentBuildNumber = "$(Build.BuildId)" @@ -102,7 +89,7 @@ extends: # If they don't match, this step fails - powershell: | # Get the version from package.json - $packageJsonPath = "$(Build.SourcesDirectory)/package.json" + $packageJsonPath = "$(System.DefaultWorkingDirectory)/package.json" $npmVersionString = (Get-Content $packageJsonPath | ConvertFrom-Json).version $publishVersion = "$env:publishVersion" Write-Output "Publishing version: $publishVersion" @@ -121,7 +108,7 @@ extends: # Fails with an error if more than one .vsix file is found, or if no .vsix file is found - powershell: | # Get all .vsix files in the current directory - $vsixFiles = Get-ChildItem -Path $(Build.SourcesDirectory) -Filter *.vsix -File + $vsixFiles = Get-ChildItem -Path $(System.DefaultWorkingDirectory) -Filter *.vsix -File # Check if more than one .vsix file is found if ($vsixFiles.Count -gt 1) {