summaryrefslogtreecommitdiffstats
path: root/jjb/functest/functest-kubernetes-ng.yaml
blob: 19f93d6901601ab12680c70c245307ad4ad750d1 (plain)
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
404
405
---
- functest-kubernetes-ng-containers: &functest-kubernetes-ng-containers
    name: 'functest-kubernetes-ng-containers'
    repo: '{repo}'
    port: '{port}'
    container: '{container}'
    tag: '{tag}'

- functest-kubernetes-ng-params: &functest-kubernetes-ng-params
    name: 'functest-kubernetes-ng-params'
    repo: 'opnfv'
    port:
    tag:
      - v1.20:
          build_args:
          branch: stable/leguer
          slave: lf-virtual1
          dependency: 3.12
          from: s/:leguer$/:v1.20/g
      - v1.19:
          build_args:
          branch: stable/kali
          slave: lf-virtual1
          dependency: 3.11
          from: s/:kali$/:v1.19/g
      - v1.18:
          branch: stable/kali
          slave: lf-virtual1
          dependency: 3.11
          build_args:
            - K8S_TAG=1.18
          from: s/:kali$/:v1.18/g

- functest-kubernetes-ng-jobs: &functest-kubernetes-ng-jobs
    name: 'functest-kubernetes-ng-jobs'
    current-parameters: true

- parameter:
    name: functest-kubernetes-ng-slave
    parameters:
      - label:
          name: slave
          default: '{slave}'

- functest-kubernetes-ng-build-containers: &functest-kubernetes-ng-build-containers
    name: 'functest-kubernetes-ng-build-containers'
    <<: *functest-kubernetes-ng-containers
    ref_arg: '{ref_arg}'
    path: '{path}'
    build_args: '{build_args}'
    from: '{from}'

- builder:
    name: functest-kubernetes-ng-build-containers
    builders:
      - shell: |
          set +x
          if [ "{repo}" = "_" ]; then
            image={container}:{tag}
          elif [ "{port}" = "None" ]; then
            image={repo}/{container}:{tag}
          else
            image={repo}:{port}/{container}:{tag}
          fi
          build_args=""
          if [ "{build_args}" != "None" ]; then
            for i in $(echo {build_args} | tr -d '[]' |sed "s/, / /g" ); \
              do build_args="--build-arg $i $build_args"; done
          fi
          if [ "{ref_arg}" != "None" ]; then
            build_args="$build_args --build-arg {ref_arg}={ref}"
          fi
          cd {path}
          if [ "{from}" != "None" ]; then
              sed -i {from} Dockerfile
          fi
          sudo docker build $build_args \
            --pull=false --no-cache --force-rm=true \
            -t $image .

- scm:
    name: functest-kubernetes-ng-scm
    scm:
      - git:
          url: 'https://gerrit.opnfv.org/gerrit/functest-kubernetes'
          refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*'
          branches:
            - '{ref}'

- functest-kubernetes-ng-dep: &functest-kubernetes-ng-dep
    name: 'functest-kubernetes-ng-containers'
    repo: '{repo}'
    port: '{port}'
    tag: '{tag}'
    dependency: '{dependency}'

- builder:
    name: functest-kubernetes-ng-pull-dep-images
    builders:
      - shell: |
          set +x
          if [ "_" = "_" ]; then
            image=alpine:{dependency}
          elif [ "None" = "None" ]; then
            image=_/alpine:{dependency}
          else
            image=_:/alpine:{dependency}
          fi
          sudo docker pull $image || true

- builder:
    name: functest-kubernetes-ng-remove-dep-images
    builders:
      - shell: |
          set +x
          if [ "_" = "_" ]; then
            image=alpine:{dependency}
          elif [ "" = "None" ]; then
            image=_/alpine:{dependency}
          else
            image=_:/alpine:{dependency}
          fi
          sudo docker rmi $image || true

- job-template:
    name: 'functest-kubernetes-ng-{repo}-{tag}-dep-pull'
    parameters:
      - functest-kubernetes-ng-slave:
          slave: '{slave}'
    builders:
      - functest-kubernetes-ng-pull-dep-images:
          <<: *functest-kubernetes-ng-dep

- project:
    name: 'functest-kubernetes-ng-{repo}-{tag}-dep-pull'
    <<: *functest-kubernetes-ng-params
    jobs:
      - 'functest-kubernetes-ng-{repo}-{tag}-dep-pull'

- job-template:
    name: 'functest-kubernetes-ng-{repo}-{tag}-dep-rmi'
    parameters:
      - functest-kubernetes-ng-slave:
          slave: '{slave}'
    builders:
      - functest-kubernetes-ng-remove-dep-images:
          <<: *functest-kubernetes-ng-dep

- project:
    name: 'functest-kubernetes-ng-{repo}-{tag}-dep-rmi'
    <<: *functest-kubernetes-ng-params
    jobs:
      - 'functest-kubernetes-ng-{repo}-{tag}-dep-rmi'

