Add datarouter verify job
Refactor for reuseable job-template
Signed-off-by: Conor Ward <conor.ward@est.tech>
Change-Id: I1e9b6cf6604df0d6b265c6bc6dfe4bc4947914bb
diff --git a/jjb/global/global-templates-java.yaml b/jjb/global/global-templates-java.yaml
new file mode 100644
index 0000000..639168b
--- /dev/null
+++ b/jjb/global/global-templates-java.yaml
@@ -0,0 +1,46 @@
+- job-template:
+ name: '{project-name}-{stream}-verify-java'
+
+ node: onap-ubuntu1604
+
+ disabled: false
+
+ concurrent: true
+
+ parameters:
+ - project-parameters:
+ project: '{project}'
+ branch: '{branch}'
+ - nordix-gerrit-parameters
+ - string:
+ name: JAVA_HOME
+ default: /usr/lib/jvm/java-1.8.0-openjdk-amd64
+ description: Java home
+ - string:
+ name: MVN_VERSION
+ default: 3.3.9
+ description: Maven version
+ - string:
+ name: MVN_URL
+ default: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/$MVN_VERSION/apache-maven-${{MVN_VERSION}}-bin.zip
+ description: URL to download Maven
+ - string:
+ name: MVN
+ default: $WORKSPACE/apache-maven-${{MVN_VERSION}}/bin/mvn
+ description: Path to mvn executable
+
+ scm:
+ - git-scm-gerrit:
+ ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+ branch: '{branch}'
+ refspec: $GERRIT_REFSPEC
+
+ triggers:
+ - nordix-gerrit-trigger-patchset-created:
+ project: '{project}'
+ branch: '{branch}'
+ files: '**'
+
+ builders:
+ - shell:
+ !include-raw-escape: ./verify-jobs.sh
diff --git a/jjb/global/verify-jobs.sh b/jjb/global/verify-jobs.sh
new file mode 100755
index 0000000..2ffc1d2
--- /dev/null
+++ b/jjb/global/verify-jobs.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cd $WORKSPACE
+echo "Info: Java version"
+echo "----------------------------------------------------"
+java -version
+echo "----------------------------------------------------"
+echo "Downloading Maven $MVN_VERSION from $MVN_URL"
+wget -q $MVN_URL && unzip -qq apache-maven-${MVN_VERSION}-bin.zip
+echo "Info: Maven version"
+echo "----------------------------------------------------"
+$MVN -version
+echo "----------------------------------------------------"
+echo "Proceeding with unit test"
+echo "----------------------------------------------------"
+$MVN clean install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
\ No newline at end of file