Merge "Set Functest MultiJob as arch independent"
[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: true
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: true
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     disabled: '{obj:disabled}'
192     builders:
193       - shell: |
194           #!/bin/bash -ex
195           case "{stream}" in
196           "master")
197               tag="latest" ;;
198           "*")
199               tag="{stream}" ;;
200           esac
201           case "{image}" in
202           "vnf"|"restapi")
203               sudo manifest-tool push from-args \
204                   --platforms linux/amd64 \
205                   --template opnfv/functest-{image}:ARCH-$tag \
206                   --target opnfv/functest-{image}:$tag ;;
207           *)
208               sudo manifest-tool push from-args \
209                   --platforms linux/amd64,linux/arm64 \
210                   --template opnfv/functest-{image}:ARCH-$tag \
211                   --target opnfv/functest-{image}:$tag ;;
212           esac
213           exit $?
214
215 # parameter macro
216 - parameter:
217     name: job-parameters
218     parameters:
219       - project-parameter:
220           project: '{project}'
221           branch: '{branch}'
222       - label:
223           name: SLAVE_LABEL
224           default: '{slave_label}'
225           description: 'Slave label on Jenkins'
226       - string:
227           name: GIT_BASE
228           default: https://gerrit.opnfv.org/gerrit/$PROJECT
229           description: 'Git URL to use on this Jenkins Slave'
230       - string:
231           name: PUSH_IMAGE
232           default: "true"
233           description: "To enable/disable pushing the image to Dockerhub."
234       - string:
235           name: COMMIT_ID
236           default: ""
237           description: "commit id to make a snapshot docker image"
238       - string:
239           name: RELEASE_VERSION
240           default: ""
241           description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1"
242       - string:
243           name: DOCKERFILE
244           default: "Dockerfile"
245           description: "Dockerfile to use for creating the image."
246       - string:
247           name: ARCH_TAG
248           default: "{arch_tag}"
249           description: "If set, this value will be added to the docker image tag as a prefix"
250       - string:
251           name: PROJECT
252           default: "{project}"
253           description: "Project name used to enable job conditions"
254
255 # publisher macros
256 - publisher:
257     name: 'functest-arm64-recipients'
258     publishers:
259       - email:
260           recipients: >
261             cristina.pauna@enea.com
262             alexandru.avadanii@enea.com
263             delia.popescu@enea.com
264
265 - publisher:
266     name: 'functest-amd64-recipients'
267     publishers:
268       - email:
269           recipients: >
270             jalausuch@suse.com morgan.richomme@orange.com
271             cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
272             juha.kosonen@nokia.com wangwulin@huawei.com