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