forked from dotnet/arcade-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
212 lines (189 loc) · 8.08 KB
/
azure-pipelines.yml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
variables:
# For $(DncEngInternalBuildPool) used below
- template: /eng/common/templates-official/variables/pool-providers.yml@self
- group: SDL_Settings
- name: _TeamName
value: DotNetCore
- name: _PublishUsingPipelines
value: true
- name: _DotNetArtifactsCategory
value: .NETCore
- name: AzdoOrgUri
value: https://dev.azure.com/dnceng
- name: AzdoProject
value: internal
- name: resourceGroupName
value: product-construction-service
- name: containerName
value: product-construction-service.api
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/production') }}:
- name: dockerRegistryUrl
value: productconstructionprod.azurecr.io
- name: containerRegistryName
value: productconstructionprod
- name: serviceConnectionName
value: ProductConstructionServiceDeploymentProd
- ${{ else }}:
- name: dockerRegistryUrl
value: productconstructionint.azurecr.io
- name: containerRegistryName
value: productconstructionint
- name: serviceConnectionName
value: ProductConstructionServiceDeploymentInt
- ${{ if in(variables['Build.SourceBranch'], 'refs/heads/main', 'refs/heads/production') }}:
- name: devBranchSuffix
value:
- ${{ else }}:
- name: devBranchSuffix
value: -dev
trigger:
batch: true
branches:
include:
- main
- production
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2019
os: windows
stages:
- stage: Build
dependsOn: []
displayName: Build
jobs:
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
artifacts:
publish:
logs: true
${{ if in(variables['Build.SourceBranch'], 'refs/heads/main', 'refs/heads/production') }}:
artifacts: true
manifests: true
enableTelemetry: true
enableMicrobuild: false
enablePublishTestResults: false
enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }}
jobs:
- job: Windows_NT
timeoutInMinutes: 90
displayName: Build repository
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
variables:
# DotNet-Symbol-Server-Pats provides: microsoft-symbol-server-pat, symweb-symbol-server-pat
# Publish-Build-Assets provides: MaestroAppClientId, MaestroStagingAppClientId, BotAccount-dotnet-maestro-bot-PAT
- group: DotNet-Symbol-Server-Pats
- group: Publish-Build-Assets
- _InternalBuildArgs: >
/p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
- _BuildConfig: Release
- _PublishType: blob
- _SignType: test
steps:
- checkout: self
clean: true
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/production')}}:
- template: /eng/common/templates-official/steps/retain-build.yml@self
parameters:
AzdoOrgUri: $(AzdoOrgUri)
AzdoProject: $(AzdoProject)
BuildId: $(Build.BuildId)
- template: /eng/templates/steps/build.yml@self
parameters:
configuration: $(_BuildConfig)
buildArgs: $(_InternalBuildArgs)
- task: ComponentGovernanceComponentDetection@0
displayName: Component Governance Detection
inputs:
# `.packages` directory is used by some tools running during build.
# By default ComponentDetection scans this directory and sometimes reports
# vulnerabilities for packages that are not part of the published product.
# We can ignore this directory because actual vulnerabilities
# that we are interested in will be found by the tool
# when scanning .csproj and package.json files.
ignoreDirectories: .packages
- task: CopyFiles@2
displayName: Prepare E2E Tests
inputs:
sourceFolder: $(Build.SourcesDirectory)\artifacts\bin\ProductConstructionService.ScenarioTests\$(_BuildConfig)\net8.0\publish
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)\ProductConstructionService.ScenarioTests
- task: CopyFiles@2
displayName: Prepare PCS CLI
inputs:
sourceFolder: $(Build.SourcesDirectory)\artifacts\bin\ProductConstructionService.Cli\$(_BuildConfig)\net8.0
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)\ProductConstructionService.Cli
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
path: $(Build.ArtifactStagingDirectory)\ProductConstructionService.ScenarioTests
artifact: ProductConstructionService.ScenarioTests
displayName: Publish E2E Tests
- output: pipelineArtifact
path: $(Build.ArtifactStagingDirectory)\ProductConstructionService.Cli
artifact: ProductConstructionService.Cli
displayName: Publish PCS CLI
- job: BuildAndPublishDocker
displayName: Build/publish docker image
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es-ubuntu-2004
os: linux
steps:
- checkout: self
- template: /eng/templates/steps/docker-build.yml@self
parameters:
devBranchSuffix: $(devBranchSuffix)
dockerImageName: $(dockerRegistryUrl)/$(containerName)
- ${{ if notin(variables['Build.Reason'], 'PullRequest') }}:
- task: AzureCLI@2
inputs:
azureSubscription: $(serviceConnectionName)
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
az acr login --name $(containerRegistryName)
docker push "$(dockerRegistryUrl)/$(containerName):$(DockerTag.newDockerImageTag)"
displayName: Push docker image
- template: /eng/templates/stages/deploy.yaml@self
parameters:
isProd: ${{ eq(variables['Build.SourceBranch'], 'refs/heads/production') }}
- ${{ if in(variables['Build.SourceBranch'], 'refs/heads/main', 'refs/heads/production') }}:
- template: /eng/common/templates-official/post-build/post-build.yml@self
parameters:
enableSymbolValidation: true
enableSigningValidation: false
artifactsPublishingAdditionalParameters: '/p:CheckEolTargetFramework=false'
symbolPublishingAdditionalParameters: '/p:CheckEolTargetFramework=false'
SDLValidationParameters:
enable: true
params: '-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName "Arcade-Services"
-TsaCodebaseName "Arcade-Services"
-TsaPublish $True
-PoliCheckAdditionalRunConfigParams @("UserExclusionPath < $(Build.SourcesDirectory)/eng/PoliCheckExclusions.xml")'