Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix github-maven-merge scm config
[releng/global-jjb.git]
/
shell
/
deploy-maven-file.sh
diff --git
a/shell/deploy-maven-file.sh
b/shell/deploy-maven-file.sh
index
ac6a438
..
e5bf050
100644
(file)
--- a/
shell/deploy-maven-file.sh
+++ b/
shell/deploy-maven-file.sh
@@
-1,5
+1,5
@@
-#!/bin/bash
-#
@License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+#!/bin/bash
-l
+#
SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
#
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
#
@@
-12,25
+12,40
@@
# This script publishes packages (rpms/debs) or any file to Nexus hosted
# maven2 repository.
#
# 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.
# $REPO_ID : Provided by a job parameter.
+# A repository ID represents the repository.
# $GROUP_ID : Provided by a job parameter.
# $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"
echo "---> deploy-maven-file.sh"
+
+# DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
# Ensure we fail the job if any steps fail.
# Ensure we fail the job if any steps fail.
-set -eu -o pipefail
+set -e -o pipefail
+set +u
+
+export MAVEN_OPTIONS
+export MAVEN_PARAMS
DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
mkdir -p "$WORKSPACE/archives"
DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
mkdir -p "$WORKSPACE/archives"
-NEXUS_REPO_URL="${NEXUS_URL}/$REPO_ID"
-mkdir -p "$UPLOAD_FILES_PATH"
-
while IFS="" read -r file
do
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" \
"$REPO_ID" \
"$file" \
-b "$MVN" \
- -g "$GROUP_ID" | tee "$DEPLOY_LOG"
-done < <(find "$UPLOAD_FILES_PATH" -type d -name "*")
+ -g "$GROUP_ID" \
+ -p "$MAVEN_OPTIONS $MAVEN_PARAMS" \
+ |& tee "$DEPLOY_LOG"
+done < <(find "$UPLOAD_FILES_PATH" -xtype f -name "*")