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 <thanh.ha@linuxfoundation.org>
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() {