From: Thanh Ha Date: Thu, 3 Aug 2017 21:09:12 +0000 (-0400) Subject: Trim trailing slashes from URL inputs X-Git-Tag: v0.7.0~7 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F5731%2F1;p=releng%2Flftools.git Trim trailing slashes from URL inputs Trailing slashes in URLs causes the staging code to upload to //org.opendaylight.project instead of /org.opendaylight.project which fails our URL pattern matching target defined in Nexus since Nexus thinks // as a blank directory in the path. We need to make sure extraneous / does not get pushed in by the user so trim it off if they do. Issue: RELENG-351 Change-Id: I264fec5c41e89d588e03a9c447917ee8a3623c62 Signed-off-by: Thanh Ha --- diff --git a/shell/deploy b/shell/deploy index 06ee1bd5..d61ff9a7 100755 --- a/shell/deploy +++ b/shell/deploy @@ -128,7 +128,7 @@ deploy_archives() { exit 1 fi - local nexus_url="$1" + local nexus_url="${1%/}" local nexus_path="$2" # Workspace of where to search for files to archive. local workspace="$3" @@ -196,7 +196,7 @@ deploy_logs() { exit 1 fi - local nexus_url="$1" + local nexus_url="${1%/}" local nexus_path="$2" local build_url="$3" @@ -342,7 +342,7 @@ deploy_maven_file () { shift $((OPTIND-1)) # User input - local nexus_url="$1" + local nexus_url="${1%/}" local repo_id="$2" local file="$3" @@ -506,7 +506,7 @@ deploy_nexus() { # deploy-at-end configuration with upstream Maven. # https://issues.apache.org/jira/browse/MDEPLOY-193 - local nexus_repo_url="$1" + local nexus_repo_url="${1%/}" local deploy_dir="$2" if [ -z "$2" ]; then @@ -542,7 +542,7 @@ deploy_nexus_stage() { # staging repo. # deploy_dir: The directory to deploy. (Ex: /tmp/m2repo) - local nexus_url="$1" + local nexus_url="${1%/}" local staging_profile_id="$2" local deploy_dir="$3" @@ -625,7 +625,7 @@ deploy_nexus_zip() { # Site Ex: org.opendaylight.odlparent # deploy_zip: The zip to deploy. (Ex: /tmp/artifacts.zip) - local nexus_url="$1" + local nexus_url="${1%/}" local nexus_repo="$2" local nexus_path="$3" local deploy_zip="$4" @@ -648,7 +648,7 @@ upload_to_nexus() { # nexus_repo_url: The URL to the Nexus repo. # (Ex: https://nexus.example.org/content/repositories/release) # file: File that is to be pushed to Nexus. - local nexus_repo_url="$1" + local nexus_repo_url="${1%/}" local file="$2" echo "Uploading ${file}"