8c9a49540ac3428ece5f4704b836af7670164d11
[releng.git] / jjb / functest / xtesting-docker.yaml
1 ---
2 ##############################################
3 # job configuration for docker build and push
4 ##############################################
5 - project:
6
7     name: xtesting-docker
8
9     project: functest-xtesting
10
11     stream:
12       - master:
13           branch: '{stream}'
14           disabled: false
15       - kali:
16           branch: 'stable/{stream}'
17           disabled: false
18       - jerma:
19           branch: 'stable/{stream}'
20           disabled: false
21       - iruya:
22           branch: 'stable/{stream}'
23           disabled: false
24       - hunter:
25           branch: 'stable/{stream}'
26           disabled: false
27
28     arch_tag:
29       - 'amd64':
30           slave_label: 'lf-build2'
31       - 'arm64':
32           slave_label: 'opnfv-build-ubuntu-arm'
33
34     image:
35       - 'core'
36       - 'mts'
37
38     exclude:
39       - stream: 'kali'
40         image: 'mts'
41       - stream: 'jerma'
42         image: 'mts'
43       - stream: 'iruya'
44         image: 'mts'
45       - stream: 'hunter'
46         image: 'mts'
47
48     # settings for jobs run in multijob phases
49     build-job-settings: &build-job-settings
50       current-parameters: false
51       git-revision: true
52       node-parameters: false
53       predefined-parameters: |
54         PUSH_IMAGE=$PUSH_IMAGE
55         COMMIT_ID=$COMMIT_ID
56         GERRIT_REFNAME=$GERRIT_REFNAME
57         DOCKERFILE=$DOCKERFILE
58       kill-phase-on: FAILURE
59       abort-all-jobs: false
60
61     manifest-job-settings: &manifest-job-settings
62       current-parameters: false
63       git-revision: true
64       node-parameters: false
65       predefined-parameters:
66         GERRIT_REFNAME=$GERRIT_REFNAME
67       kill-phase-on: FAILURE
68       abort-all-jobs: false
69
70     # yamllint enable rule:key-duplicates
71     jobs:
72       - "xtesting-docker-{stream}"
73       - "xtesting-{image}-docker-build-{arch_tag}-{stream}"
74       - "xtesting-{image}-docker-manifest-{stream}"
75
76 ########################
77 # job templates
78 ########################
79 - job-template:
80     name: 'xtesting-docker-{stream}'
81
82     project-type: multijob
83
84     disabled: '{obj:disabled}'
85
86     parameters:
87       - xtesting-job-parameters:
88           project: '{project}'
89           branch: '{branch}'
90           slave_label: 'lf-build2'
91           arch_tag: 'amd64'
92
93     properties:
94       - throttle:
95           max-per-node: 1
96           option: 'project'
97
98     scm:
99       - git-scm
100
101     triggers:
102       - pollscm:
103           cron: "*/30 * * * *"
104       - gerrit-trigger-tag-created:
105           project: '{project}'
106
107     builders:
108       - multijob:
109           name: 'build xtesting images'
110           execution-type: PARALLEL
111           projects:
112             - name: 'xtesting-core-docker-build-amd64-{stream}'
113               <<: *build-job-settings
114             - name: 'xtesting-core-docker-build-arm64-{stream}'
115               <<: *build-job-settings
116       - multijob:
117           name: 'publish xtesting manifests'
118           execution-type: PARALLEL
119           projects:
120             - name: 'xtesting-core-docker-manifest-{stream}'
121               <<: *manifest-job-settings
122       - multijob:
123           name: 'build xtesting-mts images'
124           execution-type: PARALLEL
125           projects:
126             - name: 'xtesting-mts-docker-build-amd64-{stream}'
127               <<: *build-job-settings
128             - name: 'xtesting-mts-docker-build-arm64-{stream}'
129               <<: *build-job-settings
130       - multijob:
131           name: 'publish xtesting-mts manifests'
132           execution-type: PARALLEL
133           projects:
134             - name: 'xtesting-mts-docker-manifest-{stream}'
135               <<: *manifest-job-settings
136
137
138     publishers:
139       - 'xtesting-amd64-recipients'
140       - 'xtesting-arm64-recipients'
141
142 - job-template:
143     name: 'xtesting-{image}-docker-build-{arch_tag}-{stream}'
144     disabled: '{obj:disabled}'
145     parameters:
146       - xtesting-job-parameters:
147           project: '{project}'
148           branch: '{branch}'
149           slave_label: '{slave_label}'
150           arch_tag: '{arch_tag}'
151     scm:
152       - git-scm
153     builders:
154       - shell: |
155           #!/bin/bash -ex
156           case "{arch_tag}" in
157           "arm64")
158               sudo arch=arm64 amd64_dirs= arm64_dirs=docker/{image} arm_dirs= bash ./build.sh ;;
159           *)
160               sudo arch=amd64 amd64_dirs=docker/{image} arm64_dirs= arm_dirs= bash ./build.sh ;;
161           esac
162           exit $?
163
164 - job-template:
165     name: 'xtesting-{image}-docker-manifest-{stream}'
166
167     parameters:
168       - project-parameter:
169           project: '{project}'
170           branch: '{branch}'
171       - label:
172           name: SLAVE_LABEL
173           default: 'lf-build2'
174           description: 'Slave label on Jenkins'
175           all-nodes: false
176           node-eligibility: 'ignore-offline'
177       - string:
178           name: PROJECT
179           default: "{project}"
180           description: "Project name used to enable job conditions"
181       - string:
182           name: GIT_BASE
183           default: https://gerrit.opnfv.org/gerrit/$PROJECT
184           description: 'Git URL to use on this Jenkins Slave'
185       - string:
186           name: REPO
187           default: "opnfv"
188           description: "Repository name for xtesting images"
189
190
191     disabled: '{obj:disabled}'
192
193     builders:
194       - shell: |
195           #!/bin/bash -ex
196           case "{stream}" in
197           "master")
198               tag="latest" ;;
199           *)
200               tag="{stream}" ;;
201           esac
202           case "{image}" in
203           "core")
204               img="" ;;
205           *)
206               img="-{image}" ;;
207           esac
208           sudo manifest-tool push from-args \
209               --platforms linux/amd64,linux/arm64 \
210               --template $REPO/xtesting$img:ARCH-$tag \
211               --target $REPO/xtesting$img:$tag
212           exit $?
213
214 - parameter:
215     name: xtesting-job-parameters
216     parameters:
217       - project-parameter:
218           project: '{project}'
219           branch: '{branch}'
220       - label:
221           name: SLAVE_LABEL
222           default: '{slave_label}'
223           description: 'Slave label on Jenkins'
224           all-nodes: false
225           node-eligibility: 'ignore-offline'
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: GERRIT_REFNAME
240           default: ""
241           description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/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       - string:
255           name: REPO
256           default: "opnfv"
257           description: "Repository name for xtesting images"
258
259 # publisher macros
260 - publisher:
261     name: 'xtesting-arm64-recipients'
262     publishers:
263       - email:
264           recipients: >
265             cristina.pauna@enea.com
266             alexandru.avadanii@enea.com
267             delia.popescu@enea.com
268
269 - publisher:
270     name: 'xtesting-amd64-recipients'
271     publishers:
272       - email:
273           recipients: >
274             jalausuch@suse.com morgan.richomme@orange.com
275             cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
276             juha.kosonen@nokia.com wangwulin@huawei.com
277             valentin.boucher@kontron.com