summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-25 14:57:59 +0200
committerErich Eckner <git@eckner.net>2018-07-25 14:57:59 +0200
commit22cd0ae466e2a8423a3942d814750cd7268eb987 (patch)
tree6a10fbe1bf45fb6141c4652c33f9779e4909f416
parent49727af5d8015c356288c6cf5f062348768e7849 (diff)
downloadbuilder-22cd0ae466e2a8423a3942d814750cd7268eb987.tar.xz
bin/return-assignment: allow aborting a build-order by the building slave
-rwxr-xr-xbin/return-assignment15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index e761b61..d9d87be 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -26,6 +26,21 @@ if [ -s "${work_dir}/build-master-sanity" ]; then
exit 1
fi
+# aborting does not need any locks
+if [ $# -eq 1 ] && \
+ [ "$1" = 'ABORT' ]; then
+ # shellcheck disable=SC2016
+ {
+ printf 'UPDATE `build_slaves`'
+ printf ' SET `build_slaves`.`currently_building`=NULL'
+ # shellcheck disable=SC2154
+ printf ' WHERE `build_slaves`.`id`=%s;\n' \
+ "${slave_id}"
+ } | \
+ mysql_run_query
+ exit
+fi
+
# Create a lock file and a trap.
exec 9> "${build_list_lock_file}"