Refactor docker java jobs

Remove some more unused docker java jobs and
refactor the rest.

Change-Id: I0c570f3b739cc8a1f7117846201b810b26df7172
Issue-ID: CIMAN-187
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/jjb/global-templates-java.yaml b/jjb/global-templates-java.yaml
index 29a5c29..ebe55db 100644
--- a/jjb/global-templates-java.yaml
+++ b/jjb/global-templates-java.yaml
@@ -227,15 +227,10 @@
           steps:
             - inject:
                 properties-file: version.properties
-            - maven-target:
+            - maven-set-release-version:
                 maven-version: '{maven-version}'
-                goals: 'versions:set versions:update-child-modules versions:commit -B'
-                properties:
-                  - 'newVersion=${{release_version}}'
-                settings: '{mvn-settings}'
-                settings-type: cfp
-                global-settings: 'global-settings'
-                global-settings-type: cfp
+                mvn-settings: '{mvn-settings}'
+                pom:
       - maven-target:
           maven-version: '{maven-version}'
           goals: 'clean deploy -B
@@ -304,15 +299,10 @@
 
       - inject:
           properties-file: version.properties
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
+          mvn-settings: '{mvn-settings}'
+          pom:
 
       - maven-target:
           maven-version: '{maven-version}'
@@ -383,15 +373,10 @@
 
       - inject:
           properties-file: version.properties
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
+          mvn-settings: '{mvn-settings}'
+          pom:
 
       - maven-target:
           maven-version: '{maven-version}'
@@ -538,16 +523,10 @@
 
       - inject:
           properties-file: version.properties
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
+          mvn-settings: '{mvn-settings}'
           pom: '{pom}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
 
       - maven-target:
           maven-version: '{maven-version}'
@@ -695,7 +674,7 @@
     <<: *merge_java_defaults
     name: '{project-name}-{stream}-{subproject}-merge-java'
 
-- job-template:
+- job-template: &docker_java_defaults
     # Job template for Docker daily jobs
     #
     # The purpose of this job template is to run:
@@ -773,65 +752,14 @@
     # Required Variables:
     #     branch:    git branch (eg. stable/lithium or master)
 
+    <<: *docker_java_defaults
     name: '{project-name}-{stream}-docker-java-daily'
     id: docker-java-daily
-    project-type: freestyle
     node: '{build-node}'
-    disabled: '{disabled}'
-    properties:
-      - infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-
-    parameters:
-      - infra-parameters:
-          project: '{project}'
-          branch: '{branch}'
-          refspec: 'refs/heads/{branch}'
-          artifacts: '{archive-artifacts}'
-      - maven-exec:
-          maven-version: '{maven-version}'
-      - maven-params:
-          mvn-params: '{mvn-params}'
-
-    scm:
-      - gerrit-trigger-scm:
-          refspec: ''
-          choosing-strategy: 'default'
-          submodule-recursive: '{submodule-recursive}'
-
     wrappers:
       - infra-wrappers-docker-build:
           build-timeout: '{build-timeout}'
 
-    triggers:
-      # 12 AM UTC
-      - timed: 'H 12 * * *'
-      - gerrit-trigger-release-manually:
-          server: '{server-name}'
-          project: '{project}'
-          branch: '{branch}'
-
-    builders:
-
-      - provide-maven-settings:
-          global-settings-file: 'global-settings'
-          settings-file: '{mvn-settings}'
-
-      - docker-login
-
-      - maven-docker-push-daily:
-          maven-version: '{maven-version}'
-          mvn-settings: '{mvn-settings}'
-          pom: '{docker-pom}'
-          # use default as mvn-profile if profile is not needed
-          mvn-profile: '{mvn-profile}'
-          mvn-params: '{mvn-params}'
-
-    publishers:
-      - infra-shiplogs:
-          maven-version: '{maven-version}'
-
-
 - job-template:
     # Job template for building & pushing docker images
     #
@@ -890,15 +818,10 @@
           steps:
             - inject:
                 properties-file: version.properties
-            - maven-target:
+            - maven-set-release-version:
                 maven-version: '{maven-version}'
-                goals: 'versions:set versions:update-child-modules versions:commit -B'
-                properties:
-                  - 'newVersion=${{release_version}}'
-                settings: '{mvn-settings}'
-                settings-type: cfp
-                global-settings: 'global-settings'
-                global-settings-type: cfp
+                mvn-settings: '{mvn-settings}'
+                pom:
       - docker-login
       - maven-docker-push-daily:
           maven-version: '{maven-version}'
@@ -1035,16 +958,10 @@
 
       - inject:
           properties-file: version.properties
-
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
+          mvn-settings: '{mvn-settings}'
+          pom:
 
       - docker-login
 
@@ -1119,17 +1036,10 @@
 
       - inject:
           properties-file: version.properties
