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