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