- builder:
    name: functest-kubernetes-ng-push-containers
    builders:
      - shell: |
          set +x
          if [ "{repo}" = "_" ]; then
            image={container}:{tag}
          elif [ "{port}" = "None" ]; then
            image={repo}/{container}:{tag}
          else
            image={repo}:{port}/{container}:{tag}
          fi
          sudo docker push $image

- trigger:
    name: functest-kubernetes-ng-commit
    triggers:
      - pollscm:
          cron: "*/30 * * * *"

- job-template:
    name: 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'
    parameters:
      - functest-kubernetes-ng-slave:
          slave: '{slave}'
    scm:
      - functest-kubernetes-ng-scm:
          ref: '{branch}'
    builders:
      - functest-kubernetes-ng-build-containers:
          <<: *functest-kubernetes-ng-build-containers
          ref: '{branch}'
          build_args: '{build_args}'
      - functest-kubernetes-ng-push-containers:
          <<: *functest-kubernetes-ng-build-containers
          ref: '{branch}'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-core-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-core
    ref_arg: BRANCH
    path: docker/core
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-healthcheck-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-healthcheck
    ref_arg:
    path: docker/healthcheck
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-cnf-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-cnf
    ref_arg: BRANCH
    path: docker/cnf
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-security-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-security
    ref_arg: BRANCH
    path: docker/security
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-smoke-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-smoke
    ref_arg:
    path: docker/smoke
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- project:
    name: functest-kubernetes-ng-opnfv-functest-kubernetes-benchmarking-{tag}-build
    <<: *functest-kubernetes-ng-params
    container: functest-kubernetes-benchmarking
    ref_arg:
    path: docker/benchmarking
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-build'

- job-template:
    name: 'functest-kubernetes-ng-{tag}-docker'
    project-type: multijob
    triggers:
      - functest-kubernetes-ng-commit
    scm:
      - functest-kubernetes-ng-scm:
          ref: '{branch}'
    parameters:
      - functest-kubernetes-ng-slave:
          slave: '{slave}'
    # PyYAML and yamllint differ here
    # see https://github.com/yaml/pyyaml/issues/234
    # yamllint disable rule:indentation
    properties:
      - build-blocker:
          blocking-jobs:
          - ^functest-kubernetes-ng-{tag}-(daily|docker|review)$
    # yamllint enable rule:indentation
    builders:
      - multijob:
          name: remove dependency
          projects:
            - name: 'functest-kubernetes-ng-{repo}-{tag}-dep-rmi'
              <<: *functest-kubernetes-ng-jobs
      - multijob:
          name: pull dependency
          projects:
            - name: 'functest-kubernetes-ng-{repo}-{tag}-dep-pull'
              <<: *functest-kubernetes-ng-jobs
      - multijob:
          name: build opnfv/functest-kubernetes-core
          projects:
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-core-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
      - multijob:
          name: build containers
          projects:
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-healthcheck-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-cnf-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-security-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
      - multijob:
          name: build opnfv/functest-kubernetes-smoke
          projects:
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-smoke-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
      - multijob:
          name: build opnfv/functest-kubernetes-benchmarking
          projects:
            - name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-benchmarking-{tag}-build'
              <<: *functest-kubernetes-ng-jobs
    publishers:
      - email:
          recipients: cedric.ollivier@orange.com

- builder:
    name: functest-kubernetes-ng-trivy
    builders:
      - shell: |
          sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \
          apt-get install curl -y

          curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b .
          if [ "{repo}" = "_" ]; then
            image={container}:{tag}
          elif [ "{port}" = "None" ]; then
            image={repo}/{container}:{tag}
          else
            image={repo}:{port}/{container}:{tag}
          fi
          ./trivy --exit-code 1 $image

- job-template:
    name: 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'
    triggers:
      - timed: '@daily'
    parameters:
      - functest-kubernetes-ng-slave:
          slave: '{slave}'
    builders:
      - functest-kubernetes-ng-trivy:
          <<: *functest-kubernetes-ng-containers
    publishers:
      - email:
          recipients: cedric.ollivier@orange.com

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-core-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-core'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-healthcheck-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-healthcheck'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-cnf-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-cnf'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-security-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-security'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-smoke-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-smoke'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng-opnfv-functest-kubernetes-benchmarking-trivy'
    <<: *functest-kubernetes-ng-params
    container: 'functest-kubernetes-benchmarking'
    jobs:
      - 'functest-kubernetes-ng-{repo}-{container}-{tag}-trivy'

- project:
    name: 'functest-kubernetes-ng'
    <<: *functest-kubernetes-ng-params
    jobs:
      - 'functest-kubernetes-ng-{tag}-docker'

- view:
    name: functest-kubernetes-ng-docker
    view-type: list
    columns:
      - status
      - weather
      - job
      - last-success
      - last-failure
      - last-duration
    regex: ^functest-kubernetes-ng-[a-z0-9.]+-docker$

- view:
    name: functest-kubernetes-ng-trivy
    view-type: list
    columns:
      - status
      - weather
      - job
      - last-success
      - last-failure
      - last-duration
    regex: ^functest-kubernetes-ng-[a-z0-9-.]+-trivy$