-
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
+          mvn-settings: '{mvn-settings}'
           pom: '{pom}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
 
       - docker-login
 
@@ -1148,7 +1058,7 @@
       - infra-shiplogs:
           maven-version: '{maven-version}'
 
-- job-template:
+- job-template: &docker_version_java_defaults
     # Job template for building & pushing docker images
     #
     # The purpose of this job template is to run:
@@ -1207,16 +1117,10 @@
 
       - inject:
           properties-file: version.properties
-
-      - maven-target:
+      - maven-set-release-version:
           maven-version: '{maven-version}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
+          mvn-settings: '{mvn-settings}'
+          pom:
 
       - docker-login
 
@@ -1245,162 +1149,14 @@
     #     profile:   the docker profile defined in the pom
     #     maven-properties: properties passed to maven
 
+    <<: *docker_version_java_defaults
     name: '{project-name}-{stream}-docker-version-java-daily'
     id: 'docker-version-java-daily'
-    project-type: freestyle
     node: '{build-node}'
-    disabled: '{disabled}'
-    properties:
-      - infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-
-    parameters:
-      - infra-parameters:
-          project: '{project}'
-          branch: '{branch}'
-          refspec: 'refs/heads/{branch}'
-          artifacts: '{archive-artifacts}'
-      - maven-exec:
-          maven-version: '{maven-version}'
-      - maven-params:
-          mvn-params: '{mvn-params}'
-
-    scm:
-      - gerrit-trigger-scm:
-          refspec: ''
-          choosing-strategy: 'default'
-          submodule-recursive: '{submodule-recursive}'
-
     wrappers:
       - infra-wrappers-docker-build:
           build-timeout: '{build-timeout}'
 
-    triggers:
-      # 12 AM UTC
-      - timed: 'H 12 * * *'
-      - gerrit-trigger-release-manually:
-          server: '{server-name}'
-          project: '{project}'
-          branch: '{branch}'
-
-    builders:
-
-      - provide-maven-settings:
-          global-settings-file: 'global-settings'
-          settings-file: '{mvn-settings}'
-
-      - inject:
-          properties-file: version.properties
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-
-      - docker-login
-
-      - maven-docker-push-daily:
-          maven-version: '{maven-version}'
-          mvn-settings: '{mvn-settings}'
-          pom: '{docker-pom}'
-          # use default as mvn-profile if profile is not needed
-          mvn-profile: '{mvn-profile}'
-          mvn-params: '{mvn-params}'
-
-    publishers:
-      - infra-shiplogs:
-          maven-version: '{maven-version}'
-
-- job-template:
-    # Job template for building & pushing docker images
-    #
-    # The purpose of this job template is to run:
-    #  1. inject a version.properties file and set versions
-    #  2. login to the docker registry
-    #  3. run a docker push
-    #
-    # This job supports subprojects.
-    #
-    # Required Variables:
-    #     pom:       name/location of the pom.xml file relative to the workspace
-    #     maven-properties: properties passed to maven
-
-    name: '{project-name}-{stream}-{subproject}-docker-version-java-daily'
-    project-type: freestyle
-    node: 'ubuntu1604-docker-8c-8g'
-    disabled: '{disabled}'
-    properties:
-      - infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-
-    parameters:
-      - infra-parameters:
-          project: '{project}'
-          branch: '{branch}'
-          refspec: 'refs/heads/{branch}'
-          artifacts: '{archive-artifacts}'
-      - maven-exec:
-          maven-version: '{maven-version}'
-      - maven-params:
-          mvn-params: '{mvn-params}'
-
-    scm:
-      - gerrit-trigger-scm:
-          refspec: ''
-          choosing-strategy: 'default'
-          submodule-recursive: '{submodule-recursive}'
-
-    wrappers:
-      - infra-wrappers:
-          build-timeout: '{build-timeout}'
-
-    triggers:
-      # 12 AM UTC
-      - timed: 'H 12 * * *'
-      - gerrit-trigger-release-manually:
-          server: '{server-name}'
-          project: '{project}'
-          branch: '{branch}'
-
-    builders:
-
-      - provide-maven-settings:
-          global-settings-file: 'global-settings'
-          settings-file: '{mvn-settings}'
-
-      - inject:
-          properties-file: version.properties
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          pom: '{pom}'
-          goals: 'versions:set versions:update-child-modules versions:commit -B'
-          properties:
-            - 'newVersion=${{release_version}}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-
-      - docker-login
-
-      - maven-docker-push-daily:
-          maven-version: '{maven-version}'
-          mvn-settings: '{mvn-settings}'
-          pom: '{docker-pom}'
-          # use default as mvn-profile if profile is not needed
-          mvn-profile: '{mvn-profile}'
-          mvn-params: '{mvn-params}'
-
-    publishers:
-      - infra-shiplogs:
-          maven-version: '{maven-version}'
-
 - job-template:
     # Job template for building & pushing docker images for AAI specific repos
     #
