Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Release Pipeline #176

Merged
merged 36 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
69e1c1d
Move to Node 20
aznhassan Oct 1, 2024
9b8f712
Update extension pipelines to sign manifest before publishing
aznhassan Oct 1, 2024
1767575
Sign before approval step
aznhassan Oct 1, 2024
a6f7e6d
Temporarily change release pipeline to preRelease
aznhassan Oct 2, 2024
e366d48
Install Dotnet SDK as prerequisite for signing plugins
aznhassan Oct 9, 2024
f053196
Extend 1es pipeline
aznhassan Oct 9, 2024
e4bddf4
Move template steps under parameters
aznhassan Oct 9, 2024
b1bfa13
Move variables outside of extends
aznhassan Oct 9, 2024
b02f56b
Move stage and jobs into build template
aznhassan Oct 9, 2024
08dba61
Move stage and job into sign template
aznhassan Oct 9, 2024
45d1e77
Change approval/publish steps to run as templates
aznhassan Oct 9, 2024
78d694d
Focus on just build step for now
aznhassan Oct 9, 2024
74af001
Use a 1ES hosted pool
aznhassan Oct 15, 2024
91a1133
Pass Node version as variable
aznhassan Oct 15, 2024
85a01b9
Use as well
aznhassan Oct 15, 2024
1473ecc
Go back to Node tool v0
aznhassan Oct 15, 2024
14e0084
Bring back signing steps
aznhassan Oct 15, 2024
e7f038a
Remove strategy section of deployment job
aznhassan Oct 16, 2024
f4d85ed
Try running publish stage without approval
aznhassan Oct 16, 2024
29e5640
Try moving approval stage out of template
aznhassan Oct 16, 2024
3f1706a
No dice, move it back with update
aznhassan Oct 17, 2024
7ca46a0
Just move on to manual approval
aznhassan Oct 17, 2024
9bf4730
Change release pipeline to use MicroBuild
aznhassan Oct 24, 2024
52e0fc8
Remove extra sign step, change sign type to real
aznhassan Oct 24, 2024
fcc99b7
Create variable for isPreRelease
aznhassan Oct 24, 2024
79411bf
Put isPrelease in a variable so we only define it once
aznhassan Oct 24, 2024
a7f91fa
Add preRelease option for release pipeline
aznhassan Oct 25, 2024
5dfe654
Change sign type to parameter
aznhassan Oct 28, 2024
e990c61
Change sign type parameter
aznhassan Oct 29, 2024
5c94232
Rename template folder to stages
aznhassan Oct 29, 2024
d9d8ab6
Install node again in sign stage
aznhassan Oct 30, 2024
b0f33f2
Remove sign type parameter
aznhassan Oct 30, 2024
2294104
Move sign back to step instead of stage
aznhassan Oct 30, 2024
0d6406e
Remove changes to prerelease pipeline
aznhassan Oct 30, 2024
37c3cab
Remove changes to workflow files
aznhassan Oct 30, 2024
66164f8
Update dev dependency to latest version
aznhassan Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 42 additions & 39 deletions .azure/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,51 @@ name: vscode-makecode Release
trigger: none
pr: none

pool:
vmImage: 'ubuntu-latest'
parameters:
- name: nodeVersion
type: string
default: '20.x'
- name: isPreRelease
type: boolean
default: false

resources:
repositories:
- repository: CustomPipelineTemplates
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate

variables:
- group: 'makecode-marketplace-pat'

stages:
# Stage to build the VSIX and publish it
- stage: Build
displayName: Build the VSIX
jobs:
- job: Build
steps:
- template: templates/build.yml
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@CustomPipelineTemplates
parameters:
pool:
name: AzurePipelines-EO
image: 1ESPT-Ubuntu22.04
os: linux
sdl:
sourceAnalysisPool:
name: AzurePipelines-EO
image: 1ESPT-Windows2022
stages:
# Stage to build the VSIX and publish it
- template: stages/build.yml
parameters:
isPreRelease: false

# Stage provides a manual approval step before the publish stage is run
- stage: Approval
displayName: Approve the release
jobs:
- deployment: ApproveRelease
displayName: "Approve Release"
environment: "makecode" # Defined in AzDO Pipeline environments
strategy:
runOnce:
deploy:
steps:
- checkout: none

# Publish the VSIX to the extension marketplace
- stage: Publish
displayName: Publish the VSIX
dependsOn:
- Build
- Approval
jobs:
- job: Publish
variables:
- name: vsixName
value: $[ stageDependencies.Build.Build.outputs['SetExtensionName.VSIX'] ]
steps:
- template: templates/publish.yml
isPreRelease: ${{ parameters.isPreRelease }}
nodeVersion: ${{ parameters.nodeVersion }}
signType: 'real'

# - template: stages/sign.yml
# parameters:
# signType: 'real'
# nodeVersion: ${{ parameters.nodeVersion }}

# Stage provides a manual approval step before the publish stage is run
- template: stages/approval.yml

# Publish the VSIX to the extension marketplace
- template: stages/publish.yml
parameters:
isPreRelease: false
isPreRelease: ${{ parameters.isPreRelease }}
15 changes: 15 additions & 0 deletions .azure/stages/approval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
stages:
- stage: Approval
displayName: Approve the release
dependsOn: Build
jobs:
- job: ApproveRelease
displayName: "Approve Release"
pool: server
timeoutInMinutes: 120
steps:
- task: ManualValidation@0
inputs:
notifyUsers: ''
instructions: 'Please approve the release before continuing'
onTimeout: 'reject'
52 changes: 52 additions & 0 deletions .azure/stages/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
parameters:
- name: isPreRelease
type: boolean
- name: nodeVersion
type: string
- name: signType
type: string

