jjb/releng: fix compass-container $DOCKERFILE
[releng.git] / jjb / releng / compass4nfv-docker.yaml
1 ---
2 ##############################################
3 # job configuration for docker build and push
4 ##############################################
5 - project:
6
7     name: compass-docker
8
9     project: compass-containers
10
11     stream:
12       - master:
13           branch: '{stream}'
14           disabled: false
15       - euphrates:
16           branch: 'stable/{stream}'
17           disabled: true
18
19     arch_tag:
20       - 'amd64':
21           slave_label: 'opnfv-build-ubuntu'
22           docker_file: 'Dockerfile'
23       - 'arm64':
24           slave_label: 'opnfv-build-ubuntu-arm'
25           docker_file: 'Dockerfile-arm64'
26
27     # yamllint disable rule:key-duplicates
28     image:
29       - 'tasks'
30       - 'cobbler'
31       - 'db'
32       - 'deck'
33       - 'tasks-base'
34       - 'tasks-k8s'
35       - 'tasks-osa'
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       kill-phase-on: FAILURE
47       abort-all-jobs: false
48
49     manifest-job-settings: &manifest-job-settings
50       current-parameters: false
51       git-revision: true
52       node-parameters: false
53       predefined-parameters:
54         GERRIT_REFNAME=$GERRIT_REFNAME
55       kill-phase-on: FAILURE
56       abort-all-jobs: false
57
58     # yamllint enable rule:key-duplicates
59     jobs:
60       - "compass-docker-{stream}"
61       - "compass-{image}-build-{arch_tag}-{stream}"
62       - "compass-{image}-manifest-{stream}"
63
64 ########################
65 # job templates
66 ########################
67 - job-template:
68     name: 'compass-docker-{stream}'
69
70     project-type: multijob
71
72     disabled: '{obj:disabled}'
73
74     parameters:
75       - compass-job-parameters:
76           project: '{project}'
77           branch: '{branch}'
78           slave_label: 'opnfv-build-ubuntu'
79           docker_file: 'Dockerfile'
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
94     builders:
95       - multijob:
96           name: 'build compass-tasks-base images'
97           execution-type: PARALLEL
98           projects:
99             - name: 'compass-tasks-base-build-amd64-{stream}'
100               <<: *build-job-settings
101             - name: 'compass-tasks-base-build-arm64-{stream}'
102               <<: *build-job-settings
103       - multijob:
104           name: 'publish compass-tasks-base manifests'
105           execution-type: PARALLEL
106           projects:
107             - name: 'compass-tasks-base-manifest-{stream}'
108               <<: *manifest-job-settings
109       - multijob:
110           name: 'build all compass images'
111           condition: SUCCESSFUL
112           execution-type: PARALLEL
113           projects:
114             - name: 'compass-cobbler-build-amd64-{stream}'
115               <<: *build-job-settings
116             - name: 'compass-db-build-amd64-{stream}'
117               <<: *build-job-settings
118             - name: 'compass-deck-build-amd64-{stream}'
119               <<: *build-job-settings
120             - name: 'compass-tasks-build-amd64-{stream}'
121               <<: *build-job-settings
122             - name: 'compass-tasks-k8s-build-amd64-{stream}'
123               <<: *build-job-settings
124             - name: 'compass-tasks-osa-build-amd64-{stream}'
125               <<: *build-job-settings
126             - name: 'compass-cobbler-build-arm64-{stream}'
127               <<: *build-job-settings
128             - name: 'compass-db-build-arm64-{stream}'
129               <<: *build-job-settings
130             - name: 'compass-deck-build-arm64-{stream}'
131               <<: *build-job-settings
132             - name: 'compass-tasks-build-arm64-{stream}'
133               <<: *build-job-settings
134             - name: 'compass-tasks-k8s-build-arm64-{stream}'
135               <<: *build-job-settings
136             - name: 'compass-tasks-osa-build-arm64-{stream}'
137               <<: *build-job-settings
138       - multijob:
139           name: 'publish all manifests'
140           execution-type: PARALLEL
141           projects:
142             - name: 'compass-cobbler-manifest-{stream}'
143               <<: *manifest-job-settings
144             - name: 'compass-db-manifest-{stream}'
145               <<: *manifest-job-settings
146             - name: 'compass-deck-manifest-{stream}'
147               <<: *manifest-job-settings
148             - name: 'compass-tasks-manifest-{stream}'
149               <<: *manifest-job-settings
150             - name: 'compass-tasks-k8s-manifest-{stream}'
151               <<: *manifest-job-settings
152             - name: 'compass-tasks-osa-manifest-{stream}'
153               <<: *manifest-job-settings
154
155     publishers:
156       - 'compass-amd64-recipients'
157       - 'compass-arm64-recipients'
158
159 - job-template:
160     name: 'compass-{image}-build-{arch_tag}-{stream}'
161     disabled: '{obj:disabled}'
162     parameters:
163       - compass-job-parameters:
164           project: '{project}'
165           branch: '{branch}'
166           slave_label: '{slave_label}'
167           docker_file: '{docker_file}'
168           arch_tag: '{arch_tag}'
169       - string:
170           name: DOCKER_REPO_NAME
171           default: "opnfv/compass-{image}"
172           description: "Dockerhub repo to be pushed to."
173       - string:
174           name: DOCKER_DIR
175           default: "compass-{image}"
176           description: "Directory containing files needed by the Dockerfile"
177     scm:
178       - git-scm
179     builders:
180       - shell:
181           !include-raw-escape: ./opnfv-docker.sh
182
183 - job-template:
184     name: 'compass-{image}-manifest-{stream}'
185     disabled: '{obj:disabled}'
186     parameters:
187       - compass-job-parameters:
188           project: '{project}'
189           branch: '{branch}'
190           slave_label: 'opnfv-build-ubuntu'
191           docker_file: 'Dockerfile'
192           arch_tag: 'amd64'
193     builders:
194       - shell: |
195           #!/bin/bash -ex
196           case "{stream}" in
197           "master")
198               tag="latest" ;;
199           *)
200               tag="{stream}" ;;
201           esac
202           sudo manifest-tool push from-args \
203               --platforms linux/amd64,linux/arm64 \
204               --template opnfv/compass-{image}:ARCH-$tag \
205               --target opnfv/compass-{image}:$tag
206           exit $?
207
208 # parameter macro
209 - parameter:
210     name: compass-job-parameters
211     parameters:
212       - project-parameter:
213           project: '{project}'
214           branch: '{branch}'
215       - label:
216           name: SLAVE_LABEL
217           default: '{slave_label}'
218           description: 'Slave label on Jenkins'
219       - string:
220           name: GIT_BASE
221           default: https://gerrit.opnfv.org/gerrit/$PROJECT
222           description: 'Git URL to use on this Jenkins Slave'
223       - string:
224           name: PUSH_IMAGE
225           default: "true"
226           description: "To enable/disable pushing the image to Dockerhub."
227       - string:
228           name: COMMIT_ID
229           default: ""
230           description: "commit id to make a snapshot docker image"
231       - string:
232           name: GERRIT_REFNAME
233           default: ""
234           description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
235       - string:
236           name: DOCKERFILE
237           default: '{docker_file}'
238           description: "Dockerfile to use for creating the image."
239       - string:
240           name: ARCH_TAG
241           default: "{arch_tag}"
242           description: "If set, this value will be added to the docker image tag as a prefix"
243       - string:
244           name: PROJECT
245           default: "{project}"
246           description: "Project name used to enable job conditions"
247
248 # publisher macros
249 - publisher:
250     name: 'compass-amd64-recipients'
251     publishers:
252       - email:
253           recipients: >
254             chigang@huawei.com
255             huangxiangyui5@huawei.com
256             xueyifei@huawei.com
257             wutianwei1@huawei.com
258
259 - publisher:
260     name: 'compass-arm64-recipients'
261     publishers:
262       - email:
263           recipients: >
264             yibo.cai@arm.com