[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: shut up shellchec

Mattia Rizzolo gitlab at salsa.debian.org
Tue May 21 15:36:30 BST 2019



Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
13afaf7d by Mattia Rizzolo at 2019-05-21T14:19:25Z
shut up shellchec

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
17303def by Mattia Rizzolo at 2019-05-21T14:35:53Z
use a special code so that remote builds can abort themselves by passing back the command to master

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


3 changed files:

- bin/abort.sh
- bin/jenkins_master_wrapper.sh
- bin/start-agent.sh


Changes:

=====================================
bin/abort.sh
=====================================
@@ -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)


=====================================
bin/jenkins_master_wrapper.sh
=====================================
@@ -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"


=====================================
bin/start-agent.sh
=====================================
@@ -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



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/dd86f22e2e4ba1ce00fb66ec7b05a109cda1db9e...17303defc18c8ceb432653c570883489243bb770

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/dd86f22e2e4ba1ce00fb66ec7b05a109cda1db9e...17303defc18c8ceb432653c570883489243bb770
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20190521/c78e3a4b/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list