X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fdeploy-maven-file.sh;h=1b89538965d7d7355106d5d162d99ee7472a05e2;hb=6eefde1f463638b5021c2ec96eb67a017d379f1f;hp=37cfd9f4f51eebe27c185b1dd4085691406450ff;hpb=2534bee091ace950a94db3eab1215c6ed3f77c4c;p=releng%2Fglobal-jjb.git diff --git a/shell/deploy-maven-file.sh b/shell/deploy-maven-file.sh index 37cfd9f4..1b895389 100644 --- a/shell/deploy-maven-file.sh +++ b/shell/deploy-maven-file.sh @@ -12,10 +12,18 @@ # 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,15 +37,15 @@ 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" \ + file_size=$(stat --printf="%s" "${file}") + echo "Deploy ${file##*/} with ${file_size} bytes." + lftools deploy maven-file "$MAVEN_REPO_URL" \ "$REPO_ID" \ "$file" \ -b "$MVN" \ -g "$GROUP_ID" \ - -p "$MAVEN_PARAMS $MAVEN_OPTIONS" \ + -p "$MAVEN_OPTIONS $MAVEN_PARAMS" \ |& tee "$DEPLOY_LOG" -done < <(find "$UPLOAD_FILES_PATH" -type f -name "*") +done < <(find "$UPLOAD_FILES_PATH" -xtype f -name "*")