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