-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathpipeline-build-dev.yaml.j2
263 lines (263 loc) · 6.87 KB
/
pipeline-build-dev.yaml.j2
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
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: petclinic-build-dev
namespace: cicd
spec:
params:
- name: APP_SOURCE_GIT
type: string
description: The application git repository
default: http://{{ r_gogs_route.resources[0].spec.host }}/gogs/spring-petclinic
- name: APP_SOURCE_REVISION
type: string
description: The application git revision
default: master
- name: APP_MANIFESTS_GIT
type: string
description: The application manifests git repository
default: http://{{ r_gogs_route.resources[0].spec.host }}/gogs/spring-petclinic-config
- name: APP_IMAGE_TAG
type: string
default: latest
description: The application image tag to build
- name: DEV_NAMESPACE
type: string
default: devsecops-dev
description: The namespace for Stage environments
- name: APP_TESTS_GIT
type: string
description: The application test cases git repository
default: https://github.com/rcarrata/spring-petclinic-gatling
workspaces:
- name: workspace
- name: maven-settings
tasks:
- name: source-clone
taskRef:
name: git-clone
kind: ClusterTask
workspaces:
- name: output
workspace: workspace
params:
- name: url
value: $(params.APP_SOURCE_GIT)
- name: revision
value: $(params.APP_SOURCE_REVISION)
- name: depth
value: "0"
- name: subdirectory
value: spring-petclinic
- name: deleteExisting
value: "true"
- name: unit-tests
taskRef:
name: maven
runAfter:
- source-clone
workspaces:
- name: source
workspace: workspace
- name: maven-settings
workspace: maven-settings
params:
- name: GOALS
value: ["package", "-f", "spring-petclinic"]
- name: code-analysis
taskRef:
name: maven
runAfter:
- source-clone
workspaces:
- name: source
workspace: workspace
- name: maven-settings
workspace: maven-settings
params:
- name: GOALS
value:
- install
- sonar:sonar
- -f
- spring-petclinic
- -Dsonar.host.url=http://sonarqube:9000
- -Dsonar.userHome=/tmp/sonar
- -DskipTests=true
- name: dependency-report
taskRef:
name: dependency-report
runAfter:
- source-clone
workspaces:
- name: source
workspace: workspace
- name: maven-settings
workspace: maven-settings
params:
- name: SOURCE_DIR
value: spring-petclinic
- name: release-app
taskRef:
name: maven
runAfter:
- code-analysis
- unit-tests
- dependency-report
workspaces:
- name: source
workspace: workspace
- name: maven-settings
workspace: maven-settings
params:
- name: GOALS
value:
- deploy
- -f
- spring-petclinic
- -DskipTests=true
- -DaltDeploymentRepository=nexus::default::http://nexus:8081/repository/maven-releases/
- -DaltSnapshotDeploymentRepository=nexus::default::http://nexus:8081/repository/maven-snapshots/
- name: build-image
taskRef:
name: s2i-java-11
runAfter:
- release-app
params:
- name: TLSVERIFY
value: "false"
- name: MAVEN_MIRROR_URL
value: http://nexus:8081/repository/maven-public/
- name: PATH_CONTEXT
value: spring-petclinic/target
- name: IMAGE_NAME
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/spring-petclinic
- name: IMAGE_TAG
value: $(params.APP_IMAGE_TAG)
workspaces:
- name: source
workspace: workspace
- name: image-scan
runAfter:
- build-image
taskRef:
name: rox-image-scan
kind: ClusterTask
params:
- name: image
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/spring-petclinic
- name: rox_api_token
value: roxsecrets
- name: rox_central_endpoint
value: roxsecrets
- name: output_format
value: table
- name: image_digest
value: $(tasks.build-image.results.IMAGE_DIGEST)
- name: image-check
runAfter:
- build-image
taskRef:
name: rox-image-check
kind: ClusterTask
params:
- name: image
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/spring-petclinic
- name: rox_api_token
value: roxsecrets
- name: rox_central_endpoint
value: roxsecrets
- name: image_digest
value: $(tasks.build-image.results.IMAGE_DIGEST)
- name: deploy-check
runAfter:
- build-image
taskRef:
name: rox-deployment-check
kind: ClusterTask
params:
- name: GIT_REPOSITORY
value: "$(params.APP_MANIFESTS_GIT)"
- name: rox_api_token
value: roxsecrets
- name: rox_central_endpoint
value: roxsecrets
- name: file
value: deployment.yaml
- name: deployment_files_path
value: app
workspaces:
- name: workspace
workspace: workspace
- name: update-deployment
runAfter:
- image-scan
- image-check
- deploy-check
taskRef:
name: git-update-deployment
params:
- name: GIT_REPOSITORY
value: "$(params.APP_MANIFESTS_GIT)"
- name: GIT_USERNAME
value: gogs
- name: GIT_PASSWORD
value: gogs
- name: CURRENT_IMAGE
value: quay.io/siamaksade/spring-petclinic:latest
- name: NEW_IMAGE
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/spring-petclinic
- name: NEW_DIGEST
value: "$(tasks.build-image.results.IMAGE_DIGEST)"
- name: KUSTOMIZATION_PATH
value: environments/dev
workspaces:
- name: workspace
workspace: workspace
- name: wait-application
taskRef:
name: argocd-task-sync-and-wait
runAfter:
- update-deployment
params:
- name: application-name
value: dev-spring-petclinic
- name: perf-tests-clone
taskRef:
name: git-clone
kind: ClusterTask
workspaces:
- name: output
workspace: workspace
runAfter:
- wait-application
params:
- name: url
value: $(params.APP_TESTS_GIT)
- name: subdirectory
value: spring-petclinic-gatling
- name: deleteExisting
value: "true"
- name: pentesting-test
taskRef:
name: zap-proxy
runAfter:
- perf-tests-clone
params:
- name: APP_URL
value: "http://spring-petclinic.$(params.DEV_NAMESPACE).svc.cluster.local:8080"
workspaces:
- name: workspace
workspace: workspace
- name: performance-test
taskRef:
name: gatling
runAfter:
- perf-tests-clone
params:
- name: APP_URL
value: "http://spring-petclinic.$(params.DEV_NAMESPACE).svc.cluster.local:8080"
workspaces:
- name: simulations
workspace: workspace
subPath: spring-petclinic-gatling