Merge "Generalize deploy maven-file builder"
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 10 Aug 2017 03:17:12 +0000 (03:17 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Thu, 10 Aug 2017 03:17:12 +0000 (03:17 +0000)
jjb/lf-macros.yaml
shell/deploy-maven-file.sh

index 7d2cd98..10a332a 100644 (file)
           settings-file: '{settings-file}'
       - inject:
           properties-content: |
+              MAVEN_REPO_URL={maven-repo-url}
               REPO_ID={repo-id}
               GROUP_ID={group-id}
-              UPLOAD_FILES_PATH={files-dir}
+              UPLOAD_FILES_PATH={upload-files-dir}
       - shell: !include-raw-escape:
           - ../shell/lftools-install.sh
           - ../shell/common-variables.sh
index 37cfd9f..dfb9a5a 100644 (file)
 # This script publishes packages (rpms/debs) or any file to Nexus hosted
 # maven2 repository.
 #
-# $NEXUS_URL          :  Jenkins global variable should be defined.
+# $MAVEN_REPO_URL     :  Provided by a job parameter.
+#                        The calling job can set $NEXUS_URL path or local
+#                        directory to stage files. ex:
+#                         -Durl="${NEXUS_URL}/content/repositories/$REPO_ID"
+#                         -Durl="file://$WORKSPACE/m2repo"
 # $REPO_ID            :  Provided by a job parameter.
+#                        A repository ID represents the repository.
 # $GROUP_ID           :  Provided by a job parameter.
-# $UPLOAD_FILES_PATH  :  Provided by a job parameter.
+#                        A group ID represents a nexus group.
+# $UPLOAD_FILES_PATH   :  Provided by a job parameter.
+#                        The directory contains one or more artifacts.
+
 echo "---> deploy-maven-file.sh"
 
 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
@@ -29,11 +37,9 @@ export MAVEN_PARAMS
 DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
 mkdir -p "$WORKSPACE/archives"
 
-NEXUS_REPO_URL="${NEXUS_URL}/content/repositories/$REPO_ID"
-
 while IFS="" read -r file
 do
-    lftools deploy maven-file "$NEXUS_REPO_URL" \
+    lftools deploy maven-file "$MAVEN_REPO_URL" \
                               "$REPO_ID" \
                               "$file" \
                               -b "$MVN" \