annotate build_upload_nightly @ 1975:3701517d852c

Avoid expensive re-init from switching to external sync after render_init has been called
author Michael Pavone <pavone@retrodev.com>
date Fri, 08 May 2020 16:52:32 -0700
parents 2efdace4fb8a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1240
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #!/bin/sh
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 name=$1
1241
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
4 . "$HOME/$name.params"
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
5 echo Starting $CONTAINER_NAME
1240
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 lxc-start -n "$CONTAINER_NAME"
1241
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
7 if [ $? -ne 0 ]; then
1240
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 exit $?
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 fi
1243
50700d370a33 Seems like network in the container takes a moment to work, added a sleep to build_upload_nightly to compensate
Michael Pavone <pavone@retrodev.com>
parents: 1242
diff changeset
10 sleep 10
1241
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
11 echo Starting build by $BUILD_USER in $CONTAINER_NAME
1252
8e3adc6264d3 Don't depend on USER being set in build_nightly as it does not seem to work when build job is run from cron
Michael Pavone <pavone@retrodev.com>
parents: 1251
diff changeset
12 lxc-attach -n "$CONTAINER_NAME" -- /home/$BUILD_USER/blastem/build_nightly $BUILD_USER needsu 2>&1 > /tmp/build_${name}_out.log
1251
f249fd91b0f5 More logging. Fix path in upload step of build_upload_win_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1250
diff changeset
13 result=$?
f249fd91b0f5 More logging. Fix path in upload step of build_upload_win_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1250
diff changeset
14 if [ $result -ne 0 ]; then
f249fd91b0f5 More logging. Fix path in upload step of build_upload_win_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1250
diff changeset
15 echo Build falied with return code $result stopping $CONTAINER_NAME
1241
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
16 lxc-stop -n "$CONTAINER_NAME"
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
17 curdate=`date -Iseconds`
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
18 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
19 {
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
20 "embeds": [
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
21 {
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
22 "title": "Build $name failed!",
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
23 "type": "rich",
1801
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
24 "description": "Build falied with return code $result stopping $CONTAINER_NAME",
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
25 "timestamp": "$curdate",
1801
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
26 "color": 16711680
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
27 }
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
28 ]
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
29 }
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
30 WEBHOOKEOF
1252
8e3adc6264d3 Don't depend on USER being set in build_nightly as it does not seem to work when build job is run from cron
Michael Pavone <pavone@retrodev.com>
parents: 1251
diff changeset
31 exit $result
1240
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 fi
1250
738c8aa2c741 Add some logging to build_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1243
diff changeset
33 echo "Build succeeded, stopping $CONTAINER_NAME"
1241
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
34 lxc-stop -n "$CONTAINER_NAME"
23a2cf9782a7 Fixes for nightly build upload script
Michael Pavone <pavone@retrodev.com>
parents: 1240
diff changeset
35 . $HOME/remote.params
1240
c63516b6824a Fun untested changes for uploading nightly builds
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 artifact=$(tail -n 1 /tmp/build_${name}_out.log)
1250
738c8aa2c741 Add some logging to build_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1243
diff changeset
37 echo "Uploaing $artifact to $REMOTE_HOST"
1242
73003ad27518 Use public key auth rather than trying to make passowrd auth work in a script
Michael Pavone <pavone@retrodev.com>
parents: 1241
diff changeset
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
1250
738c8aa2c741 Add some logging to build_nightly
Michael Pavone <pavone@retrodev.com>
parents: 1243
diff changeset
39 echo "Done"
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
40 curdate=`date -Iseconds`
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
41 version=`echo "$artifact" | sed -E 's/[^-]+-([0-9]+\.[0-9]+\.[0-9]+[^.]*)\..*$/\1/'`
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
42 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
43 {
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
44 "embeds": [
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
45 {
1801
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
46 "title": "$artifact",
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
47 "type": "rich",
1801
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
48 "url": "https://www.retrodev.com/blastem/nightlies/$artifact",
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
49 "description": "New build of $name succeeded!",
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
50 "timestamp": "$curdate",
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
51 "color": 65280,
1801
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
52 "fields": [
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
53 {
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
54 "name": "Version",
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
55 "value": "$version"
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
56 }
2efdace4fb8a Fix and update JSON payload for webhook in build scripts
Michael Pavone <pavone@retrodev.com>
parents: 1800
diff changeset
57 ]
1800
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
58 }
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
59 ]
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
60 }
0d942ecf38c5 Post build results to discord via webhook
Michael Pavone <pavone@retrodev.com>
parents: 1252
diff changeset
61 WEBHOOKEOF