Make AppImage upload optional and add timeout
authorMichael Schuster <michael@schuster.ms>
Sat, 16 Nov 2019 20:36:59 +0000 (21:36 +0100)
committerMichael Schuster <michael@schuster.ms>
Sat, 16 Nov 2019 20:36:59 +0000 (21:36 +0100)
Moves the upload into a separate Drone command and adds a timeout for curl
to fail after 15 minutes.

Returns zero to keep Drone from failing.

Signed-off-by: Michael Schuster <michael@schuster.ms>
.drone.yml
admin/linux/build-appimage.sh
admin/linux/upload-appimage.sh [new file with mode: 0755]

index b00420981d4956c5ae063dc2134439cc20018588..e5f8204c523b18c16fe6a54401dff2bbb912ed8e 100644 (file)
@@ -322,6 +322,7 @@ steps:
   image: nextcloudci/client-5.12:client-5.12-5
   commands:
     - /bin/bash -c "./admin/linux/build-appimage.sh"
+    - /bin/bash -c "./admin/linux/upload-appimage.sh"
 trigger:
   branch:
     - master
index 7ea22bf523bb07a129404f5e5f5f3151cce5c31f..a73c45e772258d063309f8caa197b7ad12b6eaaf 100755 (executable)
@@ -100,8 +100,3 @@ export LD_LIBRARY_PATH=/app/usr/lib/
 ./squashfs-root/AppRun ${DESKTOP_FILE} -appimage
 
 mv Nextcloud*.AppImage Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
-
-curl --upload-file $(readlink -f ./Nextcloud*.AppImage) https://transfer.sh/Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
-
-echo
-echo "Get the AppImage at the link above!"
diff --git a/admin/linux/upload-appimage.sh b/admin/linux/upload-appimage.sh
new file mode 100755 (executable)
index 0000000..518a331
--- /dev/null
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+set -xe
+
+# Upload AppImage
+APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
+BASENAME=$(basename ${APPIMAGE})
+
+if curl --max-time 900 --upload-file ${APPIMAGE} https://transfer.sh/${BASENAME}
+then
+    echo
+    echo "Get the AppImage at the link above!"
+else
+    echo
+    echo "Upload failed, however this is an optional step."
+fi
+
+# Don't let the Drone build fail
+exit 0
\ No newline at end of file