2 # This file contains job templates for Docker projects.
9 name: lf-docker-get-container-tag
13 CONTAINER_TAG_METHOD={container-tag-method}
14 CONTAINER_TAG_YAML_DIR={container-tag-yaml-dir}
15 DOCKER_ROOT={docker-root}
16 - shell: !include-raw-escape:
17 - ../shell/docker-get-container-tag.sh
19 # Import the container tag set by this build step
20 properties-file: 'env_docker_inject.txt'
27 DOCKER_ARGS={docker-build-args}
28 DOCKER_NAME={docker-name}
29 DOCKER_ROOT={docker-root}
30 CONTAINER_PULL_REGISTRY={container-public-registry}
31 CONTAINER_PUSH_REGISTRY={container-push-registry}
32 - shell: !include-raw-escape:
33 - ../shell/docker-build.sh
40 CONTAINER_PUSH_REGISTRY={container-push-registry}
41 - shell: !include-raw-escape:
42 - ../shell/docker-push.sh
48 - lf_docker_common: &lf_docker_common
49 name: lf-docker-common
51 project-type: freestyle
54 ######################
55 # Default parameters #
56 ######################
61 submodule-disable: false
62 submodule-recursive: true
64 pre_docker_build_script: '# pre docker build script goes here'
65 post_docker_build_script: '# post docker build script goes here'
67 docker-root: '$WORKSPACE'
69 git-url: '$GIT_URL/$PROJECT'
70 container-tag-method: 'latest'
71 # TODO: how to interpolate value of {docker-root} parameter?
72 container-tag-yaml-dir: ''
78 disabled: '{disable-job}'
81 - lf-infra-properties:
82 build-days-to-keep: '{build-days-to-keep}'
85 - lf-infra-parameters:
88 refspec: 'refs/heads/{branch}'
93 build-timeout: '{build-timeout}'
94 jenkins-ssh-credential: '{jenkins-ssh-credential}'
99 - docker_verify_common: &docker_verify_common
100 name: docker-verify-common
105 - lf-infra-gerrit-scm:
106 jenkins-ssh-credential: '{jenkins-ssh-credential}'
108 refspec: '$GERRIT_REFSPEC'
109 branch: '$GERRIT_BRANCH'
110 submodule-disable: '{submodule-disable}'
111 submodule-recursive: '{submodule-recursive}'
112 submodule-timeout: '{submodule-timeout}'
113 choosing-strategy: gerrit
115 gerrit_verify_triggers:
116 - patchset-created-event:
118 exclude-trivial-rebase: false
119 exclude-no-code-change: false
120 - draft-published-event
121 - comment-added-contains-event:
122 comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
124 gerrit_trigger_file_paths:
125 - compare-type: REG_EXP
128 # github_included_regions MUST match gerrit_trigger_file_paths
129 github_included_regions:
134 - lf-infra-docker-login:
135 global-settings-file: 'global-settings'
136 settings-file: '{mvn-settings}'
137 - shell: '{pre_docker_build_script}'
138 - lf-docker-get-container-tag:
139 container-tag-method: '{container-tag-method}'
140 container-tag-yaml-dir: '{container-tag-yaml-dir}'
141 docker-root: '{docker-root}'
143 docker-build-args: '{docker-build-args}'
144 docker-name: '{docker-name}'
145 docker-root: '{docker-root}'
146 container-public-registry: '{container-public-registry}'
147 container-push-registry: '{container-push-registry}'
148 - shell: '{post_docker_build_script}'
149 - lf-provide-maven-settings-cleanup
151 - docker_merge_common: &docker_merge_common
152 name: docker-merge-common
156 - lf-infra-gerrit-scm:
157 jenkins-ssh-credential: '{jenkins-ssh-credential}'
159 refspec: '$GERRIT_REFSPEC'
160 branch: '$GERRIT_BRANCH'
161 submodule-disable: '{submodule-disable}'
162 submodule-recursive: '{submodule-recursive}'
163 submodule-timeout: '{submodule-timeout}'
164 choosing-strategy: gerrit
166 gerrit_merge_triggers:
167 - change-merged-event
168 - comment-added-contains-event:
169 comment-contains-value: remerge$
171 gerrit_trigger_file_paths:
172 - compare-type: REG_EXP
175 # github_included_regions MUST match gerrit_trigger_file_paths
176 github_included_regions:
181 - lf-infra-docker-login:
182 global-settings-file: 'global-settings'
183 settings-file: '{mvn-settings}'
184 - shell: '{pre_docker_build_script}'
185 - lf-docker-get-container-tag:
186 container-tag-method: '{container-tag-method}'
187 container-tag-yaml-dir: '{container-tag-yaml-dir}'
188 docker-root: '{docker-root}'
190 docker-build-args: '{docker-build-args}'
191 docker-name: '{docker-name}'
192 docker-root: '{docker-root}'
193 container-public-registry: '{container-public-registry}'
194 container-push-registry: '{container-push-registry}'
195 - shell: '{post_docker_build_script}'
196 # Provided all steps have already passed, push the docker image
198 container-push-registry: '{container-push-registry}'
199 - lf-provide-maven-settings-cleanup
206 name: '{project-name}-docker-verify-{stream}'
207 id: gerrit-docker-verify
208 # Job template for Docker verify jobs
210 # The purpose of this job template is to run a docker build, and potentially
211 # test validation of the docker image
213 <<: *lf_docker_common
214 # yamllint disable-line rule:key-duplicates
215 <<: *docker_verify_common
219 server-name: '{gerrit-server-name}'
220 trigger-on: '{obj:gerrit_verify_triggers}'
222 - project-compare-type: ANT
223 project-pattern: '{project}'
225 - branch-compare-type: ANT
226 branch-pattern: '**/{branch}'
227 file-paths: '{obj:gerrit_trigger_file_paths}'
230 name: '{project-name}-docker-verify-{stream}'
231 id: github-docker-verify
232 # Job template for Docker verify jobs
234 # The purpose of this job template is to run a docker build, and potentially
235 # test validation of the docker image
237 <<: *lf_docker_common
238 # yamllint disable-line rule:key-duplicates
239 <<: *docker_verify_common
242 - lf-infra-properties:
243 build-days-to-keep: '{build-days-to-keep}'
245 url: '{github-url}/{github-org}/{project}'
248 - lf-infra-github-scm:
249 url: '{git-clone-url}{github-org}/{project}'
250 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
252 submodule-recursive: '{submodule-recursive}'
253 submodule-timeout: '{submodule-timeout}'
254 submodule-disable: '{submodule-disable}'
255 choosing-strategy: default
256 jenkins-ssh-credential: '{jenkins-ssh-credential}'
259 - github-pull-request:
260 trigger-phrase: '^(recheck|reverify)$'
261 only-trigger-phrase: false
262 status-context: 'Docker Verify'
265 white-list-target-branches:
267 included-regions: '{obj:github_included_regions}'
274 name: '{project-name}-docker-merge-{stream}'
275 id: gerrit-docker-merge
276 # Job template for Docker merge jobs
278 # The purpose of this job template is to run a docker build, and potentially
279 # test validation of the docker image
281 <<: *lf_docker_common
282 # yamllint disable-line rule:key-duplicates
283 <<: *docker_merge_common
286 - timed: '{obj:cron}'
288 server-name: '{gerrit-server-name}'
289 trigger-on: '{obj:gerrit_merge_triggers}'
291 - project-compare-type: ANT
292 project-pattern: '{project}'
294 - branch-compare-type: ANT
295 branch-pattern: '**/{branch}'
296 file-paths: '{obj:gerrit_trigger_file_paths}'
299 name: '{project-name}-docker-merge-{stream}'
300 id: github-docker-merge
301 # Job template for Docker merge jobs
303 # The purpose of this job template is to run a docker build, and potentially
304 # test validation of the docker image
306 <<: *lf_docker_common
307 # yamllint disable-line rule:key-duplicates
308 <<: *docker_merge_common
311 - lf-infra-properties:
312 build-days-to-keep: '{build-days-to-keep}'
314 url: '{github-url}/{github-org}/{project}'
317 - lf-infra-github-scm:
318 url: '{git-clone-url}{github-org}/{project}'
320 branch: 'refs/heads/{branch}'
321 submodule-recursive: '{submodule-recursive}'
322 submodule-timeout: '{submodule-timeout}'
323 submodule-disable: '{submodule-disable}'
324 choosing-strategy: default
325 jenkins-ssh-credential: '{jenkins-ssh-credential}'
328 - timed: '{obj:cron}'
332 - github-pull-request:
333 trigger-phrase: '^remerge$'
334 only-trigger-phrase: true
335 status-context: 'Docker Merge'
340 white-list: '{obj:github_pr_whitelist}'
341 admin-list: '{obj:github_pr_admin_list}'
342 white-list-target-branches:
344 included-regions: '{obj:github_included_regions}'