Skip to content

Commit 68ac704

Browse files
authored
Convert official pipeline to 1ES template (#1152)
* Convert official pipeline to 1ES template * Migrate eng/common paths * Migrate MicroBuild VSTS Drop * Use build artifacts where needed by arcade * Disable injected SBOM * Remove CodeQL tasks duplicating injected ones
1 parent ab34bc5 commit 68ac704

File tree

1 file changed

+178
-178
lines changed

1 file changed

+178
-178
lines changed

.vsts-ci.yml

+178-178
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
resources:
2-
- repo: self
3-
clean: true
2+
repositories:
3+
- repository: 1ESPipelineTemplates
4+
type: git
5+
name: 1ESPipelineTemplates/1ESPipelineTemplates
6+
ref: refs/tags/release
47

58
# The variables `_DotNetArtifactsCategory` and `_DotNetValidationArtifactsCategory` are required for proper publishing of build artifacts. See https://github.com/dotnet/roslyn/pull/38259
69
variables:
@@ -14,184 +17,181 @@ trigger:
1417
- main
1518
- dev17.0
1619

17-
stages:
18-
- stage: build
19-
displayName: Build
20-
pool:
21-
name: VSEngSS-MicroBuild2022-1ES
22-
demands:
23-
- cmd
24-
25-
jobs:
26-
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
27-
- template: /eng/common/templates/job/onelocbuild.yml
28-
parameters:
29-
CreatePr: true
30-
LclSource: lclFilesfromPackage
31-
LclPackageId: 'LCL-JUNO-PROD-ROSLYNSDK'
32-
33-
- job: OfficialBuild
34-
displayName: Official Build
35-
36-
steps:
37-
38-
# Needed for SBOM tool
39-
- task: UseDotNet@2
40-
displayName: 'Use .NET Core 3.1 runtime'
41-
inputs:
42-
packageType: runtime
43-
version: 3.1.28
44-
installationPath: '$(Build.SourcesDirectory)\.dotnet'
45-
46-
# Needed because the build fails the NuGet Tools restore without it
47-
- task: UseDotNet@2
48-
displayName: 'Use .NET Core sdk'
49-
inputs:
50-
packageType: sdk
51-
useGlobalJson: true
52-
workingDirectory: '$(Build.SourcesDirectory)'
53-
54-
# Needed to restore the Microsoft.DevDiv.Optimization.Data.PowerShell package
55-
- task: NuGetCommand@2
56-
displayName: Restore internal tools
57-
inputs:
58-
command: restore
59-
feedsToUse: config
60-
restoreSolution: 'eng\common\internal\Tools.csproj'
61-
nugetConfigPath: 'NuGet.config'
62-
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
63-
64-
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
65-
displayName: Install Signing Plugin
66-
inputs:
67-
signType: $(SignType)
68-
esrpSigning: true
69-
condition: and(succeeded(), ne(variables['SignType'], ''))
70-
71-
- task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@1
72-
displayName: Install Swix Plugin
73-
74-
- task: PowerShell@2
75-
inputs:
76-
targetType: 'filePath'
77-
filePath: eng\common\Build.ps1
78-
arguments: > # Use this to avoid newline characters in multiline string
79-
-restore
80-
-build
81-
-sign
82-
-pack
83-
-publish
84-
-ci
85-
-configuration $(BuildConfiguration)
86-
/p:OfficialBuildId=$(Build.BuildNumber)
87-
/p:VisualStudioDropName=$(VisualStudioDropName)
88-
/p:DotNetSignType=$(SignType)
89-
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
90-
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
91-
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
92-
/p:DotnetPublishUsingPipelines=true
93-
/p:GenerateSbom=true
20+
extends:
21+
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
22+
parameters:
23+
pool:
24+
name: VSEngSS-MicroBuild2022-1ES
25+
demands:
26+
- cmd
27+
sdl:
28+
# We generate SBOM ourselves, so don't need steps injected by 1ES.
29+
sbom:
30+
enabled: false
31+
customBuildTags:
32+
- ES365AIMigrationTooling
33+
stages:
34+
- stage: build
9435
displayName: Build
36+
jobs:
37+
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
38+
- template: /eng/common/templates-official/job/onelocbuild.yml@self
39+
parameters:
40+
CreatePr: true
41+
LclSource: lclFilesfromPackage
42+
LclPackageId: 'LCL-JUNO-PROD-ROSLYNSDK'
43+
44+
- job: OfficialBuild
45+
displayName: Official Build
46+
47+
templateContext:
48+
outputs:
49+
50+
- output: pipelineArtifact
51+
displayName: 'Publish Logs'
52+
condition: always()
53+
targetPath: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)'
54+
artifactName: 'Logs'
55+
56+
# Publish an artifact that the RoslynInsertionTool is able to find by its name.
57+
- output: pipelineArtifact
58+
displayName: 'Publish Artifact VSSetup'
59+
condition: succeeded()
60+
targetPath: 'artifacts\VSSetup\$(BuildConfiguration)'
61+
artifactName: 'VSSetup'
62+
63+
# Publish our NuPkgs as an artifact. The name of this artifact must be PackageArtifacts as the
64+
# arcade templates depend on the name.
65+
- output: buildArtifacts
66+
displayName: 'Publish Artifact Packages'
67+
condition: succeeded()
68+
PathtoPublish: 'artifacts\packages\$(BuildConfiguration)'
69+
ArtifactName: 'PackageArtifacts'
70+
71+
# Publish Asset Manifests for Build Asset Registry job
72+
- output: buildArtifacts
73+
displayName: 'Publish Asset Manifests'
74+
condition: succeeded()
75+
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest'
76+
ArtifactName: AssetManifests
77+
78+
# Publishes setup VSIXes to a drop.
79+
# Note: The insertion tool looks for the display name of this task in the logs.
80+
- output: microBuildVstsDrop
81+
displayName: Upload VSTS Drop
82+
condition: succeeded()
83+
dropName: $(VisualStudioDropName)
84+
dropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
85+
accessToken: $(System.AccessToken)
86+
87+
steps:
88+
89+
# Needed for SBOM tool
90+
- task: UseDotNet@2
91+
displayName: 'Use .NET Core 3.1 runtime'
92+
inputs:
93+
packageType: runtime
94+
version: 3.1.28
95+
installationPath: '$(Build.SourcesDirectory)\.dotnet'
9596

