Split maven-deploy into a macro 36/8436/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 19 Jan 2018 01:10:24 +0000 (20:10 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 19 Jan 2018 02:25:10 +0000 (21:25 -0500)
Split out maven-deploy into a reusable macro.

Change-Id: I6ddad68576cdbf9d9ef8b4805da94dc6a80cbefd
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
docs/jjb/lf-maven-jobs.rst
jjb/lf-maven-jobs.yaml
shell/common-variables.sh
shell/maven-deploy.sh

index 6073594..d1acc8d 100644 (file)
@@ -57,6 +57,10 @@ lf-maven-common
 
 Common Jenkins configuration for Maven jobs.
 
+lf-maven-deploy
+---------------
+
+Calls the maven deploy script to push artifacts to Nexus.
 
 Job Templates
 =============
index 8b3f3ac..d290115 100644 (file)
       - github-maven-javadoc-publish
       - github-maven-javadoc-verify
 
+##########
+# Macros #
+##########
+
+- builder:
+    name: lf-maven-deploy
+    builders:
+      - shell: !include-raw:
+          - ../shell/common-variables.sh
+          - ../shell/maven-deploy.sh
+
 ####################
 # COMMON FUNCTIONS #
 ####################
           - ../shell/common-variables.sh
           - ../shell/maven-fetch-metadata.sh
           - ../shell/maven-build.sh
-          - ../shell/maven-deploy.sh
+      - lf-maven-deploy
       - lf-provide-maven-settings-cleanup
 
     publishers:
index 20c1c5c..7bbc36f 100644 (file)
@@ -20,3 +20,10 @@ MAVEN_OPTIONS="$(echo --show-version \
     -Dmaven.repo.local=/tmp/r \
     -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
 echo "$MAVEN_OPTIONS"
+
+# Activates the lftools virtualenv
+lftools_activate() {
+    virtualenv --quiet "/tmp/v/lftools"
+    # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
+    source "/tmp/v/lftools/bin/activate"
+}
index 15928ee..6d4165e 100644 (file)
@@ -20,6 +20,8 @@ set -eu -o pipefail
 m2repo_dir="$WORKSPACE/m2repo"
 nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
 
+lftools_activate
+
 # Remove metadata files that were not updated.
 set +e  # Temporarily disable to run diff command.
 IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \