-
Notifications
You must be signed in to change notification settings - Fork 29
/
azure-pipelines.yml
301 lines (284 loc) · 10.8 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# Example Continuous Delivery Pipeline with Fortify on Demand (FoD)
name: IWA-CD
trigger:
batch: true
branches:
include:
- main
- develop
- feature/*
- release/*
exclude:
- experimental/*
paths:
exclude:
- README.md
- bin/*
- lib/*
- etc/*
- media/*
pr:
branches:
include:
- main
- develop
paths:
exclude:
- README.md
- bin/*
- lib/*
- etc/*
- media/*
variables:
#
# In order for the pipeline to execute successfully you should create and set the following variables in the Pipeline UI.
#
# For FoD:
# FOD_BASE_URL - FoD Base Url, e.g. "https://ams.fortify.com"
# FOD_API_URL - FoD API URL, e.g. "https://api.ams.fortify.com"
# FOD_TENANT - FoD Tenant Name
# FOD_CLIENT_ID - FoD API Client Id
# FOD_CLIENT_SECRET - FoD API Client Secret
#
# For Octane/ValueEdge if integration is used
# OCTANE_WORKSPACES - List of target ALM Octane/ValueEdge workspaces
# and the below if FortifyBugTrackerUtility is used:
# OCTANE_BASE_URL - ALM Octane/ValueEdge Base Url, e.g. "https://almoctane-ams.saas.microfocus.com/"
# OCTANE_CLIENT_ID - ALM Octane/ValueEdge API Client Id
# OCTANE_CLIENT_SECRET - ALM Octane/ValueEdge API Client Secret
# OCTANE_SHARED_SPACE_ID - ALM Octane/ValueEdge Shared Space Id
# OCTANE_WORKSPACE_ID - ALM Octane/ValueEdge Shared SpaceWorkspace Id
#
# For Debricked:
# DEBRICKED_TOKEN - Debricked Access Token
#
#
# The pipeline job templates make use of the Fortify CLI tool (https://github.com/fortify/fcli) and Debricked CLI tool (https://github.com/debricked/cli)
# There are tasks which make use of preview extensions (not published to the Azure DevOps marketplace) to install these tools included, e.g.:
# - FcliInstaller - https://github.com/fortify-presales/azure-pipelines-fcli-tasks
# - DebrickedInstaller - https://github.com/fortify-presales/azure-pipelines-debricked-tasks
# Follow the instructions on the GitHub repos to install these extensions.
# If you are using a self-hosted agent you can install the fcli and debricked tools yourselves, add to the path and comment out the these extension tasks.
#
# IMPORTANT: if using a self-hosted agent, please ensure a Java 17x64 SDK is installed and the environment variable JAVA_HOME_17_X64 is set to its location
# Change these variables depending on which parts of the pipeline to execute:
- name: USE_FOD_SAST
value: true
- name: USE_FOD_OSS
value: false
- name: USE_DEBRICKED
value: true
- name: USE_FOD_DAST
value: true
- name: SYNC_ISSUES
value: true
#
# By default the FoD/SSC application name is set to the name of the Git repository
# If you wish to override any of these please set the following variables from the pipelines UI:
#
# FORTIFY_APP_NAME_OVERRIDE
# FORTIFY_RELEASE_NAME_OVERRIDE
#
- name: FORTIFY_APP_NAME
value: $(Build.Repository.Name)
- name: FORTIFY_RELEASE_NAME
value: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]
stages:
#- stage: ALMOctanePre
# displayName: 'ALM Octane Pre'
# jobs:
# - job:
# condition: always()
# pool:
# name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
# steps:
# - task: octane-start-task@2
# inputs:
# OctaneServiceConnection: 'AzureExtensionPipelineServiceConnection-IWA'
# WorkspaceList: "$(OCTANE_WORKSPACES)"
# GithubRepositoryConnection: 'GitHubServiceConnection-IWA'
# CreatePipelineCheckbox: true
#
# Build and Unit Test the application components
#
- stage: BuildAndUnitTest
displayName: 'Build and Unit Test'
jobs:
# Build IWA and run its tests
- template: '.azure-pipelines/templates/gradle-build-and-test.yml'
parameters:
# workingDirectory: '.'
# projectFile: 'build.gradle'
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Software Composition Analysis - OSS Scan with Debricked
#
- stage: Debricked_SCA
displayName: 'Debricked SCA'
condition: eq(variables['USE_DEBRICKED'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run Debricked OSS Scan on Project
- template: '.azure-pipelines/templates/debricked-oss-scan.yml'
parameters:
workingDirectory: '.'
debrickedToken: $(DEBRICKED_TOKEN)
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Software Composition Analysis - OSS Scan with Fortify on Demand
#
- stage: FoD_OSS
displayName: 'FoD OSS'
condition: eq(variables['USE_FOD_OSS'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run FoD OSS Scan on Project
- template: '.azure-pipelines/templates/fod-oss-scan.yml'
parameters:
workingDirectory: '.'
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Static Application Security Testing with Fortify on Demand
#
- stage: FoD_SAST
displayName: 'FoD SAST'
condition: eq(variables['USE_FOD_SAST'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run FoD SAST Scan on Project
- template: '.azure-pipelines/templates/fod-sast-scan.yml'
parameters:
workingDirectory: '.'
projectFile: 'build.gradle'
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Deploy the application - use an appropriate set of tasks for your application/environment here
#
- stage: DeployApp
displayName: 'Deploy Application'
dependsOn:
- FoD_SAST
#- FoD_OSS
#- Debricked_SCA
jobs:
# This is a simulated deployment and does nothing
- template: '.azure-pipelines/templates/simulate-deployment.yml'
parameters:
workingDirectory: '.'
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Dynamic Application Security Testing with Fortify on Demand
#
- stage: FoD_DAST
displayName: 'FoD DAST'
condition: and(eq(variables['USE_FOD_DAST'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
dependsOn: DeployApp
jobs:
# Run FoD DAST Scan on Project
- template: '.azure-pipelines/templates/fod-dast-scan.yml'
parameters:
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Verify FoD Security Policy
#
- stage: FoD_SecurityGate
displayName: 'FoD Security Gate'
condition: always()
dependsOn:
- FoD_SAST
#- FoD_OSS
- FoD_DAST
jobs:
# Verify Security Policy for the Release
- template: '.azure-pipelines/templates/fod-security-gate.yml'
parameters:
workingDirectory: '.'
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
reportFile: "$(Build.SourcesDirectory)/reports/$(FORTIFY_RELEASE_NAME).html"
pool:
name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#
# Create and synchronize "NEW" FoD Issues to ALM Octane/ValueEdge
#
#- stage: FoD_Issues_To_Octane
# displayName: 'FoD Issues to Octane'
# condition: eq(variables['SYNC_ISSUES'], 'true')
# dependsOn:
# - FOD_SAST
# - FOD_DAST
# jobs:
# - template: '.azure-pipelines/templates/fod-to-octane.yml'
# parameters:
# workingDirectory: '.' # could be project directory with specific config file
# fodBaseUrl: $(FOD_BASE_URL)
# fodTenant: $(FOD_TENANT)
# fodClientId: $(FOD_CLIENT_ID)
# fodClientSecret: $(FOD_CLIENT_SECRET)
# fodAppName: "$(FORTIFY_APP_NAME)"
# fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
# octaneBaseUrl: $(OCTANE_BASE_URL)
# octaneSharedSpaceId: $(OCTANE_SHARED_SPACE_ID)
# octaneWorkspaceId: $(OCTANE_WORKSPACE_ID)
# octaneClientId: $(OCTANE_CLIENT_ID)
# octaneClientSecret: $(OCTANE_CLIENT_SECRET)
# configFile: 'FoDToOctane-NEW.xml'
# pool:
# name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
#- stage: ALMOctanePost
# displayName: 'ALM Octane Post'
# condition: always()
# dependsOn:
# - ALMOctanePre
# - FoD_SAST
# - FoD_DAST
# - FoD_SecurityGate
# - FoD_Issues_To_Octane
# jobs:
# - job:
# condition: always()
# pool:
# name: 'FortifyPreSales' # use named self-hosted pool
#vmImage: 'windows-2022' # or uncomment to use Azure Devops cloud-hosted pool
# steps:
# - task: octane-end-task@2
# inputs:
# OctaneServiceConnection: 'AzureExtensionPipelineServiceConnection-IWA'
# WorkspaceList: "$(OCTANE_WORKSPACES)"
# GithubRepositoryConnection: 'GitHubServiceConnection-IWA'