use a special code so that remote builds can abort themselves by passing back the command to master

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 13afaf7d
......@@ -2,6 +2,13 @@
set -e
# if we are in a remote node, return a special code so that jenkins_master_wrapper
# can abort the job for us (this assumes everything has been `exec`ed all the
# way to us, and that our pared is sshd itself).
if [ -n "$SSH_ORIGINAL_COMMAND" ] && [ -z "${JENKINS_URL-}" ]; then
exit 123
fi
# generally interesting: BUILD_* JENKINS_* JOB_* but most is in BUILD_URL, so:
export | grep -E "(BUILD_URL=)" || :
TMPFILE=$(mktemp)
......
......@@ -75,6 +75,11 @@ ssh -o "BatchMode = yes" $NODE_NAME "$PARAMS" || {
printf "\nSSH EXIT CODE: %s\n" $RETVAL
}
if [ "$RETVAL" -eq 123 ]; then
# special code passed returned by the remote abort.sh
exec /srv/jenkins/bin/abort.sh
fi
# grab artifacts and tidy up at the other end
if [ "$RETRIEVE_ARTIFACTS" = "yes" ] ; then
RESULTS="$WORKSPACE/workspace/$JOB_NAME/results"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment