c8c55e74242eca651a864348dbb6d255e78484fe
[releng.git] / 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       - iruya:
16           branch: 'stable/{stream}'
17           disabled: false
18       - hunter:
19           branch: 'stable/{stream}'
20           disabled: false
21
22     arch_tag:
23       - 'amd64':
24           slave_label: 'opnfv-build-ubuntu'
25       - 'arm64':
26           slave_label: 'opnfv-build-ubuntu-arm'
27
28     # yamllint disable rule:key-duplicates
29     image:
30       - 'core'
31       - 'healthcheck'
32       - 'features'
33       - 'smoke'
34
35     # settings for jobs run in multijob phases
36     build-job-settings: &build-job-settings
37       current-parameters: false
38       git-revision: true
39       node-parameters: false
40       predefined-parameters: |
41         PUSH_IMAGE=$PUSH_IMAGE
42         COMMIT_ID=$COMMIT_ID
43         GERRIT_REFNAME=$GERRIT_REFNAME
44         DOCKERFILE=$DOCKERFILE
45       kill-phase-on: FAILURE
46       abort-all-jobs: false
47
48     manifest-job-settings: &manifest-job-settings
49       current-parameters: false
50       git-revision: true
51       node-parameters: false
52       predefined-parameters:
53         GERRIT_REFNAME=$GERRIT_REFNAME
54       kill-phase-on: FAILURE
55       abort-all-jobs: false
56
57     # yamllint enable rule:key-duplicates
58     jobs:
59       - "functest-kubernetes-docker-{stream}"
60       - "functest-kubernetes-{image}-docker-build-{arch_tag}-{stream}"
61       - "functest-kubernetes-{image}-docker-manifest-{stream}"
62
63 ########################
64 # job templates
65 ########################
66 - job-template:
67     name: 'functest-kubernetes-docker-{stream}'
68
69     project-type: multijob
70
71     disabled: '{obj:disabled}'
72
73     parameters:
74       - functest-kubernetes-job-parameters:
75           project: '{project}'
76           branch: '{branch}'
77           slave_label: 'opnfv-build-ubuntu'
78           arch_tag: 'amd64'
79
80     properties:
81       - throttle:
82           max-per-node: 1
83           option: 'project'
84
85     scm:
86       - git-scm
87
88     triggers:
89       - pollscm:
90           cron: "*/30 * * * *"
91       - gerrit-trigger-tag-created:
92           project: '{project}'
93
94     builders:
95       - multijob:
96           name: 'build functest-kubernetes-core images'
97           execution-type: PARALLEL
98           projects:
99             - name: 'functest-kubernetes-core-docker-build-amd64-{stream}'
100               <<: *build-job-settings
101             - name: 'functest-kubernetes-core-docker-build-arm64-{stream}'
102               <<: *build-job-settings
103       - multijob:
104           name: 'publish functest-kubernetes-core manifests'
105           execution-type: PARALLEL
106           projects:
107             - name: 'functest-kubernetes-core-docker-manifest-{stream}'
108               <<: *manifest-job-settings
109       - multijob:
110           name: 'build functest-kubernetes-healthcheck images'
111           execution-type: PARALLEL
112           projects:
113             - name: 'functest-kubernetes-healthcheck-docker-build-amd64-{stream}'
114               <<: *build-job-settings
115             - name: 'functest-kubernetes-healthcheck-docker-build-arm64-{stream}'
116               <<: *build-job-settings
117       - multijob:
118           name: 'publish functest-kubernetes-healthcheck manifests'
119           execution-type: PARALLEL
120           projects:
121             - name: 'functest-kubernetes-healthcheck-docker-manifest-{stream}'
122               <<: *manifest-job-settings
123       - multijob:
124           name: 'build all functest-kubernetes images'
125           condition: SUCCESSFUL
126           execution-type: PARALLEL
127           projects:
128             - name: 'functest-kubernetes-features-docker-build-amd64-{stream}'
129               <<: *build-job-settings
130             - name: 'functest-kubernetes-features-docker-build-arm64-{stream}'
131               <<: *build-job-settings
132             - name: 'functest-kubernetes-smoke-docker-build-amd64-{stream}'
133               <<: *build-job-settings
134             - name: 'functest-kubernetes-smoke-docker-build-arm64-{stream}'
135               <<: *build-job-settings
136       - multijob:
137           name: 'publish all manifests'
138           condition: SUCCESSFUL
139           execution-type: PARALLEL
140           projects:
141             - name: 'functest-kubernetes-features-docker-manifest-{stream}'
142               <<: *manifest-job-settings
143             - name: 'functest-kubernetes-smoke-docker-manifest-{stream}'
144               <<: *manifest-job-settings
145
146     publishers:
147       - 'functest-kubernetes-amd64-recipients'
148       - 'functest-kubernetes-arm64-recipients'
149
150 - job-template:
151     name: 'functest-kubernetes-{image}-docker-build-{arch_tag}-{stream}'
152     disabled: '{obj:disabled}'
153     parameters:
154       - functest-kubernetes-job-parameters:
155           project: '{project}'
156           branch: '{branch}'
157           slave_label: '{slave_label}'
158           arch_tag: '{arch_tag}'
159     scm:
160       - git-scm
161     builders:
162       - shell: |
163           #!/bin/bash -ex
164           case "{arch_tag}" in
165           "arm64")
166               sudo amd64_dirs= arm64_dirs=docker/{image} bash ./build.sh ;;
167           *)
168               sudo amd64_dirs=docker/{image} arm64_dirs= bash ./build.sh ;;
169           esac
170           exit $?
171
172 - job-template:
173     name: 'functest-kubernetes-{image}-docker-manifest-{stream}'
174
175     parameters:
176       - project-parameter:
177           project: '{project}'
178           branch: '{branch}'
179       - label:
180           name: SLAVE_LABEL
181           default: 'opnfv-build-ubuntu'
182           description: 'Slave label on Jenkins'
183           all-nodes: false
184           node-eligibility: 'ignore-offline'
185       - string:
186           name: PROJECT
187           default: "{project}"
188           description: "Project name used to enable job conditions"
189       - string:
190           name: GIT_BASE
191           default: https://gerrit.opnfv.org/gerrit/$PROJECT
192           description: 'Git URL to use on this Jenkins Slave'
193       - string:
194           name: REPO
195           default: "opnfv"
196           description: "Repository name for functest-kubernetes images"
197
198
199     disabled: '{obj:disabled}'
200
201     builders:
202       - shell: |
203           #!/bin/bash -ex
204           case "{stream}" in
205           "master")
206               tag="latest" ;;
207           *)
208               tag="{stream}" ;;
209           esac
210           sudo manifest-tool push from-args \
211               --platforms linux/amd64,linux/arm64 \
212               --template $REPO/functest-kubernetes-{image}:ARCH-$tag \
213               --target $REPO/functest-kubernetes-{image}:$tag
214           exit $?
215
216 # parameter macro
217 - parameter:
218     name: functest-kubernetes-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 functest-kubernetes images"
261
262 # publisher macros
263 - publisher:
264     name: 'functest-kubernetes-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: 'functest-kubernetes-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