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