Skip to content

Commit

Permalink
pipelines: Make the NPM release be a 1ES pipeline (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Mar 27, 2024
1 parent c43ca16 commit bb5c26c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resources:

# Use those base templates
extends:
template: azure-pipelines/release-npm.yml@templates
template: azure-pipelines/1es-release-npm.yml@templates
parameters:
PackageToPublish: ${{ parameters.PackageToPublish }}
BranchToPublish: ${{ parameters.BranchToPublish }}
Expand Down
95 changes: 95 additions & 0 deletions azure-pipelines/1es-release-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
parameters:
- name: PackageToPublish
displayName: Package to Publish
type: string
- name: BranchToPublish
displayName: Branch to Publish
type: string
- name: PipelineDefinition
displayName: Pipeline Definition
type: number
- name: OwnerAlias
displayName: Owner Alias
type: string
- name: ApproverAlias
displayName: Approver Alias
type: string

# `resources` specifies the location of templates to pick up, use it to get 1ES templates
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
- repository: MicroBuildTemplate
type: git
name: MicroBuildTemplates/MicroBuildTemplates
ref: refs/heads/release

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
sdl:
credscan:
suppressionsFile: $(Build.SourcesDirectory)\.azure-pipelines\compliance\CredScanSuppressions.json
sourceAnalysisPool:
name: AzurePipelines-EO
image: 1ESPT-Windows2022
# codeql:
# enabled: true # TODO: would like to enable only on scheduled builds but CodeQL cannot currently be disabled per https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/codeql/1es-codeql
pool:
name: AzurePipelines-EO # Name of your hosted pool
image: 1ESPT-Ubuntu20.04 # Name of the image in your pool. If not specified, first image of the pool is used
os: linux # OS of the image. Allowed values: windows, linux, macOS
stages:
- stage: ReleaseStage
jobs:
- job: ReleaseJob
steps:
- task: DownloadPipelineArtifact@2
displayName: "\U0001F449 Download Artifact"
inputs:
buildType: "specific"
project: "DevDiv"
definition: ${{ parameters.PipelineDefinition }}
buildVersionToDownload: "latestFromBranch"
branchName: ${{ parameters.BranchToPublish }}
targetPath: $(System.DefaultWorkingDirectory)
itemPattern: "**/*.tgz"
- task: CmdLine@2
displayName: "\U0001F449 Validate Artifact"
inputs:
script: |
TarballPath=`find . -type f -iname "${{ parameters.PackageToPublish }}*.tgz"`
if [[ $TarballPath =~ ((microsoft|vscode)-.*)-([0-9]+\.[0-9]+\.[0-9]+) ]]; then
echo "##vso[task.setvariable variable=Version]${BASH_REMATCH[3]}"
echo "##vso[task.setvariable variable=TarballPath]$TarballPath"
echo "##vso[task.setvariable variable=TarballFolder]$(dirname "$TarballPath")"
echo "Found tarball \"$(basename "$TarballPath")\" in folder \"$(dirname "$TarballPath")\""
else
echo "Failed to parse tarball path \"$TarballPath\""
exit 1
fi
workingDirectory: $(System.DefaultWorkingDirectory)
- template: azure-pipelines/MicroBuild.Publish.yml@MicroBuildTemplate
parameters:
intent: "PackageDistribution"
contentType: "npm"
contentSource: "Folder"
folderLocation: "$(System.DefaultWorkingDirectory)/$(TarballFolder)"
waitForReleaseCompletion: true
owners: "${{ parameters.OwnerAlias }}@microsoft.com"
approvers: "${{ parameters.ApproverAlias }}@microsoft.com"
- task: GitHubRelease@1
displayName: "\U0001F449 GitHub release (create)"
inputs:
gitHubConnection: "GitHub-AzureTools"
tagSource: userSpecifiedTag
tag: "${{ parameters.PackageToPublish }}-v$(Version)"
title: "${{ parameters.PackageToPublish }} v$(Version)"
releaseNotesSource: inline
assets: "$(System.DefaultWorkingDirectory)/$(TarballPath)"
isDraft: true
isPreRelease: true
addChangeLog: false
78 changes: 0 additions & 78 deletions azure-pipelines/release-npm.yml

This file was deleted.

4 changes: 2 additions & 2 deletions eslint-config-azuretools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eslint-config-azuretools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/eslint-config-azuretools",
"version": "0.2.3",
"version": "0.2.4",
"description": "Shared ESLint configuration used by Azure Tools for VS Code",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit bb5c26c

Please sign in to comment.