[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 3 commits: start-agent: don't overwrite mindlessly NODE_NAME, that we expect Jenkins to...

Mattia Rizzolo (@mattia) gitlab at salsa.debian.org
Fri Oct 22 15:05:05 BST 2021



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


Commits:
2af6c39e by Mattia Rizzolo at 2021-10-22T16:01:10+02:00
start-agent: don't overwrite mindlessly NODE_NAME, that we expect Jenkins to properly set for us instead

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

- - - - -
131eb841 by Mattia Rizzolo at 2021-10-22T16:01:45+02:00
start-agent: be more strict about errors, etc

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

- - - - -
2828b20f by Mattia Rizzolo at 2021-10-22T16:04:38+02:00
master_wrapper: explicit warning on console if NODE_NAME is not what we expect it to be

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

- - - - -


2 changed files:

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


Changes:

=====================================
bin/jenkins_master_wrapper.sh
=====================================
@@ -14,6 +14,7 @@ set -e
 . /srv/jenkins/bin/jenkins_node_definitions.sh
 
 if [ "${NODE_NAME%.*}" = "$NODE_NAME" ]; then
+	echo "Warning: NODE_NAME ($NODE_NAME) is not a FQDN.  Totally unexpected!" >&2
 	# The NODE_NAME variable does not contain a dot, so it is not a FQDN.
 	# Fixup the value, hoping to get it right.
 	# XXX really this should not happen, how this came to be is unknown.


=====================================
bin/start-agent.sh
=====================================
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/bin/sh -eu
 
 # agent.jar has to be downloaded from http://localhost/jnlpJars/agent.jar
 
-# 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}")"
+if [ -z "${NODE_NAME:-}" ]; then
+    echo "NODE_NAME is not set!  Exiting…" >&2
+    exit 1
+fi
 
 echo "Starting agent.jar for ${NODE_NAME}..."
 
@@ -18,5 +19,6 @@ fi
 
 echo "This jenkins agent.jar will run as PID $$."
 JAVA_ARGS="-Xms1G -Xmx2G"
+set -x
 # 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/19d5883fe8179d022fb47a5fdc7535be42ef7c32...2828b20f2d24e702b446134c6fcece5a8db6915c

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/19d5883fe8179d022fb47a5fdc7535be42ef7c32...2828b20f2d24e702b446134c6fcece5a8db6915c
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/20211022/a0348f99/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list