Skip to content

Commit ee27eca

Browse files
authored
Merge pull request #7490 from dibarbet/dev/dibarbet/signing
Add signing support to VSIX
2 parents 2eda54b + 9e0b5f5 commit ee27eca

20 files changed

+326
-26
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ out
1414
.razortelemetry/
1515
.razorDevKit/
1616
.vscode-test/
17+
msbuild/signing/signJs/*.log
18+
msbuild/signing/signVsix/*.log
1719
dist/
1820
*.razor.json
1921

.vscodeignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.vscode-test/**
1515
coverage/**
1616
out/**
17-
server/**
17+
msbuild/**
1818
src/**
1919
tasks/**
2020
test/**
@@ -33,6 +33,9 @@ azure-pipelines
3333
.editorconfig
3434
.gitignore
3535
CODEOWNERS
36+
Directory.Build.props
37+
global.json
38+
NuGet.config
3639
gulpfile.ts
3740
!install.Lock
3841
ISSUE_TEMPLATE

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project>
22
<PropertyGroup>
3+
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
34
<!--
45
Defines the lowest supported target framework for the extension.
56
Used by server download / integration tests to ensure they run when only this SDK is installed.
File renamed without changes.

azure-pipelines-official.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ parameters:
1919
- prerelease
2020
- auto
2121
default: auto
22+
# Allows the sign type to be set manually for a specific build
23+
- name: signType
24+
values:
25+
- test
26+
- real
27+
- auto
28+
default: auto
2229

2330
resources:
2431
repositories:
@@ -51,3 +58,4 @@ extends:
5158
versionNumberOverride: ${{ parameters.versionNumberOverride }}
5259
isOfficial: true
5360
channel: ${{ parameters.channel }}
61+
signType: ${{ parameters.signType }}

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ stages:
2222
- template: azure-pipelines/build-all.yml
2323
parameters:
2424
isOfficial: false
25+
signType: test
2526

2627
- stage: Test_Linux_Stage
2728
displayName: Test Linux

azure-pipelines/build-all.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ parameters:
1010
- prerelease
1111
- auto
1212
default: auto
13+
- name: signType
14+
values:
15+
- test
16+
- real
17+
- auto
18+
default: auto
19+
1320
stages:
1421
- stage: Build
1522
displayName: 'Build VSIXs'
1623
dependsOn: []
1724
jobs:
18-
- job: SetChannelVariable
19-
displayName: 'Set Channel Variable'
25+
- job: SetRunVariables
26+
displayName: 'Set Run Variables'
2027
pool:
2128
${{ if eq(parameters.isOfficial, true) }}:
2229
name: netcore1espool-internal
@@ -53,8 +60,37 @@ stages:
5360
Write-Host "Setting pipeline channel variable to Release."
5461
Write-Host "##vso[task.setvariable variable=channel;isoutput=true]Release"
5562
}
56-
name: passOutput
57-
63+
name: passChannel
64+
displayName: Set Channel Variable
65+
66+
- pwsh: |
67+
$signType = "test"
68+
if ("${{ parameters.isOfficial }}" -ne "true") {
69+
Write-Host "Not an official build, test signing"
70+
$signType = "test"
71+
} elseif ("${{ parameters.signType }}" -eq "test") {
72+
Write-Host "Sign type override set to ${{ parameters.signType }}"
73+
$signType = "test"
74+
} elseif ("${{ parameters.signType }}" -eq "real") {
75+
Write-Host "Sign type override set to ${{ parameters.signType }}"
76+
$signType = "real"
77+
} else {
78+
Write-Host "Sign type override is ${{ parameters.signType }}, using branch configuration to determine sign type"
79+
Write-Host "Detected branch $(Build.SourceBranchName)"
80+
if ( ("$(Build.SourceBranchName)" -eq "release") -or ("$(Build.SourceBranchName)" -eq "prerelease")) {
81+
Write-Host "Branch is a release branch, using real sign type."
82+
$signType = 'real'
83+
} else {
84+
Write-Host "Branch is test branch, using test sign type."
85+
$signType = 'test'
86+
}
87+
}
88+
89+
Write-Host "Setting pipeline signType variable to " $signType
90+
Write-Host "##vso[task.setvariable variable=signType;isoutput=true]$signType"
91+
name: passSignType
92+
displayName: Set Sign Type
93+
5894
- template: /azure-pipelines/build.yml@self
5995
parameters:
6096
versionNumberOverride: ${{ parameters.versionNumberOverride }}

azure-pipelines/build.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ jobs:
1313
- job: 'Build_${{ parameters.platform }}_vsixs'
1414
pool: ${{ parameters.pool }}
1515
displayName: 'Build ${{ parameters.platform }} vsixs'
16-
dependsOn: SetChannelVariable
16+
dependsOn: SetRunVariables
1717
variables:
18-
channel: $[ dependencies.SetChannelVariable.outputs['passOutput.channel'] ]
18+
channel: $[ dependencies.SetRunVariables.outputs['passChannel.channel'] ]
19+
signType: $[ dependencies.SetRunVariables.outputs['passSignType.signType'] ]
20+
teamName: DotNetCore
1921
steps:
2022
- checkout: self
2123
clean: true
@@ -25,6 +27,20 @@ jobs:
2527
- template: /azure-pipelines/prereqs.yml@self
2628
parameters:
2729
versionNumberOverride: ${{ parameters.versionNumberOverride }}
30+
31+
# If we're in an official build, install the signing plugin
32+
- ${{ if eq(parameters.isOfficial, true) }}:
33+
- task: MicroBuildSigningPlugin@4
34+
displayName: 🔧 Install MicroBuild Signing Plugin
35+
inputs:
36+
signType: $(signType)
37+
zipSources: false
38+
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
39+
azureSubscription: 'MicroBuild Signing Task (DevDiv)'
40+
env:
41+
SignType: $(signType)
42+
TeamName: $(teamName)
43+
2844
- pwsh: |
2945
Write-Host "Building VSIXs for platform ${{ parameters.platform }} and channel $(channel)"
3046
if ("$(channel)" -eq "Release") {
@@ -33,6 +49,15 @@ jobs:
3349
gulp vsix:release:package:${{ parameters.platform }} --prerelease
3450
}
3551
displayName: 'Build VSIXs'
52+
env:
53+
SignType: $(signType)
54+
55+
- ${{ if eq(parameters.isOfficial, true) }}:
56+
- script: gulp signVsix
57+
condition: succeeded()
58+
displayName: 'Sign VSIXs'
59+
env:
60+
SignType: $(signType)
3661

3762
- ${{ if eq(parameters.isOfficial, true) }}:
3863
- task: 1ES.PublishBuildArtifacts@1
@@ -41,6 +66,12 @@ jobs:
4166
inputs:
4267
PathtoPublish: '$(Build.SourcesDirectory)/vsix'
4368
ArtifactName: 'VSIX_$(channel)'
69+
- task: 1ES.PublishBuildArtifacts@1
70+
condition: succeeded()
71+
displayName: 'Publish Signing Logs'
72+
inputs:
73+
PathtoPublish: '$(Build.SourcesDirectory)/out/logs'
74+
ArtifactName: '${{ parameters.platform }} Signing Logs'
4475
- ${{ else }}:
4576
- task: PublishBuildArtifacts@1
4677
condition: succeeded()

azure-pipelines/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ extends:
9999
$basePublishArgs += '--azure-credential'
100100
$basePublishArgs += '--packagePath'
101101
$publishArgs = $basePublishArgs + (Get-ChildItem $publishArtifacts\*.vsix | Sort-Object Name -Descending |% { $_ })
102+
$publishArgs += '--manifestPath'
103+
$publishArgs += (Get-ChildItem $publishArtifacts\*.manifest | Sort-Object Name -Descending |% { $_ })
104+
$publishArgs += '--signaturePath'
105+
$publishArgs += (Get-ChildItem $publishArtifacts\*.signature.p7s | Sort-Object Name -Descending |% { $_ })
102106
103107
If ("${{ parameters.test }}" -eq "true") {
104108
Write-Host "In test mode, command is printed instead of run."

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"msbuild-sdks": {
3+
"Microsoft.Build.NoTargets": "3.7.0"
4+
}
5+
}

0 commit comments

Comments
 (0)