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