[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] update_jdn: do not reuse the same TMPFILE filename while deleting it in-between

Mattia Rizzolo gitlab at salsa.debian.org
Sat May 19 15:53:37 BST 2018


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


Commits:
a5979cd5 by Mattia Rizzolo at 2018-05-19T16:52:47+02:00
update_jdn: do not reuse the same TMPFILE filename while deleting it in-between

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
@@ -29,7 +29,6 @@ BASEDIR="$(dirname "$(readlink -e $0)")"
 PVNAME=/dev/vdb      # LVM physical volume for jobs
 VGNAME=jenkins01     # LVM volume group
 STAMP=/var/log/jenkins/update-jenkins.stamp
-TMPFILE=$(mktemp)
 # The $@ below means that command line args get passed on to j-j-b
 # which allows one to specify --flush-cache or --ignore-cache
 JJB="jenkins-jobs $@"
@@ -644,6 +643,7 @@ explain "scripts and configurations for jenkins updated."
 
 if [ "$HOSTNAME" = "jenkins" ] ; then
 	sudo cp -pr README INSTALL TODO CONTRIBUTING d-i-preseed-cfgs /var/lib/jenkins/userContent/
+	TMPFILE=$(mktemp)
 	git log | grep ^Author| cut -d " " -f2-|sort -u -f > $TMPFILE
 	echo "----" >> $TMPFILE
 	sudo tee /var/lib/jenkins/userContent/THANKS > /dev/null < THANKS.head
@@ -677,11 +677,11 @@ if [ "$HOSTNAME" = "jenkins" ] || [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
 	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"
 			sudo -u jenkins-adm mv "$TMPFILE" "${metaconfig%.py}"
 		fi
 	done
-	rm -f $TMPFILE
 	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
@@ -776,12 +776,14 @@ fi
 #	echo FIXME is ignored so check-jobs scripts can output templates requiring manual work
 #
 if [ "$HOSTNAME" = "jenkins" ] || [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
+	TMPFILE=$(mktemp)
 	rgrep FI[X]ME $BASEDIR/* | grep -v echo > $TMPFILE || true
 	if [ -s $TMPFILE ] ; then
 		echo
 		cat $TMPFILE
 		echo
 	fi
+	rm -f $TMPFILE
 fi
 
 #
@@ -789,7 +791,6 @@ fi
 #
 sudo touch $STAMP	# so on the next run, only configs newer than this file will be updated
 explain "$(date) - finished deployment."
-rm -f $TMPFILE
 
 # finally!
 case $HOSTNAME in



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

---
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/a5979cd550dfbd8dae9184bd85825c0eeab4244a
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/41263d97/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list