forked from nulldriver/cf-cli-resource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.yml
403 lines (377 loc) · 9.17 KB
/
pipeline.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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
---
groups:
- name: main
jobs:
- build
- test-cf-cli-v6
- test-cf-cli-v7
- test-cf-cli-v8
- scan-image
- shipit
- bump-patch
- name: manage
jobs:
- bump-*
- setup
- cleanup-failed-tests
- name: all
jobs:
- build
- test-*
- scan-image
- shipit
- bump-*
- setup
- cleanup-failed-tests
jobs:
- name: build
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
trigger: true
- get: os-image
trigger: true
- task: build
privileged: true
file: cf-cli-resource/ci/tasks/build-image.yml
input_mapping:
project: cf-cli-resource
- put: resource-image-dev
params:
image: image/image.tar
get_params: {skip_download: true}
- name: test-cf-cli-v6
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
passed: [build]
trigger: true
- get: resource-image-dev
passed: [build]
trigger: true
- task: test
image: resource-image-dev
file: cf-cli-resource/ci/tasks/run-shellspec.yml
vars:
ccr-test-jobs: 5
ccr-cf-cli-version: 6
- name: test-cf-cli-v7
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
passed: [build]
trigger: true
- get: resource-image-dev
passed: [build]
trigger: true
- task: test
image: resource-image-dev
file: cf-cli-resource/ci/tasks/run-shellspec.yml
vars:
ccr-test-jobs: 5
ccr-cf-cli-version: 7
- name: test-cf-cli-v8
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
passed: [build]
trigger: true
- get: resource-image-dev
passed: [build]
trigger: true
- task: test
image: resource-image-dev
file: cf-cli-resource/ci/tasks/run-shellspec.yml
vars:
ccr-test-jobs: 5
ccr-cf-cli-version: 8
- name: scan-image
plan:
- in_parallel:
- get: cf-cli-resource
passed: [test-cf-cli-v6, test-cf-cli-v7, test-cf-cli-v8]
- get: resource-image-dev
resource: resource-image-dev
passed: [test-cf-cli-v6, test-cf-cli-v7, test-cf-cli-v8]
params: {format: oci}
trigger: true
- get: trivy
trigger: true
- get: trivy-db
trigger: true
params:
globs:
- trivy-offline.db.tgz
- task: scan
image: trivy
config:
platform: linux
inputs:
- name: cf-cli-resource
- name: resource-image-dev
path: image
- name: trivy-db
run:
path: sh
args:
- -c
- |
mkdir db
tar -xzf trivy-db/trivy-offline.db.tgz -C ./db
trivy \
--cache-dir $(pwd) \
image \
--severity "HIGH,CRITICAL" \
--ignore-unfixed \
--exit-code 1 \
--input image/image.tar \
--skip-files opt/cf-cli-7.5.0/cf7 \
--skip-files opt/cf-cli-8.4.0/cf8 \
--skip-files /usr/local/bin/yq
- name: shipit
public: true
serial_groups: [version]
plan:
- in_parallel:
- get: cf-cli-resource
passed: [scan-image]
- get: resource-image-dev
passed: [scan-image]
params: {format: oci}
- get: version
params: {bump: final}
- load_var: version-number
file: version/version
- task: prepare-github-release
file: cf-cli-resource/ci/tasks/prepare-github-release.yml
- put: github-release
params:
name: release-output/release-name
tag: release-output/release-tag
commitish: release-output/commitish
body: release-output/RELEASE_NOTES.md
- put: version
params: {file: version/version}
- put: resource-image-final
inputs: [resource-image-dev, version]
params:
image: resource-image-dev/image.tar
version: ((.:version-number))
bump_aliases: true
- put: notify
params:
message: |
New release announcement!
https://github.com/nulldriver/cf-cli-resource/releases/tag/v((.:version-number))
mode: concise
alert_type: success
- name: bump-major
public: true
serial_groups: [version]
plan:
- get: version
params: {bump: major, pre: rc}
- put: version
params: {file: version/version}
- name: bump-minor
public: true
serial_groups: [version]
plan:
- get: version
params: {bump: minor, pre: rc}
- put: version
params: {file: version/version}
- name: bump-patch
public: true
serial_groups: [version]
plan:
- get: version
passed: [shipit]
params: {bump: patch, pre: rc}
trigger: true
- put: version
params: {file: version/version}
- name: setup
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
passed: [build]
- get: bookstore-service-broker
- task: build-test-app-image
privileged: true
file: cf-cli-resource/ci/tasks/build-image.yml
input_mapping:
project: cf-cli-resource
params:
CONTEXT: spec/fixture/static-app
- in_parallel:
- put: test-app-image
params:
image: image/image.tar
get_params: {skip_download: true}
- put: prepare-cloud-foundry
resource: cloud-foundry
params:
commands:
- command: create-org
- command: create-space
get_params: {skip_download: true}
- in_parallel:
- put: sync-service-broker
resource: cloud-foundry
params:
commands:
- command: push
app_name: bookstore-service-broker
path: bookstore-service-broker/build/libs/bookstore-service-broker-0.0.1.BUILD-SNAPSHOT.jar
manifest: bookstore-service-broker/deploy/cloudfoundry/manifest.yml
- command: create-service-broker
service_broker: bookstore
username: admin
password: supersecret
url: https://bookstore-service-broker.((ccr-cf-apps-domain))
- command: enable-service-access
service_broker: bookstore
- put: async-service-broker
resource: cloud-foundry
params:
commands:
- command: push
app_name: bookstore-service-broker-async
path: bookstore-service-broker/build/libs/bookstore-service-broker-0.0.1.BUILD-SNAPSHOT.jar
manifest: bookstore-service-broker/deploy/cloudfoundry/manifest.yml
- command: create-service-broker
service_broker: bookstore-async
username: admin
password: supersecret
url: https://bookstore-service-broker-async.((ccr-cf-apps-domain))
- command: enable-service-access
service_broker: bookstore-async
- name: cleanup-failed-tests
serial: true
public: true
plan:
- in_parallel:
- get: cf-cli-resource
- get: resource-image-dev
passed: [build]
- task: cleanup
image: resource-image-dev
file: cf-cli-resource/ci/tasks/cleanup-failed-tests.yml
vars:
ccr-cf-cli-version: 8
resources:
- name: cf-cli-resource
type: git
icon: github
source:
uri: [email protected]:nulldriver/cf-cli-resource.git
private_key: ((git_key.private_key))
ignore_paths:
- .devcontainer
- .gitignore
- CHANGELOG.md
- LICENSE
- NOTICE.md
- README.md
- examples
- pipeline.yml
- name: version
type: semver
icon: tag
source:
driver: git
initial_version: 1.0.0-rc.0
uri: [email protected]:nulldriver/cf-cli-resource.git
branch: version
file: version
private_key: ((git_key.private_key))
- name: resource-image-dev
type: registry-image
icon: docker
source:
repository: nulldriver/cf-cli-resource-dev
tag: dev
username: ((docker.username))
password: ((docker.password))
- name: resource-image-final
type: registry-image
icon: docker
source:
repository: nulldriver/cf-cli-resource
username: ((docker.username))
password: ((docker.password))
- name: trivy
type: registry-image
icon: docker
source:
repository: aquasec/trivy
username: ((docker.username))
password: ((docker.password))
- name: trivy-db
type: github-release
icon: database
source:
owner: aquasecurity
repository: trivy-db
access_token: ((github_access_token))
- name: github-release
type: github-release
icon: package-variant-closed
source:
owner: nulldriver
repository: cf-cli-resource
access_token: ((github_access_token))
- name: notify
type: slack-notifier
icon: slack
source:
url: ((slack-webhook-url))
- name: test-app-image
type: registry-image
icon: docker
source:
repository: docker.nulldriver.com/test-app
tag: latest
username: ((docker-private.username))
password: ((docker-private.password))
- name: bookstore-service-broker
type: git
icon: github
source:
uri: [email protected]:nulldriver/bookstore-service-broker.git
private_key: ((git_key.private_key))
- name: cloud-foundry
type: cf-cli-resource
icon: cloud
source:
api: ((ccr-cf-api))
username: ((cf.username))
password: ((cf.password))
org: service-brokers
space: bookstore
- name: os-image
type: registry-image
icon: docker
source:
repository: alpine
tag: 3.16
resource_types:
- name: cf-cli-resource
type: registry-image
source:
repository: nulldriver/cf-cli-resource
- name: slack-notifier
type: registry-image
source:
repository: mockersf/concourse-slack-notifier