Fix global-templates unstable jobs
[ci-management.git] / jjb / global-templates-docker.yaml
1 ---
2 ###########
3 # ANCHORS #
4 ###########
5 - docker_job_boiler_plate: &docker_job_boiler_plate
6     name: docker_job_boiler_plate
7
8     project-type: freestyle
9     node: '{build-node}'
10
11     ######################
12     # Default parameters #
13     ######################
14
15     branch: master
16     submodule-recursive: true
17
18     # default params for docker jobs
19     pre_build_script: ''
20     post_build_script: ''
21     docker_root: '$WORKSPACE'
22     docker_build_args: ''
23     docker_name: 'unnamed'
24     # Default to LF standard 'snapshots' docker registry
25     docker_registry: '$DOCKER_REGISTRY:10003'
26     docker_tag: 'latest'
27     submodule-timeout: 10
28
29     #####################
30     # Job Configuration #
31     #####################
32
33     properties:
34       - lf-infra-properties:
35           build-days-to-keep: '{build-days-to-keep}'
36
37     parameters:
38       - lf-infra-parameters:
39           branch: '{branch}'
40           project: '{project}'
41           stream: '{stream}'
42           lftools-version: '{lftools-version}'
43
44     wrappers:
45       - lf-infra-wrappers:
46           build-timeout: '{build-timeout}'
47           jenkins-ssh-credential: '{jenkins-ssh-credential}'
48
49     publishers:
50       - lf-infra-publish
51
52 - docker_verify_boiler_plate: &docker_verify_boiler_plate
53     name: docker_verify_boiler_plate
54
55     concurrent: true
56
57     scm:
58       - gerrit-trigger-scm:
59           refspec: '$GERRIT_REFSPEC'
60           choosing-strategy: 'default'
61           submodule-recursive: '{submodule-recursive}'
62
63     triggers:
64       - gerrit-trigger-patch-submitted:
65           status-context: '{project}-Docker-Verify'
66           server: '{server-name}'
67           project: '{project}'
68           branch: '{branch}'
69           files: '{files}'
70
71 - docker_merge_boiler_plate: &docker_merge_boiler_plate
72     name: docker_merge_boiler_plate
73
74     scm:
75       - gerrit-trigger-scm:
76           refspec: '$GERRIT_REFSPEC'
77           choosing-strategy: 'default'
78           submodule-recursive: '{submodule-recursive}'
79
80     triggers:
81       - gerrit-trigger-patch-merged:
82           server: '{server-name}'
83           project: '{project}'
84           branch: '{branch}'
85           files: '{files}'
86       - pollscm:
87           cron: ''
88
89 #################
90 # JOB TEMPLATES #
91 #################
92 - job-template:
93     name: '{project-name}-{stream}-merge-docker'
94     # Job template for Docker merge jobs
95     #
96     # The purpose of this job template is to run a docker build, and potentially
97     # test validation of the docker image
98
99     <<: *docker_job_boiler_plate
100     # yamllint disable-line rule:key-duplicates
101     <<: *docker_merge_boiler_plate
102
103     builders:
104       - lf-infra-pre-build
105       - lf-infra-docker-login:
106           global-settings-file: 'global-settings'
107           settings-file: '{mvn-settings}'
108       - shell: '{pre_build_script}'
109       - inject:
110           # Docker registry is purposely not using an '_' so as to not conflict
111           # with the Jenkins global env var
112           properties-content: |
113             DOCKER_ARGS={docker_build_args}
114             DOCKER_NAME={docker_name}
115             DOCKER_ROOT={docker_root}
116             DOCKER_TAG={docker_tag}
117             BUILD_MODE=SNAPSHOT
118             DOCKERREGISTRY={docker_registry}
119       # Do the docker build
120       - shell: !include-raw: ../shell/docker-build.sh
121       - inject:
122           # Import the docker image information from the build step
123           properties-file: 'env_inject.txt'
124       # Execute any post build clean-up or testing
125       - shell: '{post_build_script}'
126       # Provided all steps have already passed, push the docker image
127       - shell: !include-raw: ../shell/docker-push.sh
128
129 - job-template:
130     name: '{project-name}-{stream}-merge-docker-cascade-trigger'
131     # Job template for Docker merge jobs
132     #
133     # The purpose of this job template is to run a docker build, and potentially
134     # test validation of the docker image. This job is triggered by the it's corresponding
135     # job that builds the artifacts from which the docker image is built from. Projects
136     # using the {project-name}-{stream}-merge-docker job should move to this job. Because
137     # the {project-name}-{stream}-merge-docker has no garanties that the docker image is built
138     # from merged artifact.
139
140     <<: *docker_job_boiler_plate
141     # yamllint disable-line rule:key-duplicates
142     <<: *docker_merge_boiler_plate
143
144     builders:
145       - lf-infra-pre-build
146       - lf-infra-docker-login:
147           global-settings-file: 'global-settings'
148           settings-file: '{mvn-settings}'
149       - shell: '{pre_build_script}'
150       - inject:
151           # Docker registry is purposely not using an '_' so as to not conflict
152           # with the Jenkins global env var
153           properties-content: |
154             DOCKER_ARGS={docker_build_args}
155             DOCKER_NAME={docker_name}
156             DOCKER_ROOT={docker_root}
157             DOCKER_TAG={docker_tag}
158             BUILD_MODE=SNAPSHOT
159             DOCKERREGISTRY={docker_registry}
160       # Do the docker build
161       - shell: !include-raw: ../shell/docker-build.sh
162       - inject:
163           # Import the docker image information from the build step
164           properties-file: 'env_inject.txt'
165       # Execute any post build clean-up or testing
166       - shell: '{post_build_script}'
167       # Provided all steps have already passed, push the docker image
168       - shell: !include-raw: ../shell/docker-push.sh
169     triggers:
170       - reverse:
171           jobs:
172             - '{parent_job}'
173           result: 'success'
174
175 - job-template:
176     name: '{project-name}-{stream}-verify-docker'
177     # Job template for Docker verify jobs
178     #
179     # The purpose of this job template is to run a docker build, and potentially
180     # test validation of the docker image
181
182     ######################
183     # Default parameters #
184     ######################
185
186     <<: *docker_job_boiler_plate
187     # yamllint disable-line rule:key-duplicates
188     <<: *docker_verify_boiler_plate
189
190     builders:
191       - lf-infra-pre-build
192       - lf-infra-docker-login:
193           global-settings-file: 'global-settings'
194           settings-file: '{mvn-settings}'
195       - shell: '{pre_build_script}'
196       - inject:
197           # Docker registry is purposely not using an '_' so as to not conflict
198           # with the Jenkins global env var
199           properties-content: |
200             DOCKER_ARGS={docker_build_args}
201             DOCKER_NAME={docker_name}
202             DOCKER_ROOT={docker_root}
203             DOCKER_TAG={docker_tag}
204             BUILD_MODE=SNAPSHOT
205             DOCKERREGISTRY={docker_registry}
206       # Do the docker build
207       - shell: !include-raw: ../shell/docker-build.sh
208       - inject:
209           # Import the docker image information from the build step
210           properties-file: 'env_inject.txt'
211       # Execute any post build clean-up or testing
212       - shell: '{post_build_script}'
213
214 - job-template:
215     name: '{project-name}-{stream}-verify-docker-cascade-trigger'
216     # Job template for Docker verify jobs
217     #
218     # The purpose of this job template is to run a docker build, and potentially
219     # test validation of the docker image. This job is triggered by the it's corresponding
220     # job that builds the artifacts from which the docker image is built from. Projects
221     # using the {project-name}-{stream}-verify-docker job should move to this job. Because
222     # the {project-name}-{stream}-verify-docker has no garanties that the docker image is built
223     # from merged artifact.
224
225     ######################
226     # Default parameters #
227     ######################
228
229     <<: *docker_job_boiler_plate
230     # yamllint disable-line rule:key-duplicates
231     <<: *docker_verify_boiler_plate
232
233     builders:
234       - lf-infra-pre-build
235       - lf-infra-docker-login:
236           global-settings-file: 'global-settings'
237           settings-file: '{mvn-settings}'
238       - shell: '{pre_build_script}'
239       - inject:
240           # Docker registry is purposely not using an '_' so as to not conflict
241           # with the Jenkins global env var
242           properties-content: |
243             DOCKER_ARGS={docker_build_args}
244             DOCKER_NAME={docker_name}
245             DOCKER_ROOT={docker_root}
246             DOCKER_TAG={docker_tag}
247             BUILD_MODE=SNAPSHOT
248             DOCKERREGISTRY={docker_registry}
249       # Do the docker build
250       - shell: !include-raw: ../shell/docker-build.sh
251       - inject:
252           # Import the docker image information from the build step
253           properties-file: 'env_inject.txt'
254       # Execute any post build clean-up or testing
255       - shell: '{post_build_script}'
256     triggers:
257       - reverse:
258           jobs:
259             - '{parent_job}'
260           result: 'success'
261
262 - job-template:
263     name: '{project-name}-{stream}-release-version-docker-daily-no-sonar'
264     # Job template for Docker daily release jobs
265     #
266     # The purpose of this job template is to run "docker build and docker push"
267     # for projects using this template.
268     #
269     # Required Variables:
270     #     branch:    git branch (eg. stable/lithium or master)
271     <<: *docker_job_boiler_plate
272
273     docker_registry: '$DOCKER_REGISTRY:10003'
274
275     scm:
276       - lf-infra-gerrit-scm:
277           jenkins-ssh-credential: '{jenkins-ssh-credential}'
278           git-url: '$GIT_URL/$PROJECT'
279           refspec: '$GERRIT_REFSPEC'
280           branch: '$GERRIT_BRANCH'
281           submodule-recursive: true
282           submodule-timeout: '{submodule-timeout}'
283           choosing-strategy: default
284
285     builders:
286       - lf-infra-pre-build
287       - lf-infra-docker-login:
288           global-settings-file: 'global-settings'
289           settings-file: '{mvn-settings}'
290       - shell: '{pre_build_script}'
291       - inject:
292           # Docker registry is purposely not using an '_' so as to not conflict
293           # with the Jenkins global env var
294           properties-content: |
295             DOCKER_ARGS={docker_build_args}
296             DOCKER_NAME={docker_name}
297             DOCKER_ROOT={docker_root}
298             DOCKER_TAG={docker_tag}
299             DOCKERREGISTRY={docker_registry}
300             BUILD_MODE=STAGING
301
302       # Do the docker build
303       - shell: !include-raw: ../shell/snapshot-strip.sh
304       - shell: !include-raw: ../shell/docker-build.sh
305       - inject:
306           # Import the docker image information from the build step
307           properties-file: 'env_inject.txt'
308       # Execute any post build clean-up or testing
309       - shell: '{post_build_script}'
310       # Provided all steps have already passed, push the docker image
311       - shell: !include-raw: ../shell/docker-push.sh
312
313     triggers:
314       # 11 AM UTC
315       - timed: '@daily'
316       - gerrit-trigger-release-manually:
317           server: '{server-name}'
318           project: '{project}'
319           branch: '{branch}'
320
321 - job-template:
322     name: '{project-name}-{stream}-release-version-docker-daily-no-sonar-cascade-trigger'
323     # Job template for Docker daily release job.
324     #
325     # The purpose of this job template is to run "docker build and docker push"
326     # for projects using this template. This job is triggered by the daily build
327     # that builds the artifacts required for building the Docker image.
328     #
329     # Required Variables:
330     #     branch:    git branch (eg. stable/lithium or master)
331     <<: *docker_job_boiler_plate
332
333     docker_registry: '$DOCKER_REGISTRY:10003'
334
335     scm:
336       - lf-infra-gerrit-scm:
337           jenkins-ssh-credential: '{jenkins-ssh-credential}'
338           git-url: '$GIT_URL/$PROJECT'
339           refspec: '$GERRIT_REFSPEC'
340           branch: '$GERRIT_BRANCH'
341           submodule-recursive: true
342           submodule-timeout: '{submodule-timeout}'
343           choosing-strategy: default
344
345     builders:
346       - lf-infra-pre-build
347       - lf-infra-docker-login:
348           global-settings-file: 'global-settings'
349           settings-file: '{mvn-settings}'
350       - shell: '{pre_build_script}'
351       - inject:
352           # Docker registry is purposely not using an '_' so as to not conflict
353           # with the Jenkins global env var
354           properties-content: |
355             DOCKER_ARGS={docker_build_args}
356             DOCKER_NAME={docker_name}
357             DOCKER_ROOT={docker_root}
358             DOCKER_TAG={docker_tag}
359             DOCKERREGISTRY={docker_registry}
360             BUILD_MODE=STAGING
361
362       # Do the docker build
363       - shell: !include-raw: ../shell/snapshot-strip.sh
364       - shell: !include-raw: ../shell/docker-build.sh
365       - inject:
366           # Import the docker image information from the build step
367           properties-file: 'env_inject.txt'
368       # Execute any post build clean-up or testing
369       - shell: '{post_build_script}'
370       # Provided all steps have already passed, push the docker image
371       - shell: !include-raw: ../shell/docker-push.sh
372
373     triggers:
374       - reverse:
375           jobs:
376             - '{parent_job}'
377           result: 'success'
378
379 - job-template:
380     name: '{project-name}-{subproject}-{stream}-merge-docker'
381     # Job template for Docker merge jobs
382     #
383     # The purpose of this job template is to run a docker build, and potentially
384     # test validation of the docker image
385
386     <<: *docker_job_boiler_plate
387     # yamllint disable-line rule:key-duplicates
388     <<: *docker_merge_boiler_plate
389
390     builders:
391       - lf-infra-pre-build
392       - lf-infra-docker-login:
393           global-settings-file: 'global-settings'
394           settings-file: '{mvn-settings}'
395       - shell: '{pre_build_script}'
396       - inject:
397           # Docker registry is purposely not using an '_' so as to not conflict
398           # with the Jenkins global env var
399           properties-content: |
400             DOCKER_ARGS={docker_build_args}
401             DOCKER_NAME={docker_name}
402             DOCKER_ROOT={docker_root}
403             DOCKER_TAG={docker_tag}
404             DOCKERREGISTRY={docker_registry}
405             BUILD_MODE=SNAPSHOT
406       # Do the docker build
407       - shell: !include-raw: ../shell/docker-build.sh
408       - inject:
409           # Import the docker image information from the build step
410           properties-file: 'env_inject.txt'
411       # Execute any post build clean-up or testing
412       - shell: '{post_build_script}'
413       # Provided all steps have already passed, push the docker image
414       - shell: !include-raw: ../shell/docker-push.sh
415
416 - job-template:
417     name: '{project-name}-{subproject}-{stream}-merge-docker-cascade-trigger'
418     # Job template for Docker merge jobs
419     #
420     # The purpose of this job template is to run a docker build, and potentially
421     # test validation of the docker image. This job is triggered by the merge job
422     # that builds the artifacts required for building the Docker image.
423
424     <<: *docker_job_boiler_plate
425     # yamllint disable-line rule:key-duplicates
426     <<: *docker_merge_boiler_plate
427
428     builders:
429       - lf-infra-pre-build
430       - lf-infra-docker-login:
431           global-settings-file: 'global-settings'
432           settings-file: '{mvn-settings}'
433       - shell: '{pre_build_script}'
434       - inject:
435           # Docker registry is purposely not using an '_' so as to not conflict
436           # with the Jenkins global env var
437           properties-content: |
438             DOCKER_ARGS={docker_build_args}
439             DOCKER_NAME={docker_name}
440             DOCKER_ROOT={docker_root}
441             DOCKER_TAG={docker_tag}
442             DOCKERREGISTRY={docker_registry}
443             BUILD_MODE=SNAPSHOT
444       # Do the docker build
445       - shell: !include-raw: ../shell/docker-build.sh
446       - inject:
447           # Import the docker image information from the build step
448           properties-file: 'env_inject.txt'
449       # Execute any post build clean-up or testing
450       - shell: '{post_build_script}'
451       # Provided all steps have already passed, push the docker image
452       - shell: !include-raw: ../shell/docker-push.sh
453     triggers:
454       - reverse:
455           jobs:
456             - '{parent_job}'
457           result: 'success'
458
459 - job-template:
460     name: '{project-name}-{subproject}-{stream}-verify-docker'
461     # Job template for Docker verify jobs
462     #
463     # The purpose of this job template is to run a docker build, and potentially
464     # test validation of the docker image
465
466     ######################
467     # Default parameters #
468     ######################
469
470     <<: *docker_job_boiler_plate
471     # yamllint disable-line rule:key-duplicates
472     <<: *docker_verify_boiler_plate
473
474     builders:
475       - lf-infra-pre-build
476       - lf-infra-docker-login:
477           global-settings-file: 'global-settings'
478           settings-file: '{mvn-settings}'
479       - shell: '{pre_build_script}'
480       - inject:
481           # Docker registry is purposely not using an '_' so as to not conflict
482           # with the Jenkins global env var
483           properties-content: |
484             DOCKER_ARGS={docker_build_args}
485             DOCKER_NAME={docker_name}
486             DOCKER_ROOT={docker_root}
487             DOCKER_TAG={docker_tag}
488             DOCKERREGISTRY={docker_registry}
489             BUILD_MODE=SNAPSHOT
490       # Do the docker build
491       - shell: !include-raw: ../shell/docker-build.sh
492       - inject:
493           # Import the docker image information from the build step
494           properties-file: 'env_inject.txt'
495       # Execute any post build clean-up or testing
496       - shell: '{post_build_script}'
497
498 - job-template:
499     name: '{project-name}-{subproject}-{stream}-verify-docker-cascade-trigger'
500     # Job template for Docker verify jobs
501     #
502     # The purpose of this job template is to run a docker build, and potentially
503     # test validation of the docker image
504
505     ######################
506     # Default parameters #
507     ######################
508
509     <<: *docker_job_boiler_plate
510     # yamllint disable-line rule:key-duplicates
511     <<: *docker_verify_boiler_plate
512
513     builders:
514       - lf-infra-pre-build
515       - lf-infra-docker-login:
516           global-settings-file: 'global-settings'
517           settings-file: '{mvn-settings}'
518       - shell: '{pre_build_script}'
519       - inject:
520           # Docker registry is purposely not using an '_' so as to not conflict
521           # with the Jenkins global env var
522           properties-content: |
523             DOCKER_ARGS={docker_build_args}
524             DOCKER_NAME={docker_name}
525             DOCKER_ROOT={docker_root}
526             DOCKER_TAG={docker_tag}
527             DOCKERREGISTRY={docker_registry}
528             BUILD_MODE=SNAPSHOT
529       # Do the docker build
530       - shell: !include-raw: ../shell/docker-build.sh
531       - inject:
532           # Import the docker image information from the build step
533           properties-file: 'env_inject.txt'
534       # Execute any post build clean-up or testing
535       - shell: '{post_build_script}'
536     triggers:
537       - reverse:
538           jobs:
539             - '{parent_job}'
540           result: 'success'
541
542 - job-template:
543     name: '{project-name}-{subproject}-{stream}-release-version-docker-daily-no-sonar'
544     # Job template for Docker daily release jobs
545     #
546     # The purpose of this job template is to run "docker build and docker push"
547     # for projects using this template.
548     #
549     # Required Variables:
550     #     branch:    git branch (eg. stable/lithium or master)
551     <<: *docker_job_boiler_plate
552
553     docker_registry: '$DOCKER_REGISTRY:10003'
554
555     scm:
556       - lf-infra-gerrit-scm:
557           jenkins-ssh-credential: '{jenkins-ssh-credential}'
558           git-url: '$GIT_URL/$PROJECT'
559           refspec: '$GERRIT_REFSPEC'
560           branch: '$GERRIT_BRANCH'
561           submodule-recursive: true
562           submodule-timeout: '{submodule-timeout}'
563           choosing-strategy: default
564
565     builders:
566       - lf-infra-pre-build
567       - lf-infra-docker-login:
568           global-settings-file: 'global-settings'
569           settings-file: '{mvn-settings}'
570       - shell: '{pre_build_script}'
571       - inject:
572           # Docker registry is purposely not using an '_' so as to not conflict
573           # with the Jenkins global env var
574           properties-content: |
575             DOCKER_ARGS={docker_build_args}
576             DOCKER_NAME={docker_name}
577             DOCKER_ROOT={docker_root}
578             DOCKER_TAG={docker_tag}
579             DOCKERREGISTRY={docker_registry}
580             BUILD_MODE=STAGING
581
582       # Do the docker build
583       - shell: !include-raw: ../shell/snapshot-strip.sh
584       - shell: !include-raw: ../shell/docker-build.sh
585       - inject:
586           # Import the docker image information from the build step
587           properties-file: 'env_inject.txt'
588       # Execute any post build clean-up or testing
589       - shell: '{post_build_script}'
590       # Provided all steps have already passed, push the docker image
591       - shell: !include-raw: ../shell/docker-push.sh
592
593     triggers:
594       # 11 AM UTC
595       - timed: '@daily'
596       - gerrit-trigger-release-manually:
597           server: '{server-name}'
598           project: '{project}'
599           branch: '{branch}'
600
601 - job-template:
602     name: '{project-name}-{subproject}-{stream}-release-version-docker-daily-no-sonar-cascade-trigger'
603     # Job template for Docker daily release jobs
604     #
605     # The purpose of this job template is to run "docker build and docker push"
606     # for projects using this template. This job is triggered by the daily job
607     # that builds the artifacts required for building the Docker image.
608     #
609     # Required Variables:
610     #     branch:    git branch (eg. stable/lithium or master)
611     <<: *docker_job_boiler_plate
612
613     docker_registry: '$DOCKER_REGISTRY:10003'
614
615     scm:
616       - lf-infra-gerrit-scm:
617           jenkins-ssh-credential: '{jenkins-ssh-credential}'
618           git-url: '$GIT_URL/$PROJECT'
619           refspec: '$GERRIT_REFSPEC'
620           branch: '$GERRIT_BRANCH'
621           submodule-recursive: true
622           submodule-timeout: '{submodule-timeout}'
623           choosing-strategy: default
624
625     builders:
626       - lf-infra-pre-build
627       - lf-infra-docker-login:
628           global-settings-file: 'global-settings'
629           settings-file: '{mvn-settings}'
630       - shell: '{pre_build_script}'
631       - inject:
632           # Docker registry is purposely not using an '_' so as to not conflict
633           # with the Jenkins global env var
634           properties-content: |
635             DOCKER_ARGS={docker_build_args}
636             DOCKER_NAME={docker_name}
637             DOCKER_ROOT={docker_root}
638             DOCKER_TAG={docker_tag}
639             DOCKERREGISTRY={docker_registry}
640             BUILD_MODE=STAGING
641
642       # Do the docker build
643       - shell: !include-raw: ../shell/snapshot-strip.sh
644       - shell: !include-raw: ../shell/docker-build.sh
645       - inject:
646           # Import the docker image information from the build step
647           properties-file: 'env_inject.txt'
648       # Execute any post build clean-up or testing
649       - shell: '{post_build_script}'
650       # Provided all steps have already passed, push the docker image
651       - shell: !include-raw: ../shell/docker-push.sh
652
653     triggers:
654       - reverse:
655           jobs:
656             - '{parent_job}'
657           result: 'success'
658
659 - job-template:
660     name: '{project-name}-{subproject}-{stream}-release-version-docker-no-sonar'
661     # Job template for Docker final release job
662     #
663     # The purpose of this job template is to run "docker build and docker push"
664     # for projects using this template.
665     #
666     # Required Variables:
667     #     branch:    git branch (eg. stable/lithium or master)
668     <<: *docker_job_boiler_plate
669
670     docker_registry: '$DOCKER_REGISTRY:10003'
671
672     scm:
673       - lf-infra-gerrit-scm:
674           jenkins-ssh-credential: '{jenkins-ssh-credential}'
675           git-url: '$GIT_URL/$PROJECT'
676           refspec: '$GERRIT_REFSPEC'
677           branch: '$GERRIT_BRANCH'
678           submodule-recursive: true
679           submodule-timeout: '{submodule-timeout}'
680           choosing-strategy: default
681
682     builders:
683       - lf-infra-pre-build
684       - lf-infra-docker-login:
685           global-settings-file: 'global-settings'
686           settings-file: '{mvn-settings}'
687       - shell: '{pre_build_script}'
688       - inject:
689           # Docker registry is purposely not using an '_' so as to not conflict
690           # with the Jenkins global env var
691           properties-content: |
692             DOCKER_ARGS={docker_build_args}
693             DOCKER_NAME={docker_name}
694             DOCKER_ROOT={docker_root}
695             DOCKER_TAG={docker_tag}
696             DOCKERREGISTRY={docker_registry}
697             BUILD_MODE=STAGING
698
699       # Do the docker build
700       - shell: !include-raw: ../shell/snapshot-strip.sh
701       - shell: !include-raw: ../shell/docker-build.sh
702       - inject:
703           # Import the docker image information from the build step
704           properties-file: 'env_inject.txt'
705       # Execute any post build clean-up or testing
706       - shell: '{post_build_script}'
707       # Provided all steps have already passed, push the docker image
708       - shell: !include-raw: ../shell/docker-push.sh
709
710 - job-template:
711     name: '{project-name}-{subproject}-{stream}-release-version-docker-cascade-trigger-no-sonar'
712     # Job template for Docker final release job
713     #
714     # The purpose of this job template is to run "docker build and docker push"
715     # for projects using this template. This job has no cascading counterpart, because the
716     # final release is moved manually to the release repo.
717     #
718     # Required Variables:
719     #     branch:    git branch (eg. stable/lithium or master)
720     <<: *docker_job_boiler_plate
721
722     docker_registry: '$DOCKER_REGISTRY:10003'
723
724     scm:
725       - lf-infra-gerrit-scm:
726           jenkins-ssh-credential: '{jenkins-ssh-credential}'
727           git-url: '$GIT_URL/$PROJECT'
728           refspec: '$GERRIT_REFSPEC'
729           branch: '$GERRIT_BRANCH'
730           submodule-recursive: true
731           submodule-timeout: '{submodule-timeout}'
732           choosing-strategy: default
733
734     builders:
735       - lf-infra-pre-build
736       - lf-infra-docker-login:
737           global-settings-file: 'global-settings'
738           settings-file: '{mvn-settings}'
739       - shell: '{pre_build_script}'
740       - inject:
741           # Docker registry is purposely not using an '_' so as to not conflict
742           # with the Jenkins global env var
743           properties-content: |
744             DOCKER_ARGS={docker_build_args}
745             DOCKER_NAME={docker_name}
746             DOCKER_ROOT={docker_root}
747             DOCKER_TAG={docker_tag}
748             DOCKERREGISTRY={docker_registry}
749             BUILD_MODE=STAGING
750
751       # Do the docker build
752       - shell: !include-raw: ../shell/snapshot-strip.sh
753       - shell: !include-raw: ../shell/docker-build.sh
754       - inject:
755           # Import the docker image information from the build step
756           properties-file: 'env_inject.txt'
757       # Execute any post build clean-up or testing
758       - shell: '{post_build_script}'
759       # Provided all steps have already passed, push the docker image
760       - shell: !include-raw: ../shell/docker-push.sh
761     triggers:
762       - reverse:
763           jobs:
764             - '{parent_job}'
765           result: 'success'
766
767