Skip to content
Commits on Source (2)
......@@ -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"
......
......@@ -4,7 +4,7 @@
# There doesn't seem to be any better way to figure out the agent name
# from here, let's just hope all WORKSPACE have been set correctly
NODE_NAME="$(basename ${WORKSPACE})"
NODE_NAME="$(basename "${WORKSPACE}")"
echo "Starting agent.jar for ${NODE_NAME}..."
......@@ -17,5 +17,6 @@ if [ -f "$f" ]; then
fi
echo "This jenkins agent.jar will run as PID $$."
export JAVA_ARGS="-Xms1G -Xmx2G"
JAVA_ARGS="-Xms1G -Xmx2G"
# shellcheck disable=SC2086
exec java $JAVA_ARGS -jar /var/lib/jenkins/agent.jar