473542d85dd84b2a8438a6d822ac3ec4deea829a
[releng.git] / jjb / fuel / fuel-docker-jobs.yaml
1 ---
2 ##############################################
3 # job configuration for docker build and push
4 ##############################################
5 - project:
6
7     name: fuel-docker
8
9     project: fuel
10
11     stream:
12       - master:
13           branch: '{stream}'
14           disabled: false
15       - gambia:
16           branch: 'stable/{stream}'
17           disabled: false
18
19     arch_tag:
20       - 'amd64':
21           slave_label: 'opnfv-build-ubuntu'
22       - 'arm64':
23           slave_label: 'opnfv-build-ubuntu-arm'
24
25     # settings for jobs run in multijob phases
26     build-job-settings: &build-job-settings
27       current-parameters: false
28       git-revision: true
29       node-parameters: false
30       predefined-parameters: |
31         PUSH_IMAGE=$PUSH_IMAGE
32         CACHE_INVALIDATE=$CACHE_INVALIDATE
33         COMMIT_ID=$COMMIT_ID
34         GERRIT_REFNAME=$GERRIT_REFNAME
35       kill-phase-on: FAILURE
36       abort-all-jobs: false
37
38     manifest-job-settings: &manifest-job-settings
39       current-parameters: false
40       git-revision: true
41       node-parameters: false
42       predefined-parameters:
43         GERRIT_REFNAME=$GERRIT_REFNAME
44       kill-phase-on: FAILURE
45       abort-all-jobs: false
46
47     jobs:
48       - "fuel-docker-{stream}"
49       - "fuel-docker-build-{arch_tag}-{stream}"
50       - "fuel-docker-manifest-{stream}"
51
52 ########################
53 # job templates
54 ########################
55 - job-template:
56     name: 'fuel-docker-{stream}'
57
58     project-type: multijob
59
60     disabled: '{obj:disabled}'
61
62     parameters:
63       - fuel-job-parameters:
64           project: '{project}'
65           branch: '{branch}'
66           slave_label: 'opnfv-build-ubuntu'
67           arch_tag: 'amd64'
68
69     properties:
70       - throttle:
71           max-per-node: 1
72           option: 'project'
73       - build-blocker:
74           use-build-blocker: true
75           blocking-jobs:
76             - 'fuel-docker-.*'
77           blocking-level: 'NODE'
78
79     scm:
80       - git-scm
81
82     triggers:
83       - pollscm:
84           cron: "*/25 * * * *"
85       - gerrit-trigger-tag-created:
86           project: '{project}'
87
88     builders:
89       - multijob:
90           name: 'build fuel images'
91           execution-type: PARALLEL
92           projects:
93             - name: 'fuel-docker-build-amd64-{stream}'
94               <<: *build-job-settings
95             - name: 'fuel-docker-build-arm64-{stream}'
96               <<: *build-job-settings
97       - multijob:
98           name: 'publish fuel manifests'
99           condition: SUCCESSFUL
100           execution-type: PARALLEL
101           projects:
102             - name: 'fuel-docker-manifest-{stream}'
103               <<: *manifest-job-settings
104
105     publishers:
106       - email-fuel-ptl
107
108 - job-template:
109     name: 'fuel-docker-build-{arch_tag}-{stream}'
110     disabled: '{obj:disabled}'
111     parameters:
112       - fuel-job-parameters:
113           project: '{project}'
114           branch: '{branch}'
115           slave_label: '{slave_label}'
116           arch_tag: '{arch_tag}'
117     scm:
118       - git-scm
119     builders:
120       - shell: |
121           #!/bin/bash -ex
122           case "{stream}" in
123           "master")
124               tag="latest" ;;
125           *)
126               tag="{stream}" ;;
127           esac
128           ./ci/build.sh $tag
129
130 - job-template:
131     name: 'fuel-docker-manifest-{stream}'
132
133     parameters:
134       - project-parameter:
135           project: '{project}'
136           branch: '{branch}'
137       - label:
138           name: SLAVE_LABEL
139           default: 'opnfv-build-ubuntu'
140           description: 'Slave label on Jenkins'
141           all-nodes: false
142           node-eligibility: 'ignore-offline'
143       - string:
144           name: PROJECT
145           default: "{project}"
146           description: "Project name used to enable job conditions"
147       - string:
148           name: GIT_BASE
149           default: https://gerrit.opnfv.org/gerrit/$PROJECT
150           description: 'Git URL to use on this Jenkins Slave'
151       - string:
152           name: REPO
153           default: "opnfv"
154           description: "Repository name for fuel-docker images"
155
156
157     disabled: '{obj:disabled}'
158
159     builders:
160       - shell: |
161           #!/bin/bash -ex
162           case "{stream}" in
163           "master")
164               tag="latest" ;;
165           *)
166               tag="{stream}" ;;
167           esac
168           sudo manifest-tool push from-args \
169               --platforms linux/amd64,linux/arm64 \
170               --template $REPO/fuel:saltmaster-reclass-ARCH-$tag \
171               --target $REPO/fuel:saltmaster-reclass-$tag
172           exit $?
173
174 # parameter macro
175 - parameter:
176     name: fuel-job-parameters
177     parameters:
178       - project-parameter:
179           project: '{project}'
180           branch: '{branch}'
181       - label:
182           name: SLAVE_LABEL
183           default: '{slave_label}'
184           description: 'Slave label on Jenkins'
185           all-nodes: false
186           node-eligibility: 'ignore-offline'
187       - string:
188           name: GIT_BASE
189           default: https://gerrit.opnfv.org/gerrit/$PROJECT
190           description: 'Git URL to use on this Jenkins Slave'
191       - string:
192           name: PUSH_IMAGE
193           default: "true"
194           description: "To enable/disable pushing the image to Dockerhub."
195       - string:
196           name: CACHE_INVALIDATE
197           default: "0"
198           description: "Set to any non-zero value to force a Docker cache cleanup"
199       - string:
200           name: COMMIT_ID
201           default: ""
202           description: "commit id to make a snapshot docker image"
203       - string:
204           name: GERRIT_REFNAME
205           default: ""
206           description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
207       - string:
208           name: PROJECT
209           default: "{project}"
210           description: "Project name used to enable job conditions"
211       - string:
212           name: REPO
213           default: "opnfv"
214           description: "Repository name for fuel-docker images"