Skip to content

Commit

Permalink
Use template for release pipelines (converted from classic) (#3945)
Browse files Browse the repository at this point in the history
* try to convert release pipeline to yaml

* ensure trigger

* fix variable expansion

* specify name specifically

* add release and fix powershell setup

* fix name

* uncomment vsce task

* only do release pipeline on release branch

* only allow rel branch for release

* enable trigger always, we can rely on manual verification
  • Loading branch information
gcampbell-msft authored Jul 30, 2024
1 parent ccd3f09 commit fa46827
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jobs/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resources:
repositories:
- repository: self
type: git
ref: refs/heads/main
ref: refs/heads/rel
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
Expand Down
68 changes: 68 additions & 0 deletions jobs/release/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ==================================================================================
# Release Pipeline for pre-release
# ==================================================================================

name: PrereleaseRelease-$(Date:yyyyMMdd).$(Rev:r)
trigger: none

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
pipelines:
- pipeline: BuildPrereleasePipeline
source: '\VC\VSCode\CMakeTools\vscode-cmake-tools - pre-release [YAML]'
trigger: true

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: VSEngSS-MicroBuild2022-1ES

stages:
- stage: release
jobs:
- job: release
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: artifactsDrop
pipeline: BuildPrereleasePipeline
artifactName: vsix

steps:
- powershell: |
$newVersion = Get-Content -Path build\vsix\version.txt
Write-Host "New version is: $newVersion"
$str = Get-Date -Format "yyMMdd-HHmm"
Write-Host "##vso[release.updatereleasename]$newVersion - $str"
ignoreLASTEXITCODE: true
displayName: 'Set the release name'
- task: NodeTool@0
displayName: 'Use Node 14.x'
inputs:
versionSpec: 14.x
- task: Npm@0
displayName: 'install vsce'
inputs:
arguments: '-g vsce'
- task: AzureCLI@2
displayName: 'Generate AAD_TOKEN'
inputs:
azureSubscription: '$(AzureSubscription)'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$aadToken = az account get-access-token --query accessToken --resource $(AzureGuid) -o tsv
Write-Host "##vso[task.setvariable variable=AAD_TOKEN;issecret=true]$aadToken"
- script: |
vsce publish --packagePath build\vsix\cmake-tools.vsix --pre-release
displayName: 'Publish the VSIX'
env:
VSCE_PAT: $(AAD_TOKEN)
75 changes: 75 additions & 0 deletions jobs/release/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ==================================================================================
# Release Pipeline for release
# ==================================================================================

name: OfficialRelease-$(Date:yyyyMMdd).$(Rev:r)
trigger: none

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
pipelines:
- pipeline: BuildReleasePipeline
source: '\VC\VSCode\CMakeTools\vscode-cmake-tools - release [YAML]'
trigger: true

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: VSEngSS-MicroBuild2022-1ES

stages:
- stage: release
jobs:
- job: release
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: artifactsDrop
pipeline: BuildReleasePipeline
artifactName: vsix

steps:
- powershell: |
$newVersion = Get-Content -Path build\vsix\version.txt
Write-Host "New version is: $newVersion"
$str = Get-Date -Format "yyMMdd-HHmm"
Write-Host "##vso[release.updatereleasename]$newVersion - $str"
ignoreLASTEXITCODE: true
displayName: 'Set the release name'
- task: ManualIntervention@8
displayName: 'Manual Intervention'
inputs:
instructions: |
Download and test the vsix from the latest release build: https://devdiv.visualstudio.com/DevDiv/_build?definitionId=17431
The version should match the name of this release.
- task: NodeTool@0
displayName: 'Use Node 14.x'
inputs:
versionSpec: 14.x
- task: Npm@0
displayName: 'install vsce'
inputs:
arguments: '-g vsce'
- task: AzureCLI@2
displayName: 'Generate AAD_TOKEN'
inputs:
azureSubscription: '$(AzureSubscription)'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$aadToken = az account get-access-token --query accessToken --resource $(AzureGuid) -o tsv
Write-Host "##vso[task.setvariable variable=AAD_TOKEN;issecret=true]$aadToken"
- script: |
vsce publish --packagePath build\vsix\cmake-tools.vsix
displayName: 'Publish the VSIX'
env:
VSCE_PAT: $(AAD_TOKEN)

0 comments on commit fa46827

Please sign in to comment.