Skip to content

Commit b999980

Browse files
bschnurrCopilot
andauthored
**Add Multi-Platform Build and Signing Support for VS Code Python Debugger Extension** (#927)
* add custom feeds * add back loc and telemetry files * try disable pipauth * Switched the install_bundled_libs nox session to fetch debugpy via pip download + wheel extraction, instead of urllib.request.urlopen() against the pinned URLs in debugpy_info.json. This makes the download respect your pip configuration (proxy, internal index/mirror, certs) and avoids hard-coded files.pythonhosted.org URLs. Added _infer_debugpy_version() so the build can still determine which debugpy==... to download: uses DEBUGPY_VERSION if set, otherwise parses the version out of debugpy_info.json (so you don’t have to change version management right now). Added download_debugpy_via_pip() which downloads the appropriate wheels for the target: If VSCETARGET is win32-x64, linux-x64, or darwin*, it downloads cp310/cp311/cp312 wheels for that platform (same intent as the old JSON approach). If VSCETARGET is missing/unknown, it downloads the universal none-any wheel via a valid pip “target tag” (--python-version 39 --implementation cp --abi none --platform any). Verified locally: python -m nox --session install_bundled_libs now succeeds (after fixing the fallback pip arguments). * updat vsce * modify how we download debugpy from pip * use pip by default * first attempt at platforms * fix path to setup.yml * update pools * update pool windows * mac pool rename * update windows image * add build vsix * copy vsix to drop folder * update creating vsix name * copy vsix * update drop folder * try to sign per platform * npm install for sign * check manifest * simplify manifest * upate stable with multiplatform sign * multiplatform publish * Refactor publish pipeline with multi-platform support and manual validation - Add publish-extension.yml template with Sign, WaitForValidation, and Publish jobs - Add createGitHubRelease.yml template for GitHub release creation - Update publish.yml to iterate over buildPlatforms and publish each platform - Rename artifact folder from 'drop' to 'extension' - Rename pipeline stage from 'Sign' to 'Publish' - Add manual validation gate before marketplace publishing (default enabled) - Download platform-specific artifacts (vsix-universal, vsix-linux-arm64, etc.) - Extract version from VSIX filename for GitHub release tagging * try to fix download * create github release * rename GitHubRelease * read publisher and version from package.json * disable stabel release on tag * try to get version and publisher from extracted vsix data * dont publish to github if not publishing * update extracting files and folders. Using "Multi-Replace String in Files" ``` ``` Done. Updated folder usage is now: | Folder | Purpose | |--------|---------| | `$(Build.BinariesDirectory)/vsix-*` | Downloaded VSIX inputs | | `$(Agent.TempDirectory)/vsix-extracted` | Temporary extraction for reading version | | `$(Build.StagingDirectory)\extension` | Signing working directory & output artifact | | `$(Build.ArtifactStagingDirectory)` | Reserved for final artifact staging (Publish job) | Made changes. * Updates extension version in package.json using the Azure DevOps build number. * make sure we get version from package.json * fix job name * add 'releaseJob' * move github release to release job with no outputs. * remove old releaseJob tag * use 1ES.DownloadPipelineArtifact@1 * use DownloadPipelineArtifact in non release jobs * fix extract path * use general pool for publish * fix spacing * trun on publish to marketplace * fix linting and lint check quotes * fix import re * add back vsce-package * fix missing vsce-package * re-format * move loc files and temeletry to separate pre-built folder so we dont break old pipeline * publish job needs npm feed * add missing .npmrc file using checkout * add .npmrc file if one doesn't exist * uncomment vsce publish * Update build/templates/package.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * disable publish once more * fix pretteier * re-enable vsce publish --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 51a9602 commit b999980

30 files changed

+4711
-1169
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ node_modules
88
bundled/libs/
99
**/__pycache__
1010
**/.pytest_cache
11-
**/.vs
11+
**/.vs
12+
13+
# Generated files (sources live in pre-built/)
14+
l10n/bundle.l10n.*.json
15+
package.nls.*.json
16+
telemetry.json

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build/**
44
out/**
55
node_modules/**
66
src/**
7+
pre-built/**
78
.gitignore
89
.yarnrc
910
webpack.config.js

build/NuGet.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<config>
4+
<add key="repositoryPath" value="NuGetPackages" />
5+
</config>
6+
<packageSources>
7+
<!-- Limit to one feed per 1ES guidance -->
8+
<clear />
9+
<add key="VS-CoreXtFeeds" value="https://pkgs.dev.azure.com/devdiv/_packaging/VS-CoreXtFeeds/nuget/v3/index.json" protocolVersion="3" />
10+
</packageSources>
11+
</configuration>

build/azure-devdiv-pipeline.pre-release.yml

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,60 @@ parameters:
2929
type: boolean
3030
default: false
3131

32+
- name: buildPlatforms
33+
type: object
34+
default:
35+
- name: Linux
36+
vsceTarget: ''
37+
- name: Linux
38+
packageArch: arm64
39+
vsceTarget: linux-arm64
40+
- name: Linux
41+
packageArch: arm
42+
vsceTarget: linux-armhf
43+
- name: Linux
44+
packageArch: x64
45+
vsceTarget: linux-x64
46+
- name: MacOS
47+
packageArch: arm64
48+
vsceTarget: darwin-arm64
49+
- name: MacOS
50+
packageArch: x64
51+
vsceTarget: darwin-x64
52+
- name: Windows
53+
packageArch: arm
54+
vsceTarget: win32-arm64
55+
- name: Windows
56+
packageArch: x64
57+
vsceTarget: win32-x64
58+
59+
- name: buildSteps
60+
type: stepList
61+
default:
62+
- script: npm ci
63+
displayName: Install NPM dependencies
64+
65+
- script: python -m pip install -U pip
66+
displayName: Upgrade pip
67+
68+
- script: python -m pip install wheel
69+
displayName: Install wheel
70+
71+
- script: python -m pip install nox
72+
displayName: Install nox
73+
74+
- script: python -m nox --session install_bundled_libs
75+
displayName: Install Python dependencies
76+
77+
- script: python ./build/update_ext_version.py --for-publishing
78+
displayName: Update build number
79+
80+
- pwsh: Copy-Item -Path "pre-built/*" -Destination "." -Recurse -Force
81+
displayName: Copy pre-built files
82+
83+
- script: npm run package
84+
displayName: Build extension
85+
3286
extends:
3387
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
3488
parameters:
@@ -48,78 +102,23 @@ extends:
48102
- stage: Build
49103
displayName: Build & Package Extension
50104
jobs:
51-
- job: Build
52-
displayName: Build Job
53-
pool:
54-
name: VSEngSS-MicroBuild2022-1ES # use windows for codesigning to make things easier https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/650/MicroBuild-Signing
55-
os: windows
56-
templateContext:
57-
mb:
58-
signing:
59-
enabled: true
60-
signType: real
61-
signWithProd: true
62-
outputs:
63-
- output: pipelineArtifact
64-
displayName: 'Publish Drop Artifact'
65-
targetPath: '$(Build.StagingDirectory)\drop'
66-
artifactName: drop
67-
sbomEnabled: true
68-
steps:
69-
- task: npmAuthenticate@0
70-
inputs:
71-
workingFile: .npmrc
72-
73-
- script: npm config get registry
74-
displayName: Verify NPM Registry
75-
76-
- task: NodeTool@0
77-
inputs:
78-
versionSpec: '22.x'
79-
checkLatest: true
80-
displayName: Select Node 22 LTS
81-
82-
- task: UsePythonVersion@0
83-
inputs:
84-
versionSpec: '3.9' # note Install Python dependencies step below relies on Python 3.9
85-
addToPath: true
86-
architecture: 'x64'
87-
displayName: Select Python version
88-
89-
- script: npm ci
90-
displayName: Install NPM dependencies
91-
92-
- script: python -m pip install -U pip
93-
displayName: Upgrade pip
94-
95-
- script: python -m pip install wheel
96-
displayName: Install wheel
97-
98-
- script: python -m pip install nox
99-
displayName: Install nox
100-
101-
- script: python -m nox --session install_bundled_libs
102-
displayName: Install Python dependencies
103-
104-
- script: python ./build/update_ext_version.py --for-publishing
105-
displayName: Update build number
106-
107-
- script: npm run vsce-package-pre
108-
displayName: Build VSIX
109-
110-
- template: build/templates/sign.yml@self
111-
parameters:
112-
vsixName: $(VsixName)
113-
workingDirectory: $(Build.StagingDirectory)\drop
114-
signType: real
115-
verifySignature: true
116-
117-
- ${{ if eq(parameters.publishExtension, true) }}:
118-
- template: build/templates/publish.yml@self
119-
parameters:
120-
azureSubscription: PylancePublishPipelineSecureConnectionWithManagedIdentity
121-
vsixName: $(VsixName)
122-
manifestName: extension.manifest
123-
signatureName: extension.signature.p7s
124-
publishFolder: drop
125-
preRelease: true
105+
- template: build/templates/package.yml@self
106+
parameters:
107+
buildPlatforms: ${{ parameters.buildPlatforms }}
108+
buildSteps: ${{ parameters.buildSteps }}
109+
isPreRelease: true
110+
standardizedVersioning: true
111+
112+
- stage: Publish
113+
displayName: Publish Extension
114+
dependsOn: Build
115+
jobs:
116+
- template: build/templates/publish-extension.yml@self
117+
parameters:
118+
buildPlatforms: ${{ parameters.buildPlatforms }}
119+
publishExtension: ${{ parameters.publishExtension }}
120+
preRelease: true
121+
teamName: $(TeamName)
122+
ghCreateTag: true
123+
ghCreateRelease: true
124+
ghReleaseAddChangeLog: true
Lines changed: 78 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Publish Release
2-
trigger:
3-
branches:
4-
include:
5-
- refs/tags/*
2+
trigger: none
3+
# branches:
4+
# include:
5+
# - release*
6+
# tags:
7+
# include: ['*']
8+
pr: none
69

710
resources:
811
repositories:
@@ -15,13 +18,69 @@ variables:
1518
value: VSCode-python-debugger
1619
- name: VsixName
1720
value: python-debugger.vsix
21+
- name: AZURE_ARTIFACTS_FEED
22+
value: 'https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/Pylance_PublicPackages/npm/registry/'
1823

1924
parameters:
2025
- name: publishExtension
2126
displayName: 🚀 Publish Extension
2227
type: boolean
2328
default: false
2429

30+
- name: buildPlatforms
31+
type: object
32+
default:
33+
- name: Linux
34+
vsceTarget: ''
35+
- name: Linux
36+
packageArch: arm64
37+
vsceTarget: linux-arm64
38+
- name: Linux
39+
packageArch: arm
40+
vsceTarget: linux-armhf
41+
- name: Linux
42+
packageArch: x64
43+
vsceTarget: linux-x64
44+
- name: MacOS
45+
packageArch: arm64
46+
vsceTarget: darwin-arm64
47+
- name: MacOS
48+
packageArch: x64
49+
vsceTarget: darwin-x64
50+
- name: Windows
51+
packageArch: arm
52+
vsceTarget: win32-arm64
53+
- name: Windows
54+
packageArch: x64
55+
vsceTarget: win32-x64
56+
57+
- name: buildSteps
58+
type: stepList
59+
default:
60+
- script: npm ci
61+
displayName: Install NPM dependencies
62+
63+
- script: python -m pip install -U pip
64+
displayName: Upgrade pip
65+
66+
- script: python -m pip install wheel
67+
displayName: Install wheel
68+
69+
- script: python -m pip install nox
70+
displayName: Install nox
71+
72+
- script: python -m nox --session install_bundled_libs
73+
displayName: Install Python dependencies
74+
75+
- script: python ./build/update_ext_version.py --release --for-publishing
76+
displayName: Update build number
77+
78+
- pwsh: Copy-Item -Path "pre-built/*" -Destination "." -Recurse -Force
79+
displayName: Copy pre-built files
80+
81+
- script: npm run package
82+
displayName: Build extension
83+
2584
extends:
2685
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
2786
parameters:
@@ -41,70 +100,19 @@ extends:
41100
- stage: Build
42101
displayName: Build & Package Extension
43102
jobs:
44-
- job: Build
45-
displayName: Build Job
46-
pool:
47-
name: VSEngSS-MicroBuild2022-1ES # use windows for codesigning to make things easier https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/650/MicroBuild-Signing
48-
os: windows
49-
templateContext:
50-
mb:
51-
signing:
52-
enabled: true
53-
signType: real
54-
signWithProd: true
55-
outputs:
56-
- output: pipelineArtifact
57-
displayName: 'Publish Drop Artifact'
58-
targetPath: '$(Build.StagingDirectory)\drop'
59-
artifactName: drop
60-
sbomEnabled: true
61-
steps:
62-
- task: NodeTool@0
63-
inputs:
64-
versionSpec: '22.x'
65-
checkLatest: true
66-
displayName: Select Node 22 LTS
67-
- task: UsePythonVersion@0
68-
inputs:
69-
versionSpec: '3.9' # note Install Python dependencies step below relies on Python 3.9
70-
addToPath: true
71-
architecture: 'x64'
72-
displayName: Select Python version
103+
- template: build/templates/package.yml@self
104+
parameters:
105+
buildPlatforms: ${{ parameters.buildPlatforms }}
106+
buildSteps: ${{ parameters.buildSteps }}
107+
isPreRelease: false
73108

74-
- script: npm ci
75-
displayName: Install NPM dependencies
76-
77-
- script: python -m pip install -U pip
78-
displayName: Upgrade pip
79-
80-
- script: python -m pip install wheel
81-
displayName: Install wheel
82-
83-
- script: python -m pip install nox
84-
displayName: Install nox
85-
86-
- script: python -m nox --session install_bundled_libs
87-
displayName: Install Python dependencies
88-
89-
- script: python ./build/update_ext_version.py --release --for-publishing
90-
displayName: Update build number
91-
92-
- script: npm run vsce-package
93-
displayName: Build VSIX
94-
95-
- template: build/templates/sign.yml@self
96-
parameters:
97-
vsixName: $(VsixName)
98-
workingDirectory: $(Build.StagingDirectory)\drop
99-
signType: real
100-
verifySignature: true
101-
102-
- ${{ if eq(parameters.publishExtension, true) }}:
103-
- template: build/templates/publish.yml@self
104-
parameters:
105-
azureSubscription: PylancePublishPipelineSecureConnectionWithManagedIdentity
106-
vsixName: $(VsixName)
107-
manifestName: extension.manifest
108-
signatureName: extension.signature.p7s
109-
publishFolder: drop
110-
preRelease: false
109+
- stage: Publish
110+
displayName: Publish Extension
111+
dependsOn: Build
112+
jobs:
113+
- template: build/templates/publish-extension.yml@self
114+
parameters:
115+
buildPlatforms: ${{ parameters.buildPlatforms }}
116+
publishExtension: ${{ parameters.publishExtension }}
117+
preRelease: false
118+
teamName: $(TeamName)

0 commit comments

Comments
 (0)