stages:
- stage: Build
displayName: Build the VSIX & sign it
jobs:
- job: Build
steps:
- checkout: self

- task: NodeTool@0
displayName: 🔨 Install Node.js
inputs:
versionSpec: ${{ parameters.nodeVersion }}

# Create a unique filename for the extension vsix to match the verison number
- bash: |
VSIX=$(node -p "require(\"./package.json\").publisher + \".\" + require(\"./package.json\").name + \".\" + require(\"./package.json\").version + \".vsix\"")
echo "##vso[task.setvariable variable=VSIX;isOutput=true]$VSIX"
name: SetExtensionName
displayName: Set VSIX file name

# Yarn package script to build the vsix file
- bash: |
echo "Compiling Production Webpack"
yarn && yarn package-web
echo "Compiled Production Webpack"
displayName: Compile

- ${{ if parameters.isPreRelease }}:
- script: npx @vscode/vsce@latest package -o $(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX) --pre-release
displayName: Package pre-release extension VSIX

- ${{ else }}:
- script: npx @vscode/vsce@latest package -o $(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX)
displayName: Package extension VSIX

- task: 1ES.PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX)
artifact: extension
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)

- template: ../steps/sign.yml
parameters:
signType: ${{ parameters.signType }}
43 changes: 43 additions & 0 deletions .azure/stages/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
parameters:
- name: isPreRelease
type: boolean

stages:
- stage: Publish
displayName: Publish the VSIX
dependsOn:
- Build
- Approval
jobs:
- job: Publish
variables:
- name: vsixName
value: $[ stageDependencies.Build.Build.outputs['SetExtensionName.VSIX'] ]
steps:
- download: current
artifact: extension
displayName: 🚚 Download extension artifact

- download: current
artifact: extension-manifest
displayName: 🚚 Download extension manifest artifact

- download: current
artifact: extension-signature
displayName: 🚚 Download extension signature artifact


- ${{ if parameters.isPreRelease }}:
- bash: echo "Publishing PreRelease"
- script: npx @vscode/vsce@latest publish --packagePath $(Pipeline.Workspace)/extension/$(vsixName) --manifestPath $(Pipeline.Workspace)/extension-manifest/$(vsixName).manifest --signaturePath $(Pipeline.Workspace)/extension-signature/$(vsixName).signature.p7s --pre-release
displayName: Publish pre-release extension
env:
# Marketplace PAT needs to be uploaded as a pipeline variable
VSCE_PAT: $(marketplace-pat)

- ${{ else }}:
- bash: echo "Publishing Release"
- script: npx @vscode/vsce@latest publish --packagePath $(Pipeline.Workspace)/extension/$(vsixName) --manifestPath $(Pipeline.Workspace)/extension-manifest/$(vsixName).manifest --signaturePath $(Pipeline.Workspace)/extension-signature/$(vsixName).signature.p7s
displayName: Publish extension
env:
VSCE_PAT: $(marketplace-pat)
74 changes: 74 additions & 0 deletions .azure/steps/sign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
parameters:
- name: signType
type: string

steps:
- task: UseDotNet@2
displayName: "Install dotnet SDK"
inputs:
packageType: "sdk"
version: "6.0.x"

# Need this to run signing plugins
- task: UseDotNet@2
displayName: "Install dotnet 3.1.0 SDK"
inputs:
packageType: "sdk"
version: "3.1.x"

- task: NuGetAuthenticate@0
- task: MicroBuildSigningPlugin@4
displayName: "Install Signing Plugin"
inputs:
signType: ${{ parameters.signType }}
azureSubscription: "MicroBuild Signing Task (DevDiv)"
feedSource: "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json"
env:
TeamName: "$(TeamName)"

- script: npx @vscode/vsce@latest generate-manifest -i $(SetExtensionName.VSIX) -o $(SetExtensionName.VSIX).manifest
displayName: 'Generate extension manifest'
workingDirectory: $(Build.ArtifactStagingDirectory)

- script: cp $(SetExtensionName.VSIX).manifest $(SetExtensionName.VSIX).signature.p7s
displayName: 'Prepare manifest for signing'
workingDirectory: $(Build.ArtifactStagingDirectory)

- script: |
cat <<EOT >> signfilelist-extension.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file is used by the public release pipelines to specify the files to be signed and the certificate to be used.
For the cert number used, see https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/658/Signing-Cert-Guidance
-->
<filelist>
<certificate certnumbers="4014052">
<file srcpath="$(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX).signature.p7s"></file>
</certificate>
</filelist>
EOT
displayName: "Create the signfilelist"

# Sign Files
- powershell: |
dotnet (get-item $(Build.ArtifactStagingDirectory)/MicroBuild/Plugins/MicroBuild.Plugins.Signing.*/build/DDSignFiles.dll).FullName -- /filelist:signfilelist-extension.xml
displayName: "Sign VSIX"

# Clean up MicroBuild
- task: MicroBuildCleanup@1

- powershell: |
Remove-Item -Recurse -Force $(Build.ArtifactStagingDirectory)/MicroBuild
displayName: "Clean up MicroBuild folder"

- task: 1ES.PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX).manifest
artifact: extension-manifest
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)

- task: 1ES.PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)/$(SetExtensionName.VSIX).signature.p7s
artifact: extension-signature
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)
38 changes: 0 additions & 38 deletions .azure/templates/build.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .azure/templates/publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@vscode/l10n-dev": "^0.0.22",
"@vscode/test-web": "^0.0.30",
"@vscode/test-web": "^0.0.63",
"assert": "^2.0.0",
"eslint": "^8.24.0",
"mocha": "^10.0.0",
Expand Down
Loading