summaryrefslogtreecommitdiffstats
path: root/common/scripts/artiproxy-upload.sh
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-07-04 19:05:52 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2021-07-04 19:05:52 +0000
commit23bb2b54f6bdcd159a7d08ce3ac83836d568af04 (patch)
treecf988474d0b763724923d1107677b505ebabd891 /common/scripts/artiproxy-upload.sh
parentc6421d6d2955a8fe9b754c2e348c05615d9d3c71 (diff)
parent840e93ebc56a57ab7557001fd15b68ee408e229f (diff)
Merge "SPEC-4003: Use pyartiproxy for uploading a file to artyfactory"lamprey_12.0.1lamprey_12.0.0lamprey/12.0.1lamprey/12.0.012.0.112.0.0
Diffstat (limited to 'common/scripts/artiproxy-upload.sh')
-rwxr-xr-xcommon/scripts/artiproxy-upload.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/common/scripts/artiproxy-upload.sh b/common/scripts/artiproxy-upload.sh
new file mode 100755
index 0000000..c4b7dbe
--- /dev/null
+++ b/common/scripts/artiproxy-upload.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+if [ -z "$PYARTIPROXY_IP" ];then
+ #echo "ERROR: cannot upload, no PYARTIPROXY_IP"
+ #exit 1
+ # TODO: lab-baylibre-agl does not get env as it should be. I will debug this later.
+ echo "DEBUG: No PYARTIPROXY_IP variable, fallback to baylibre one"
+ PYARTIPROXY_IP=10.1.1.47
+fi
+
+if [ -z "$1" ];then
+ echo "ERROR: missing path argument"
+ exit 1
+fi
+
+if [ -z "$2" ];then
+ echo "ERROR: missing filename argument"
+ exit 1
+fi
+
+curl --silent --show-error -F "filename=$2" -F "data=@$1" http://$PYARTIPROXY_IP:9090/cgi-bin/pyartiproxy.py --output curl.out
+if [ $? -ne 0 ];then
+ echo "ERROR: with curl"
+ # retry without silent
+ curl --show-error -F "filename=$2" -F "data=@$1" http://$PYARTIPROXY_IP:9090/cgi-bin/pyartiproxy.py --output curl.out
+fi
+ARTI_URL=$(grep -E '^http://.*|https://.*' curl.out)
+echo "==========================="
+cat curl.out
+echo "==========================="
+if [ -z "$ARTI_URL" ];then
+ # No URL something is wrong
+ lava-test-reference artifactory-$2 --result fail
+ exit 1
+else
+ lava-test-reference artifactory-$2 --result pass --reference $ARTI_URL
+fi