[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] Partially revert "update_jdn: simpler checks for up2date jenkins confs"

Mattia Rizzolo gitlab at salsa.debian.org
Sat May 19 16:21:35 BST 2018


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


Commits:
3a4cc153 by Mattia Rizzolo at 2018-05-19T17:20:12+02:00
Partially revert "update_jdn: simpler checks for up2date jenkins confs"

So there are some gotcha that I couldn't get before

This reverts commit 8647d21a68e920f0cf298ea7d012b6793316ab65.

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

- - - - -


1 changed file:

- update_jdn.sh


Changes:

=====================================
update_jdn.sh
=====================================
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -674,16 +674,20 @@ if [ "$HOSTNAME" = "jenkins" ] || [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
 	#
 	cd /srv/jenkins/job-cfg
 	for metaconfig in *.yaml.py ; do
-		# regen the file only if the .py is newer than the generated file
-		if [ ! -f "${metaconfig%.py}" ] || [ "$metaconfig" -nt "${metaconfig%.py}" ]; then
-			TMPFILE=$(sudo -u jenkins-adm mktemp)
-			sudo -u jenkins-adm "./$metaconfig" > "$TMPFILE"
+		TMPFILE=$(sudo -u jenkins-adm mktemp)
+		sudo -u jenkins-adm tee "$TMPFILE" >/dev/null < ./$metaconfig
+		if ! sudo -u jenkins-adm cmp -s ${metaconfig%.py} "$TMPFILE" ; then
 			sudo -u jenkins-adm mv "$TMPFILE" "${metaconfig%.py}"
 		fi
 	done
 	for config in *.yaml ; do
-		# do update, if no stamp file exist or config is newer than stamp
-		if [ ! -f $STAMP ] || [ $config -nt $STAMP ] ; then
+		# do update, if
+		# no stamp file exist or
+		# no .py file exists and config is newer than stamp or
+		# a .py file exists and .py file is newer than stamp
+		if [ ! -f $STAMP ] || \
+		 ( [ ! -f $config.py ] && [ $config -nt $STAMP ] ) || \
+		 ( [ -f $config.py ] && [ $config.py -nt $STAMP ] ) ; then
 			echo "$config has changed, executing updates."
 			$JJB update $config
 		fi



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/3a4cc153a885be46e7615c85250fd1e176c564ef

---
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/3a4cc153a885be46e7615c85250fd1e176c564ef
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/20180519/d34e6aae/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list