ONAP: Handle MVN settings.xml file as part of project build
Change-Id: I7a14c9d1ddbab8918d3a32adfbf8605f166f7176
diff --git a/jjb/onap/global-templates-local-onap-java.yaml b/jjb/onap/global-templates-local-onap-java.yaml
index 8917068..0cc83b9 100644
--- a/jjb/onap/global-templates-local-onap-java.yaml
+++ b/jjb/onap/global-templates-local-onap-java.yaml
@@ -8,6 +8,7 @@
disabled: '{obj:disabled_job_var}'
concurrent: true
+ mvn_settings_xml_version:
properties:
- logrotate
@@ -32,6 +33,10 @@
name: MVN
default: $WORKSPACE/apache-maven-${{MVN_VERSION}}/bin/mvn
description: Path to mvn executable
+ - string:
+ name: MVN_SETTINGS_XML_VERSION
+ default: '{mvn_settings_xml_version}'
+ description: Commit ID of ONAP Oparent repository (https://git.onap.org/oparent/) to pull. Used for Maven settings file. Can be left blank to pull the latest version.
scm:
- git-scm-gerrit:
diff --git a/jjb/onap/global-templates-onap-java.yaml b/jjb/onap/global-templates-onap-java.yaml
index 7a3f2ce..f2fab41 100644
--- a/jjb/onap/global-templates-onap-java.yaml
+++ b/jjb/onap/global-templates-onap-java.yaml
@@ -5,6 +5,7 @@
disabled: '{obj:disabled_job_var}'
concurrent: true
+ mvn_settings_xml_version:
properties:
- logrotate
@@ -29,6 +30,10 @@
name: MVN
default: $WORKSPACE/apache-maven-${{MVN_VERSION}}/bin/mvn
description: Path to mvn executable
+ - string:
+ name: MVN_SETTINGS_XML_VERSION
+ default: '{mvn_settings_xml_version}'
+ description: Commit ID of ONAP Oparent repository (https://git.onap.org/oparent/) to pull. Used for Maven settings file. Can be left blank to pull the latest version.
scm:
- git-scm-gerrit:
diff --git a/jjb/onap/verify-jobs.sh b/jjb/onap/verify-jobs.sh
index fe437ef..b07f82d 100755
--- a/jjb/onap/verify-jobs.sh
+++ b/jjb/onap/verify-jobs.sh
@@ -14,6 +14,26 @@
echo "----------------------------------------------------"
$MVN -version
echo "----------------------------------------------------"
+echo "Downloading ONAP Maven XML for build process from oparent repo"
+echo "----------------------------------------------------"
+git clone "https://git.onap.org/oparent" $WORKSPACE/oparent
+cd $WORKSPACE/oparent
+# Check if a commitid parameter is given to specify a version of
+# oparent repository to checkout. If commitid is not provided, the
+# latest master version is used as default for backward
+# compatibility for existing ONAP jobs.
+set +o nounset
+if [[ -v ${MVN_SETTINGS_XML_VERSION} ]]; then
+ git checkout "${MVN_SETTINGS_XML_VERSION}"
+fi
+set -o nounset
+# Copy Onap maven settings.xml to Jenkins home directory
+if [ ! -d /home/jenkins/.m2 ]; then
+ mkdir -p /home/jenkins/.m2/
+fi
+cp settings.xml /home/jenkins/.m2/settings.xml
+cd $WORKSPACE
+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