comparison build_upload_nightly @ 1800:0d942ecf38c5

Post build results to discord via webhook
author Michael Pavone <pavone@retrodev.com>
date Mon, 25 Mar 2019 23:13:08 -0700
parents 8e3adc6264d3
children 2efdace4fb8a
comparison
equal deleted inserted replaced
1799:ed6c38cd288c 1800:0d942ecf38c5
12 lxc-attach -n "$CONTAINER_NAME" -- /home/$BUILD_USER/blastem/build_nightly $BUILD_USER needsu 2>&1 > /tmp/build_${name}_out.log 12 lxc-attach -n "$CONTAINER_NAME" -- /home/$BUILD_USER/blastem/build_nightly $BUILD_USER needsu 2>&1 > /tmp/build_${name}_out.log
13 result=$? 13 result=$?
14 if [ $result -ne 0 ]; then 14 if [ $result -ne 0 ]; then
15 echo Build falied with return code $result stopping $CONTAINER_NAME 15 echo Build falied with return code $result stopping $CONTAINER_NAME
16 lxc-stop -n "$CONTAINER_NAME" 16 lxc-stop -n "$CONTAINER_NAME"
17 curdate=`date -Iseconds`
18 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
19 {
20 "embeds": [
21 {
22 "title": "Build $name failed!",
23 "type": "rich",
24 "description": "Build falied with return code $result stopping $CONTAINER_NAME"
25 "timestamp": "$curdate",
26 "color": 16711680,
27 }
28 ]
29 }
30 WEBHOOKEOF
17 exit $result 31 exit $result
18 fi 32 fi
19 echo "Build succeeded, stopping $CONTAINER_NAME" 33 echo "Build succeeded, stopping $CONTAINER_NAME"
20 lxc-stop -n "$CONTAINER_NAME" 34 lxc-stop -n "$CONTAINER_NAME"
21 . $HOME/remote.params 35 . $HOME/remote.params
22 artifact=$(tail -n 1 /tmp/build_${name}_out.log) 36 artifact=$(tail -n 1 /tmp/build_${name}_out.log)
23 echo "Uploaing $artifact to $REMOTE_HOST" 37 echo "Uploaing $artifact to $REMOTE_HOST"
24 scp -i "$REMOTE_IDENT" "$HOME/.local/share/lxc/$CONTAINER_NAME/rootfs/home/$BUILD_USER/blastem/$artifact" $REMOTE_USER@$REMOTE_HOST:/home/$REMOTE_USER/nightlies 38 scp -i "$REMOTE_IDENT" "$HOME/.local/share/lxc/$CONTAINER_NAME/rootfs/home/$BUILD_USER/blastem/$artifact" $REMOTE_USER@$REMOTE_HOST:/home/$REMOTE_USER/nightlies
25 echo "Done" 39 echo "Done"
40 curdate=`date -Iseconds`
41 version=`echo "$artifact" | sed -E 's/[^-]+-([0-9]+\.[0-9]+\.[0-9]+[^.]*)\..*$/\1/'`
42 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
43 {
44 "embeds": [
45 {
46 "title": "New build of $name succeeded!",
47 "type": "rich",
48 "url": "https://www.retrodev.com/blastem/nightlies/$artifact"
49 "description": "Version: $version"
50 "timestamp": "$curdate",
51 "color": 65280,
52 }
53 ]
54 }
55 WEBHOOKEOF