-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy path.vsts-dotnet.yml
More file actions
164 lines (155 loc) · 6.31 KB
/
Copy path.vsts-dotnet.yml
File metadata and controls
164 lines (155 loc) · 6.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
trigger:
- main
- vs*
# If defined here, these values are not overrideable
# Once they exist, we should define these as "runtime parameters"
# https://github.com/Microsoft/azure-pipelines-yaml/pull/129
# variables:
# SkipApplyOptimizationData: false
parameters:
- name: OptProfDropName
displayName: Optional OptProfDrop Override
type: string
default: 'default'
- name: enableOptProf
displayName: Enable OptProf data collection for this build
type: boolean
default: true
- name: enableSigningValidation
displayName: Enable Signing Validation
type: boolean
default: true
- name: signTypeParameter
displayName: Sign Type
type: string
default: 'real'
variables:
# if OptProfDrop is not set, string '$(OptProfDrop)' will be passed to the build script.
- name: OptProfDrop
value: ''
- name: requireDefaultChannels
value: false
- name: SourceBranch
value: $(IbcSourceBranchName)
# If we're not on a vs* branch, use main as our optprof collection branch
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs')) }}:
- name: SourceBranch
value: main
# if OptProfDropName is set as a parameter, set OptProfDrop to the parameter and unset SourceBranch
- ${{ if ne(parameters.OptProfDropName, 'default') }}:
- name: OptProfDrop
value: ${{ parameters.OptProfDropName }}
- name: SourceBranch
value: ''
# Override SkipApplyOptimizationData to true when disabling OptProf data collection
- ${{ if eq(parameters.enableOptProf, false) }}:
- name: SkipApplyOptimizationData
value: true
- name: EnableReleaseOneLocBuild
value: false
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- name: EnableReleaseOneLocBuild
value: true
- name: Codeql.Enabled
value: true
- group: DotNet-MSBuild-SDLValidation-Params
- group: AzureDevOps-Artifact-Feeds-Pats
- name: cfsNugetWarnLevel
value: warn
- name: nugetMultiFeedWarnLevel
value: none
- name: NugetSecurityAnalysisWarningLevel
value: none
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
featureFlags:
autoBaseline: true
pool:
name: VSEng-MicroBuildVSStable
os: windows
sdl:
policheck:
enabled: true
exclusionsFile: $(Build.SourcesDirectory)\eng\policheck_exclusions.xml
tsa:
enabled: true
# We generate SBOM ourselves, so don't need steps injected by 1ES.
sbom:
enabled: false
codeSignValidation:
enabled: true
break: true
additionalTargetsGlobPattern: -|**\bootstrapper\**\vs_enterprise.exe
credscan:
suppressionsFile: $(Build.SourcesDirectory)/eng/CredScanSuppressions.json
stages:
# Fail early if not on main or vs* branches
- ${{ if not(or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}:
- stage: branchValidation
displayName: Branch Validation
jobs:
- job: fail_unsupported_branches
displayName: Fail for unsupported branches
steps:
- checkout: none
- powershell: |
$branch = "$(Build.SourceBranch)"
Write-Host "##vso[task.logissue type=error]This pipeline only supports main and vs* branches. Use dedicated pipelines for other branch types."
Write-Host "##vso[task.logissue type=error]Current branch: $branch"
Write-Host "##vso[task.complete result=Failed;]Pipeline execution stopped for unsupported branch."
exit 1
displayName: 'Validate branch type'
- ${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- stage: localization
displayName: Localization
jobs:
# The localization setup for release/ branches. Note difference in LclPackageId. main branch is handled separately below.
# Used for vs17.2, vs17.4, vs17.6 etc. branches only.
# When the branch is setup for localization (the localization ticket needs to be created - https://aka.ms/ceChangeLocConfig, requesting change from one release branch to another),
# set 'EnableReleaseOneLocBuild' to true.
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/vs') }}:
- template: /eng/common/templates-official/job/onelocbuild.yml@self
parameters:
MirrorRepo: 'msbuild'
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-MSBUILDREL'
MirrorBranch: ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }}
JobNameSuffix: '_release'
condition: ${{ variables.EnableReleaseOneLocBuild }}
# The localization setup for main branch. Note difference in package ID. Should not be used with release/ branches.
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- template: /eng/common/templates-official/job/onelocbuild.yml@self
parameters:
MirrorRepo: 'msbuild'
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-MSBUILD'
MirrorBranch: 'main'
JobNameSuffix: '_main'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
- stage: build
displayName: Build
${{ if not(or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}:
dependsOn:
- branchValidation
${{ else }}:
dependsOn: []
jobs:
- template: /azure-pipelines/.vsts-dotnet-build-jobs.yml@self
parameters:
isExperimental: false
enableComponentGovernance: true
signTypeParameter: ${{ parameters.signTypeParameter }}
enableOptProf: ${{ parameters.enableOptProf }}
- template: /eng/common/templates-official/post-build/post-build.yml@self
parameters:
publishingInfraVersion: 3
enableSymbolValidation: true
enableSourceLinkValidation: false
enableNugetValidation: false
enableSigningValidation: ${{ parameters.enableSigningValidation }}