[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible debian: build service exist the whole service when the lockfile...

Mattia Rizzolo gitlab at salsa.debian.org
Thu Jan 28 12:38:43 GMT 2021



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


Commits:
ee2749b6 by Mattia Rizzolo at 2021-01-28T13:34:54+01:00
reproducible debian: build service exist the whole service when the lockfile appears, not just the workers

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

- - - - -
388d7f6e by Mattia Rizzolo at 2021-01-28T13:37:33+01:00
reproducible debian: build service: exit often if the lockfile is present

previously it would exit only at the start of the worker, which is not
that frequent

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

- - - - -


3 changed files:

- bin/reproducible_build_service.sh
- bin/reproducible_worker.sh
- hosts/jenkins/etc/systemd/system/reproducible_build at .service


Changes:

=====================================
bin/reproducible_build_service.sh
=====================================
@@ -232,10 +232,29 @@ startup_workers() {
 	done
 }
 
+
+check_lock() {
+	LOCKFILE="/var/lib/jenkins/NO-RB-BUILDERS-PLEASE"
+	if [ -f "$LOCKFILE" ]; then
+		echo "The lockfile $LOCKFILE is present, exiting the service..."
+		while : ; do
+			children="$(pgre --list-full --parent $$)"
+			if [ -n "$children" ]; then
+				echo "There are still some child processes, waiting for them:"
+				echo "$children"
+				sleep 15m
+			else
+				exit 9
+			fi
+		done
+	fi
+}
+
 #
 # main, keep running forever…
 #
 while true ; do
+	check_lock
 	#
 	# this is all we do
 	#


=====================================
bin/reproducible_worker.sh
=====================================
@@ -31,6 +31,11 @@ notify_log_of_failure() {
 }
 
 main_loop() {
+	LOCKFILE="/var/lib/jenkins/NO-RB-BUILDERS-PLEASE"
+	if [ -f "$LOCKFILE" ]; then
+		echo "The lockfile $LOCKFILE is present, thus stopping this"
+		exit
+	fi
 	SERVICE="reproducible_build at startup.service"
 	# try systemctl twice, but only output and thus log the 2nd attempt…
 	RUNNING=$(systemctl show $SERVICE 2>/dev/null |grep ^SubState|cut -d "=" -f2)
@@ -100,11 +105,6 @@ if [ -z "$RUNNING" ] ; then
 	echo "$(date --utc) - '$0 $1' already running, thus stopping this."
 	exit
 fi
-LOCKFILE="/var/lib/jenkins/NO-RB-BUILDERS-PLEASE"
-if [ -f "$LOCKFILE" ]; then
-	echo "The lockfile $LOCKFILE is present, thus stopping this"
-	exit
-fi
 #
 # main
 #


=====================================
hosts/jenkins/etc/systemd/system/reproducible_build at .service
=====================================
@@ -5,6 +5,8 @@ ConditionPathExists=!/var/lib/jenkins/NO-RB-BUILDERS-PLEASE
 [Service]
 # Restart whenever the script exits, without rate limiting:
 Restart=always
+# special code from _build_service for when NO-RB-BUILDERS-PLEASE exists, to properly quit
+RestartPreventExitStatus=9
 StartLimitInterval=0
 User=jenkins
 Group=jenkins



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/7688d82de3eb75e394e638a6da7b773174806a29...388d7f6e57de30be2ab60986aa7cc59a9988e6d3

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/7688d82de3eb75e394e638a6da7b773174806a29...388d7f6e57de30be2ab60986aa7cc59a9988e6d3
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/20210128/e97f606c/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list