Skip to content

Commit 269cf5a

Browse files
committed
Migrate to Deployment Model
The timed task will cause the pipeline to fail. It may have a 'resume' feature we can check to see if it actually failed or not, but there is no way to pause the next task and 'pass' that 'resume' onto the next step, because the timed task is using a 'serverless' pool. This method is more complicated but a better e2e approach. This commit removes the line which does the publish so I can test that the deployment 'gate' in the environment actually works.
1 parent 654d6cb commit 269cf5a

File tree

2 files changed

+100
-51
lines changed

2 files changed

+100
-51
lines changed

pipeline-templates/package-vsix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- output: pipelineArtifact
1818
displayName: '📂 Publish .VSIX'
1919
targetPath: '$(Build.ArtifactStagingDirectory)'
20-
artifactName: '$(dir-name)'
20+
artifactName: vscode-dotnet-install-tool
2121
steps:
2222
- template: install-node.yaml
2323
- bash: |

pipeline-templates/publish.yaml

Lines changed: 99 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,108 @@ parameters:
44
useOneEngineeringPool: ''
55

66
jobs:
7-
- job: waitForValidation
8-
displayName: ☁️ Wait for release approval
9-
pool: server
10-
timeoutInMinutes: 4320 # job times out in 3 days
11-
steps:
12-
- task: ManualValidation@0
13-
timeoutInMinutes: 4320
7+
- deployment: PublishToMarketplace
8+
templateContext:
9+
type: releaseJob
10+
isProduction: true
1411
inputs:
15-
instructions: 'Please validate that the release build has been tested, and resume to publish a new version'
16-
onTimeout: 'reject'
17-
- job: Publish
12+
- input: pipelineArtifact
13+
artifactName: vscode-dotnet-install-tool
14+
targetPath: '$(System.DefaultWorkingDirectory)' # This is the destination path.
15+
listFiles: true
1816
pool:
1917
${{ parameters.pool }}
2018
displayName: '🌐 Publish to Marketplace'
19+
environment: 'vscode-dotnetcore-extension-releases' # This requires approval gates configured in Azure DevOps
2120
dependsOn:
22-
- waitForValidation
2321
- ${{ parameters.pool.os }}_Package
24-
steps:
25-
- task: DownloadPipelineArtifact@2
26-
displayName: '⬇️ Download Packaged Extension'
27-
inputs:
28-
path: '$(System.ArtifactsDirectory)'
29-
- template: install-node.yaml
30-
- template: list-file-structure.yaml
31-
- bash: |
32-
VERSION=`node -p "require('./package.json').version"`
33-
npm version $VERSION --allow-same-version
34-
echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION"
35-
name: GetVersion
36-
displayName: '❓ Get Version'
37-
workingDirectory: 'vscode-dotnet-runtime-extension'
38-
- task: AzureCLI@2
39-
displayName: '🚀 Publish to Marketplace'
40-
inputs:
41-
azureSubscription: 'VSCode Marketplace Publishing'
42-
scriptType: "pscore"
43-
scriptLocation: 'inlineScript'
44-
workingDirectory: '$(System.ArtifactsDirectory)'
45-
inlineScript: |
46-
npm i -g --verbose @vscode/vsce
47-
$basePublishArgs = , "publish"
48-
$basePublishArgs += '--azure-credential'
49-
$basePublishArgs += '--packagePath'
50-
$publishArgs = $basePublishArgs + 'vscode-dotnet-runtime-$(GetVersion.version)-signed.vsix'
51-
$publishArgs += '--manifestPath'
52-
$publishArgs += 'vscode-dotnet-runtime-$(GetVersion.version).manifest'
53-
$publishArgs += '--signaturePath'
54-
$publishArgs += 'vscode-dotnet-runtime-$(GetVersion.version).signature.p7s'
55-
If ("${{ parameters.SignType }}" -ne "Real") {
56-
Write-Host "With a test-signed build, the command to publish is printed instead of run."
57-
Write-Host "##[command]vsce $publishArgs"
58-
}
59-
Else {
60-
Write-Host "##[command]vsce $publishArgs"
61-
vsce @publishArgs
62-
}
22+
strategy:
23+
runOnce:
24+
deploy:
25+
steps:
26+
- template: install-node.yaml
27+
- template: list-file-structure.yaml
28+
- pwsh: |
29+
# Extract version from downloaded VSIX filename
30+
$packagesPath = Join-Path -Path $(System.DefaultWorkingDirectory) -ChildPath 'packages'
31+
Write-Host "Artifacts directory contents:"
32+
Get-ChildItem -Path $packagesPath -Recurse | Format-Table Name, FullName
33+
34+
$vsixFile = Get-ChildItem -Path $packagesPath -Recurse -Filter "vscode-dotnet-runtime-*.vsix" | Select-Object -First 1
35+
if (-not $vsixFile) {
36+
Write-Error "Could not find VSIX file in artifacts/packages"
37+
exit 1
38+
}
39+
40+
# Extract version from filename (e.g., vscode-dotnet-runtime-1.2.3.vsix -> 1.2.3)
41+
if ($vsixFile.Name -match 'vscode-dotnet-runtime-(.+)\.vsix$') {
42+
$version = $matches[1]
43+
# Handle signed VSIX files (remove -signed suffix if present)
44+
$version = $version -replace '-signed$', ''
45+
Write-Host "Extracted version: $version"
46+
echo "##vso[task.setvariable variable=version;isOutput=true]$version"
47+
} else {
48+
Write-Error "Could not extract version from VSIX filename: $($vsixFile.Name)"
49+
exit 1
50+
}
51+
name: GetVersion
52+
displayName: '❓ Extract Version from Artifact'
53+
- task: AzureCLI@2
54+
displayName: '🚀 Publish to Marketplace'
55+
inputs:
56+
azureSubscription: 'VSCode Marketplace Publishing'
57+
scriptType: "pscore"
58+
scriptLocation: 'inlineScript'
59+
workingDirectory: $(System.DefaultWorkingDirectory)
60+
inlineScript: |
61+
npm i -g --verbose @vscode/vsce
62+
63+
$packagesPath = Join-Path -Path $(System.DefaultWorkingDirectory) -ChildPath 'packages'
64+
65+
# Find the required files using extracted version
66+
$version = "$(GetVersion.version)"
67+
Write-Host "Looking for files with version: $version"
68+
69+
# Find VSIX file (try signed first, then regular)
70+
$vsixFile = Get-ChildItem -Path $packagesPath -Recurse -Filter "vscode-dotnet-runtime-$version-signed.vsix" | Select-Object -First 1
71+
if (-not $vsixFile) {
72+
$vsixFile = Get-ChildItem -Path $packagesPath -Recurse -Filter "vscode-dotnet-runtime-$version.vsix" | Select-Object -First 1
73+
}
74+
75+
$manifestFile = Get-ChildItem -Path $packagesPath -Recurse -Filter "vscode-dotnet-runtime-$version.manifest" | Select-Object -First 1
76+
$signatureFile = Get-ChildItem -Path $packagesPath -Recurse -Filter "vscode-dotnet-runtime-$version.signature.p7s" | Select-Object -First 1
77+
78+
if (-not $vsixFile -or -not $manifestFile -or -not $signatureFile) {
79+
Write-Error "Could not find required files for version $version in packages folder"
80+
Write-Error "VSIX found: $($vsixFile -ne $null)"
81+
Write-Error "Manifest found: $($manifestFile -ne $null)"
82+
Write-Error "Signature found: $($signatureFile -ne $null)"
83+
84+
Write-Host "Available files in packages folder:"
85+
Get-ChildItem -Path $packagesPath -Recurse | Format-Table Name, FullName
86+
exit 1
87+
}
88+
89+
Write-Host "Using VSIX file: $($vsixFile.FullName)"
90+
Write-Host "Using manifest: $($manifestFile.FullName)"
91+
Write-Host "Using signature: $($signatureFile.FullName)"
92+
93+
$publishArgs = @(
94+
'publish'
95+
'--azure-credential'
96+
'--packagePath'
97+
$vsixFile.FullName
98+
'--manifestPath'
99+
$manifestFile.FullName
100+
'--signaturePath'
101+
$signatureFile.FullName
102+
)
103+
104+
If ("${{ parameters.SignType }}" -ne "Real") {
105+
Write-Host "With a test-signed build, the command to publish is printed instead of run."
106+
Write-Host "##[command]vsce $publishArgs"
107+
}
108+
Else {
109+
Write-Host "##[command]vsce $publishArgs"
110+
111+
}

0 commit comments

Comments
 (0)