328ef7c6c4c8f409f9ba42a9f2761cfc1b8477b2
[releng.git] / jjb / functest / functest-docker.yaml
1 ---
2 ##############################################
3 # job configuration for docker build and push
4 ##############################################
5 - project:
6
7     name: functest-docker
8
9     project: functest
10
11     stream:
12       - master:
13           branch: '{stream}'
14           disabled: false
15       - iruya:
16           branch: 'stable/{stream}'
17           disabled: false
18       - hunter:
19           branch: 'stable/{stream}'
20           disabled: false
21       - gambia:
22           branch: 'stable/{stream}'
23           disabled: false
24
25     arch_tag:
26       - 'amd64':
27           slave_label: 'opnfv-build-ubuntu'
28       - 'arm64':
29           slave_label: 'opnfv-build-ubuntu-arm'
30
31     # yamllint disable rule:key-duplicates
32     image:
33       - 'core'
34       - 'tempest'
35       - 'healthcheck'
36       - 'features'
37       - 'components'
38       - 'smoke'
39       - 'benchmarking'
40       - 'vnf'
41
42     exclude:
43       - stream: 'master'
44         image: 'components'
45       - stream: 'iruya'
46         image: 'components'
47       - stream: 'hunter'
48         image: 'components'
49
50     # settings for jobs run in multijob phases
51     build-job-settings: &build-job-settings
52       current-parameters: false
53       git-revision: true
54       node-parameters: false
55       predefined-parameters: |
56         PUSH_IMAGE=$PUSH_IMAGE
57         COMMIT_ID=$COMMIT_ID
58         GERRIT_REFNAME=$GERRIT_REFNAME
59         DOCKERFILE=$DOCKERFILE
60       kill-phase-on: FAILURE
61       abort-all-jobs: false
62
63     manifest-job-settings: &manifest-job-settings
64       current-parameters: false
65       git-revision: true
66       node-parameters: false
67       predefined-parameters:
68         GERRIT_REFNAME=$GERRIT_REFNAME
69       kill-phase-on: FAILURE
70       abort-all-jobs: false
71
72     # yamllint enable rule:key-duplicates
73     jobs:
74       - "functest-docker-{stream}"
75       - "functest-{image}-docker-build-{arch_tag}-{stream}"
76       - "functest-{image}-docker-manifest-{stream}"
77
78 ########################
79 # job templates
80 ########################
81 - job-template:
82     name: 'functest-docker-{stream}'
83
84     project-type: multijob
85
86     disabled: '{obj:disabled}'
87
88     parameters:
89       - functest-job-parameters:
90           project: '{project}'
91           branch: '{branch}'
92           slave_label: 'opnfv-build-ubuntu'
93           arch_tag: 'amd64'
94
95     properties:
96       - throttle:
97           max-per-node: 1
98           option: 'project'
99
100     scm:
101       - git-scm
102
103     triggers:
104       - pollscm:
105           cron: "*/30 * * * *"
106       - gerrit-trigger-tag-created:
107           project: '{project}'
108
109     builders:
110       - multijob:
111           name: 'build functest-core images'
112           execution-type: PARALLEL
113           projects:
114             - name: 'functest-core-docker-build-amd64-{stream}'
115               <<: *build-job-settings
116             - name: 'functest-core-docker-build-arm64-{stream}'
117               <<: *build-job-settings
118       - multijob:
119           name: 'publish functest-core manifests'
120           execution-type: PARALLEL
121           projects:
122             - name: 'functest-core-docker-manifest-{stream}'
123               <<: *manifest-job-settings
124       - multijob:
125           name: 'build functest-tempest images'
126           execution-type: PARALLEL
127           projects:
128             - name: 'functest-tempest-docker-build-amd64-{stream}'
129               <<: *build-job-settings
130             - name: 'functest-tempest-docker-build-arm64-{stream}'
131               <<: *build-job-settings
132       - multijob:
133           name: 'publish functest-tempest manifests'
134           execution-type: PARALLEL
135           projects:
136             - name: 'functest-tempest-docker-manifest-{stream}'
137               <<: *manifest-job-settings
138       - multijob:
139           name: 'build all functest images'
140           condition: SUCCESSFUL
141           execution-type: PARALLEL
142           projects:
143             - name: 'functest-healthcheck-docker-build-amd64-{stream}'
144               <<: *build-job-settings
145             - name: 'functest-healthcheck-docker-build-arm64-{stream}'
146               <<: *build-job-settings
147             - name: 'functest-features-docker-build-amd64-{stream}'
148               <<: *build-job-settings
149             - name: 'functest-features-docker-build-arm64-{stream}'
150               <<: *build-job-settings
151             - name: 'functest-components-docker-build-amd64-{stream}'
152               <<: *build-job-settings
153             - name: 'functest-components-docker-build-arm64-{stream}'
154               <<: *build-job-settings
155             - name: 'functest-smoke-docker-build-amd64-{stream}'
156               <<: *build-job-settings
157             - name: 'functest-smoke-docker-build-arm64-{stream}'
158               <<: *build-job-settings
159             - name: 'functest-benchmarking-docker-build-amd64-{stream}'
160               <<: *build-job-settings
161             - name: 'functest-benchmarking-docker-build-arm64-{stream}'
162               <<: *build-job-settings
163             - name: 'functest-vnf-docker-build-amd64-{stream}'
164               <<: *build-job-settings
165             - name: 'functest-vnf-docker-build-arm64-{stream}'
166               <<: *build-job-settings
167       - multijob:
168           name: 'publish all manifests'
169           condition: SUCCESSFUL
170           execution-type: PARALLEL
171           projects:
172             - name: 'functest-healthcheck-docker-manifest-{stream}'
173               <<: *manifest-job-settings
174             - name: 'functest-features-docker-manifest-{stream}'
175               <<: *manifest-job-settings
176             - name: 'functest-components-docker-manifest-{stream}'
177               <<: *manifest-job-settings
178             - name: 'functest-smoke-docker-manifest-{stream}'
179               <<: *manifest-job-settings
180             - name: 'functest-benchmarking-docker-manifest-{stream}'
181               <<: *manifest-job-settings
182             - name: 'functest-vnf-docker-manifest-{stream}'
183               <<: *manifest-job-settings
184
185     publishers:
186       - 'functest-amd64-recipients'
187       - 'functest-arm64-recipients'
188
189 - job-template:
190     name: 'functest-{image}-docker-build-{arch_tag}-{stream}'
191     disabled: '{obj:disabled}'
192     parameters:
193       - functest-job-parameters:
194           project: '{project}'
195           branch: '{branch}'
196           slave_label: '{slave_label}'
197           arch_tag: '{arch_tag}'
198     scm:
199       - git-scm
200     builders:
201       - shell: |
202           #!/bin/bash -ex
203           case "{arch_tag}" in
204           "arm64")
205               sudo amd64_dirs= arm64_dirs=docker/{image} arm_dirs= bash ./build.sh ;;
206           *)
207               sudo amd64_dirs=docker/{image} arm64_dirs= arm_dirs= bash ./build.sh ;;
208           esac
209           exit $?
210
211 - job-template:
212     name: 'functest-{image}-docker-manifest-{stream}'
213
214     parameters:
215       - project-parameter:
216           project: '{project}'
217           branch: '{branch}'
218       - label:
219           name: SLAVE_LABEL
220           default: 'opnfv-build-ubuntu'
221           description: 'Slave label on Jenkins'
222           all-nodes: false
223           node-eligibility: 'ignore-offline'
224       - string:
225           name: PROJECT
226           default: "{project}"
227           description: "Project name used to enable job conditions"
228       - string:
229           name: GIT_BASE
230           default: https://gerrit.opnfv.org/gerrit/$PROJECT
231           description: 'Git URL to use on this Jenkins Slave'
232       - string:
233           name: REPO
234           default: "opnfv"
235           description: "Repository name for functest images"
236
237
238     disabled: '{obj:disabled}'
239
240     builders:
241       - shell: |
242           #!/bin/bash -ex
243           case "{stream}" in
244           "master")
245               tag="latest" ;;
246           *)
247               tag="{stream}" ;;
248           esac
249           sudo manifest-tool push from-args \
250               --platforms linux/amd64,linux/arm64 \
251               --template $REPO/functest-{image}:ARCH-$tag \
252               --target $REPO/functest-{image}:$tag
253           exit $?
254
255 # parameter macro
256 - parameter:
257     name: functest-job-parameters
258     parameters:
259       - project-parameter:
260           project: '{project}'
261           branch: '{branch}'
262       - label:
263           name: SLAVE_LABEL
264           default: '{slave_label}'
265           description: 'Slave label on Jenkins'
266           all-nodes: false
267           node-eligibility: 'ignore-offline'
268       - string:
269           name: GIT_BASE
270           default: https://gerrit.opnfv.org/gerrit/$PROJECT
271           description: 'Git URL to use on this Jenkins Slave'
272       - string:
273           name: PUSH_IMAGE
274           default: "true"
275           description: "To enable/disable pushing the image to Dockerhub."
276       - string:
277           name: COMMIT_ID
278           default: ""
279           description: "commit id to make a snapshot docker image"
280       - string:
281           name: GERRIT_REFNAME
282           default: ""
283           description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
284       - string:
285           name: DOCKERFILE
286           default: "Dockerfile"
287           description: "Dockerfile to use for creating the image."
288       - string:
289           name: ARCH_TAG
290           default: "{arch_tag}"
291           description: "If set, this value will be added to the docker image tag as a prefix"
292       - string:
293           name: PROJECT
294           default: "{project}"
295           description: "Project name used to enable job conditions"
296       - string:
297           name: REPO
298           default: "opnfv"
299           description: "Repository name for functest images"
300
301 # publisher macros
302 - publisher:
303     name: 'functest-arm64-recipients'
304     publishers:
305       - email:
306           recipients: >
307             cristina.pauna@enea.com
308             alexandru.avadanii@enea.com
309             delia.popescu@enea.com
310
311 - publisher:
312     name: 'functest-amd64-recipients'
313     publishers:
314       - email:
315           recipients: >
316             jalausuch@suse.com morgan.richomme@orange.com
317             cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
318             juha.kosonen@nokia.com wangwulin@huawei.com
319             valentin.boucher@kontron.com