[fuel] docker build: Add CACHE_INVALIDATE
[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
74     scm:
75       - git-scm
76
77     triggers:
78       - pollscm:
79           cron: "*/25 * * * *"
80       - gerrit-trigger-tag-created:
81           project: '{project}'
82
83     builders:
84       - multijob:
85           name: 'build fuel images'
86           execution-type: PARALLEL
87           projects:
88             - name: 'fuel-docker-build-amd64-{stream}'
89               <<: *build-job-settings
90             - name: 'fuel-docker-build-arm64-{stream}'
91               <<: *build-job-settings
92       - multijob:
93           name: 'publish fuel manifests'
94           condition: SUCCESSFUL
95           execution-type: PARALLEL
96           projects:
97             - name: 'fuel-docker-manifest-{stream}'
98               <<: *manifest-job-settings
99
100     publishers:
101       - email-fuel-ptl
102
103 - job-template:
104     name: 'fuel-docker-build-{arch_tag}-{stream}'
105     disabled: '{obj:disabled}'
106     parameters:
107       - fuel-job-parameters:
108           project: '{project}'
109           branch: '{branch}'
110           slave_label: '{slave_label}'
111           arch_tag: '{arch_tag}'
112     scm:
113       - git-scm
114     builders:
115       - shell: |
116           #!/bin/bash -ex
117           case "{stream}" in
118           "master")
119               tag="latest" ;;
120           *)
121               tag="{stream}" ;;
122           esac
123           ./ci/build.sh $tag
124
125 - job-template:
126     name: 'fuel-docker-manifest-{stream}'
127
128     parameters:
129       - project-parameter:
130           project: '{project}'
131           branch: '{branch}'
132       - label:
133           name: SLAVE_LABEL
134           default: 'opnfv-build-ubuntu'
135           description: 'Slave label on Jenkins'
136           all-nodes: false
137           node-eligibility: 'ignore-offline'
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 fuel-docker 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/fuel:saltmaster-reclass-ARCH-$tag \
166               --target $REPO/fuel:saltmaster-reclass-$tag
167           exit $?
168
169 # parameter macro
170 - parameter:
171     name: fuel-job-parameters
172     parameters:
173       - project-parameter:
174           project: '{project}'
175           branch: '{branch}'
176       - label:
177           name: SLAVE_LABEL
178           default: '{slave_label}'
179           description: 'Slave label on Jenkins'
180           all-nodes: false
181           node-eligibility: 'ignore-offline'
182       - string:
183           name: GIT_BASE
184           default: https://gerrit.opnfv.org/gerrit/$PROJECT
185           description: 'Git URL to use on this Jenkins Slave'
186       - string:
187           name: PUSH_IMAGE
188           default: "true"
189           description: "To enable/disable pushing the image to Dockerhub."
190       - string:
191           name: CACHE_INVALIDATE
192           default: "0"
193           description: "Set to any non-zero value to force a Docker cache cleanup"
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"