@@ -1489,96 +1245,6 @@
           maven-version: '{maven-version}'
 
 - job-template:
-    # Job template for building & pushing docker images for AAI specific repos
-    #
-    # The purpose of this job template is to run:
-    #  1. login to the docker registry
-    #  2. run maven goals
-    #  3. run include-docker-push.sh
-    #
-    # This job supports subprojects
-    #
-    # Required Variables:
-    #     pom:       name/location of the pom.xml file relative to the workspace
-    #     maven-properties: properties passed to maven
-
-    name: '{project-name}-{stream}-{subproject}-aai-docker-java-daily'
-    project-type: freestyle
-    node: 'ubuntu1604-docker-8c-8g'
-    disabled: '{disabled}'
-    docker-image-name: ''
-
-    properties:
-      - infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-
-    parameters:
-      - infra-parameters:
-          project: '{project}'
-          branch: '{branch}'
-          refspec: 'refs/heads/{branch}'
-          artifacts: '{archive-artifacts}'
-      - maven-exec:
-          maven-version: '{maven-version}'
-      - docker-image-name:
-          docker-image-name: '{docker-image-name}'
-
-    scm:
-      - gerrit-trigger-scm:
-          refspec: ''
-          choosing-strategy: 'default'
-          submodule-recursive: '{submodule-recursive}'
-
-    wrappers:
-      - infra-wrappers:
-          build-timeout: '{build-timeout}'
-
-    triggers:
-      # 12 AM UTC
-      - timed: 'H 12 * * *'
-      - gerrit-trigger-release-manually:
-          server: '{server-name}'
-          project: '{project}'
-          branch: '{branch}'
-
-    builders:
-
-      - provide-maven-settings:
-          global-settings-file: 'global-settings'
-          settings-file: '{mvn-settings}'
-
-      - docker-login
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          pom: 'pom.xml'
-          goals: 'clean install -DskipTests -B
-            -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          pom: '{pom}'
-          goals: '{mvn-goals}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-          properties:
-            - maven.test.skip=true
-            - docker.pull.registry=nexus3.onap.org:10001
-            - docker.push.registry=nexus3.onap.org:10003
-
-      - shell: !include-raw-escape: include-docker-push.sh
-
-    publishers:
-      - infra-shiplogs:
-          maven-version: '{maven-version}'
-
-- job-template:
     # Job template for Java merge jobs for SDC specific repos
     #
     # The purpose of this job template is to run:
@@ -1607,85 +1273,3 @@
           # use default as mvn-profile if profile is not needed
           mvn-profile: '{mvn-profile}'
           mvn-params: ''
-
-- job-template:
-    # Job template for building & pushing docker images for AAI specific repos
-    #
-    # The purpose of this job template is to run:
-    #  1. login to the docker registry
-    #  2. run maven clean install goals skipping tests
-    #  3. run maven goals
-    #
-    # Required Variables:
-    #     pom:       name/location of the pom.xml file relative to the workspace
-    #     maven-properties: properties passed to maven
-
-    name: '{project-name}-{stream}-aai-docker-java-version-daily'
-    project-type: freestyle
-    node: 'ubuntu1604-docker-8c-8g'
-    disabled: '{disabled}'
-    properties:
-      - infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-
-    parameters:
-      - infra-parameters:
-          project: '{project}'
-          branch: '{branch}'
-          refspec: 'refs/heads/{branch}'
-          artifacts: '{archive-artifacts}'
-      - maven-exec:
-          maven-version: '{maven-version}'
-
-    scm:
-      - gerrit-trigger-scm:
-          refspec: ''
-          choosing-strategy: 'default'
-          submodule-recursive: '{submodule-recursive}'
-
-    wrappers:
-      - infra-wrappers:
-          build-timeout: '{build-timeout}'
-
-    triggers:
-      # 12 AM UTC
-      - timed: 'H 12 * * *'
-      - gerrit-trigger-release-manually:
-          server: '{server-name}'
-          project: '{project}'
-          branch: '{branch}'
-
-    builders:
-
-      - provide-maven-settings:
-          global-settings-file: 'global-settings'
-          settings-file: '{mvn-settings}'
-
-      - docker-login
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          pom: 'pom.xml'
-          goals: 'clean install -DskipTests -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-
-      - maven-target:
-          maven-version: '{maven-version}'
-          pom: '{pom}'
-          goals: '{mvn-goals}'
-          settings: '{mvn-settings}'
-          settings-type: cfp
-          global-settings: 'global-settings'
-          global-settings-type: cfp
-          properties:
-            - maven.test.skip=true
-            - docker.pull.registry=nexus3.onap.org:10001
-            - docker.push.registry=nexus3.onap.org:10003
-
-    publishers:
-      - infra-shiplogs:
-          maven-version: '{maven-version}'
-