CI Jobs for separated trellis, and tost-onos repos

Use existing ONOS GPG key for maven builds

Change-Id: I29bcf27ae8631b41a4f89ac926258a973626c19a
diff --git a/jjb/templates/maven.yaml b/jjb/templates/maven.yaml
new file mode 100644
index 0000000..7d8788a
--- /dev/null
+++ b/jjb/templates/maven.yaml
@@ -0,0 +1,141 @@
+---
+# maven jobs for Java projects
+
+- job-template:
+    id: maven-test
+    name: 'verify_{project}_maven-test{name-extension}'
+    description: |
+      <!-- Managed by Jenkins Job Builder -->
+      Created by {id} job-template from ci-management/jjb/maven.yaml
+
+    node: 'ubuntu16.04-basebuild-1c-2g'
+    project-type: freestyle
+
+    parameters:
+      - string:
+          name: jdkDistro
+          default: '{jdk-distribution}'
+          description: 'Distribution of the JDK to use with update-java-alternatives'
+
+    triggers:
+      - onf-infra-gerrit-trigger-patchset:
+          gerrit-server-name: '{gerrit-server-name}'
+          project-regexp: '{project}'
+          branch-regexp: '{branch-regexp}'
+          file-include-regexp: '{all-files-regexp}'
+          dependency-jobs: '{dependency-jobs}'
+
+    properties:
+      - onf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '$GIT_URL/$GERRIT_PROJECT'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-disable: '{submodule-disable}'
+          submodule-recursive: 'false'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: gerrit
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    builders:
+      # Set JDK version
+      - shell: |
+          #!/usr/bin/env bash
+          set -eu -o pipefail
+          echo "Setting JDK Distro to: $jdkDistro"
+          sudo update-java-alternatives -s $jdkDistro
+          echo "Java Version:"
+          java -version
+
+      # run tests and install
+      - maven-target:
+          pom: pom.xml
+          settings: 'release-build-maven-settings'
+          settings-type: cfp
+          goals: '-Pci-verify clean test install'
+
+    publishers:
+      - junit:
+          results: "**/TEST-*.xml"
+          allow-empty-results: '{junit-allow-empty-results}'
+      - cobertura:
+          report-file: "**/*coverage.xml"
+          targets:
+            - files:
+                healthy: 80
+                unhealthy: 0
+                failing: 0
+            - method:
+                healthy: 50
+                unhealthy: 0
+                failing: 0
+
+- job-template:
+    id: maven-publish
+    name: 'maven-publish{name-extension}_{project}'
+    description: |
+      <!-- Managed by Jenkins Job Builder -->
+      Created by {id} job-template from ci-management/jjb/maven.yaml
+
+    node: 'ubuntu16.04-basebuild-1c-2g'
+    project-type: freestyle
+
+    parameters:
+      - string:
+          name: jdkDistro
+          default: '{jdk-distribution}'
+          description: 'Distribution of the JDK to use with update-java-alternatives'
+
+    triggers:
+      - onf-infra-gerrit-trigger-merge:
+          gerrit-server-name: '{gerrit-server-name}'
+          project-regexp: '{project}'
+          branch-regexp: '{branch-regexp}'
+          file-include-regexp: '{all-files-regexp}'
+          dependency-jobs: '{dependency-jobs}'
+
+    properties:
+      - onf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '$GIT_URL/$GERRIT_PROJECT'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-disable: '{submodule-disable}'
+          submodule-recursive: 'false'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: gerrit
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    builders:
+      # Provide GPG key file
+      - config-file-provider:
+          files:
+            - file-id: 'gpg-key'
+              target: 'jenkins.key'
+              variable: 'GPG_KEY_FILE'
+
+      # Set JDK version
+      - shell: |
+          #!/usr/bin/env bash
+          set -eu -o pipefail
+          echo "Setting JDK Distro to: $jdkDistro"
+          sudo update-java-alternatives -s $jdkDistro
+          echo "Java Version:"
+          java -version
+          echo "Import GPG key"
+          gpg --import jenkins.key
+
+      # make build release and deploy
+      - maven-target:
+          pom: pom.xml
+          settings: 'release-build-maven-settings'
+          settings-type: cfp
+          goals: '-Prelease clean deploy'