From 459dded53778ab22fa02d289e320c9cf1a1ca286 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 9 Jan 2018 16:38:32 -0500 Subject: [PATCH] Improve debugging output for deploy nexus-zip cmd Print out the HTTP Status code as well as the http response from the server (if any, Nexus doesn't always return any) and the contents of the zip file on failure. Issue: RT-50048 Change-Id: I54014819d18c0090c45fd8378954dc9aa5e540f8 Signed-off-by: Thanh Ha --- shell/deploy | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/shell/deploy b/shell/deploy index a983baa6..c664c36a 100755 --- a/shell/deploy +++ b/shell/deploy @@ -685,9 +685,17 @@ deploy_nexus_zip() { exit 1 fi - echo "Pushing $deploy_zip to $nexus_repo on $nexus_url" - curl --netrc --upload-file "$deploy_zip" \ - "${nexus_url}/service/local/repositories/${nexus_repo}/content-compressed/${nexus_path}" + echo "Pushing $deploy_zip to $nexus_repo on $nexus_url to path $nexus_path" + resp=$(curl -s -w "\\n\\n%{http_code}" --netrc --upload-file "$deploy_zip" \ + "${nexus_url}/service/local/repositories/${nexus_repo}/content-compressed/${nexus_path}") + status=$(echo "$resp" | awk 'END {print $NF}') + + echo "HTTP status: $status" + if [[ "$status" != "20"* ]]; then + echo "Failed with: $resp" + echo "Zip contains: $(unzip -l "$deploy_zip")" + exit "$status" + fi } upload_to_nexus() { -- 2.16.6