Skip to content

Commit 3af9e0f

Browse files
mknyszekgopherbot
authored andcommitted
env/freebsd-amd64: exit daemon when bootstrapswarm has a zero exit code
Part of the contract of running swarming_bot is that we need to keep restarting it if it has a non-zero exit code. But if it has a zero exit code, we must NOT restart it. Currently the daemon just always keeps restarting it. Do this by writing the pid of the daemon supervisor and using that to kill the supervisor when we get a zero exit code from bootstrapswarm. bootstrapswarm will exit with a zero exit code only if swarming_bot does. For golang/go#61095. Change-Id: I92bdea3fa35fed0883cd9e996aa231e26cdb7155 Reviewed-on: https://go-review.googlesource.com/c/build/+/622040 Auto-Submit: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent e046750 commit 3af9e0f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

env/freebsd-amd64/buildlet

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ rcvar=buildlet_enable
1010

1111
procname=/buildlet
1212
pidfile="/var/run/${name}.pid"
13+
suppidfile="/var/run/${name}-sup.pid"
1314
command=/usr/sbin/daemon
14-
command_args="-r -fc -p ${pidfile}"
15+
command_args="-r -fc -p ${pidfile} -P ${suppidfile}"
1516
command_args="${command_args} ${procname}"
1617
start_precmd="${name}_prestart"
1718
stop_cmd=":"
@@ -43,7 +44,7 @@ buildlet_prestart()
4344
swarming="${swarming}.appspot.com"
4445
info "Found Swarming host ${swarming}."
4546

46-
buildletsh="#!/bin/sh\n\nset -x\n\nsu -l swarming -c \"/usr/local/bin/bootstrapswarm --hostname $gcehost --swarming $swarming\"\n"
47+
buildletsh="#!/bin/sh\n\nset -x\n\nsu -l swarming -c \"/usr/local/bin/bootstrapswarm --hostname $gcehost --swarming $swarming && kill -s INT \$(cat $suppidfile)\"\n"
4748
echo -e $buildletsh >/buildlet
4849
;;
4950
*)

0 commit comments

Comments
 (0)