96-
- template: eng\common\templates\steps\generate-sbom.yml
97-
98-
# Publishes setup VSIXes to a drop.
99-
# Note: The insertion tool looks for the display name of this task in the logs.
100-
- task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1
101-
displayName: Upload VSTS Drop
102-
inputs:
103-
DropName: $(VisualStudioDropName)
104-
DropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
105-
AccessToken: $(System.AccessToken)
106-
condition: succeeded()
107-
108-
- task: PublishBuildArtifacts@1
109-
displayName: Publish Logs
110-
inputs:
111-
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)'
112-
ArtifactName: 'Logs'
113-
continueOnError: true
114-
condition: always()
115-
116-
# Publish an artifact that the RoslynInsertionTool is able to find by its name.
117-
- task: PublishBuildArtifacts@1
118-
displayName: Publish Artifact VSSetup
119-
inputs:
120-
PathtoPublish: 'artifacts\VSSetup\$(BuildConfiguration)'
121-
ArtifactName: 'VSSetup'
122-
condition: succeeded()
123-
124-
# Publish our NuPkgs as an artifact. The name of this artifact must be PackageArtifacts as the
125-
# arcade templates depend on the name.
126-
- task: PublishBuildArtifacts@1
127-
displayName: Publish Artifact Packages
128-
inputs:
129-
PathtoPublish: 'artifacts\packages\$(BuildConfiguration)'
130-
ArtifactName: 'PackageArtifacts'
131-
condition: succeeded()
132-
133-
# Publish Asset Manifests for Build Asset Registry job
134-
- task: PublishBuildArtifacts@1
135-
displayName: Publish Asset Manifests
136-
inputs:
137-
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest'
138-
ArtifactName: AssetManifests
139-
condition: succeeded()
140-
141-
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
142-
displayName: Cleanup
143-
condition: always()
144-
145-
# Publish to Build Asset Registry
146-
- template: /eng/common/templates/job/publish-build-assets.yml
147-
parameters:
148-
publishUsingPipelines: true
149-
dependsOn:
150-
- OfficialBuild
151-
queue:
152-
name: Hosted VS2017
153-
154-
- stage: analysis
155-
displayName: Code analysis
156-
pool:
157-
name: VSEngSS-MicroBuild2022-1ES
158-
demands:
159-
- cmd
160-
jobs:
161-
- job: codeql
162-
displayName: CodeQL
163-
timeoutInMinutes: 120
164-
variables:
165-
# CG is handled in the primary CI pipeline
166-
- name: skipComponentGovernanceDetection
167-
value: true
168-
# Force CodeQL enabled so it may be run on any branch
169-
- name: Codeql.Enabled
170-
value: true
171-
# Do not let CodeQL 3000 Extension gate scan frequency
172-
- name: Codeql.Cadence
173-
value: 0
174-
- name: Codeql.TSAEnabled
175-
value: true
176-
steps:
97+
# Needed because the build fails the NuGet Tools restore without it
17798
- task: UseDotNet@2
99+
displayName: 'Use .NET Core sdk'
178100
inputs:
101+
packageType: sdk
179102
useGlobalJson: true
180-
- task: CodeQL3000Init@0
181-
displayName: CodeQL Initialize
182-
- script: eng\common\cibuild.cmd
183-
-configuration Release
184-
-prepareMachine
185-
/p:Test=false
186-
displayName: Windows Build
187-
- task: CodeQL3000Finalize@0
188-
displayName: CodeQL Finalize
189-
190-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
191-
- template: eng\common\templates\post-build\post-build.yml
192-
parameters:
193-
publishingInfraVersion: 3
194-
# Symbol validation is not entirely reliable as of yet, so should be turned off until
195-
# https://github.com/dotnet/arcade/issues/2871 is resolved.
196-
enableSymbolValidation: false
197-
enableSourceLinkValidation: false
103+
workingDirectory: '$(Build.SourcesDirectory)'
104+
105+
# Needed to restore the Microsoft.DevDiv.Optimization.Data.PowerShell package
106+
- task: NuGetCommand@2
107+
displayName: Restore internal tools
108+
inputs:
109+
command: restore
110+
feedsToUse: config
111+
restoreSolution: 'eng\common\internal\Tools.csproj'
112+
nugetConfigPath: 'NuGet.config'
113+
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
114+
115+
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
116+
displayName: Install Signing Plugin
117+
inputs:
118+
signType: $(SignType)
119+
esrpSigning: true
120+
condition: and(succeeded(), ne(variables['SignType'], ''))
121+
122+
- task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@1
123+
displayName: Install Swix Plugin
124+
125+
- task: PowerShell@2
126+
inputs:
127+
targetType: 'filePath'
128+
filePath: eng\common\Build.ps1
129+
arguments: > # Use this to avoid newline characters in multiline string
130+
-restore
131+
-build
132+
-sign
133+
-pack
134+
-publish
135+
-ci
136+
-configuration $(BuildConfiguration)
137+
/p:OfficialBuildId=$(Build.BuildNumber)
138+
/p:VisualStudioDropName=$(VisualStudioDropName)
139+
/p:DotNetSignType=$(SignType)
140+
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
141+
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
142+
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
143+
/p:DotnetPublishUsingPipelines=true
144+
/p:GenerateSbom=true
145+
displayName: Build
146+
147+
- template: /eng/common/templates-official/steps/generate-sbom.yml@self
148+
149+
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
150+
displayName: Cleanup
151+
condition: always()
152+
153+
# Publish to Build Asset Registry
154+
- template: /eng/common/templates-official/job/publish-build-assets.yml@self
155+
parameters:
156+
publishUsingPipelines: true
157+
dependsOn:
158+
- OfficialBuild
159+
queue:
160+
name: Hosted VS2017
161+
162+
- stage: analysis
163+
displayName: Code analysis
164+
jobs:
165+
- job: codeql
166+
displayName: CodeQL
167+
timeoutInMinutes: 120
168+
variables:
169+
# CG is handled in the primary CI pipeline
170+
- name: skipComponentGovernanceDetection
171+
value: true
172+
# Force CodeQL enabled so it may be run on any branch
173+
- name: Codeql.Enabled
174+
value: true
175+
# Do not let CodeQL 3000 Extension gate scan frequency
176+
- name: Codeql.Cadence
177+
value: 0
178+
- name: Codeql.TSAEnabled
179+
value: true
180+
steps:
181+
- task: UseDotNet@2
182+
inputs:
183+
useGlobalJson: true
184+
- script: eng\common\cibuild.cmd
185+
-configuration Release
186+
-prepareMachine
187+
/p:Test=false
188+
displayName: Windows Build
189+
190+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
191+
- template: /eng/common/templates-official/post-build/post-build.yml@self
192+
parameters:
193+
publishingInfraVersion: 3
194+
# Symbol validation is not entirely reliable as of yet, so should be turned off until
195+
# https://github.com/dotnet/arcade/issues/2871 is resolved.
196+
enableSymbolValidation: false
197+
enableSourceLinkValidation: false

0 commit comments

Comments
 (0)