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