[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible Debian live: improve cleanup of remote files on jenkins

Holger Levsen (@holger) gitlab at salsa.debian.org
Fri Sep 16 22:40:15 BST 2022



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
4b58ab1a by Holger Levsen at 2022-09-16T23:40:03+02:00
reproducible Debian live: improve cleanup of remote files on jenkins

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


2 changed files:

- bin/reproducible_debian_live_build.sh
- bin/reproducible_debian_live_sync_result.sh


Changes:

=====================================
bin/reproducible_debian_live_build.sh
=====================================
@@ -19,8 +19,11 @@ set -o pipefail # see eg http://petereisentraut.blogspot.com/2010/11/pipefail.ht
 # always cleanup
 cleanup() {
 	local RESULT=$1
-	publish_results $RESULT
 	output_echo "Cleanup ${RESULT}"
+
+	# publish results
+	publish_results $RESULT
+
 	# Cleanup the workspace
 	if [ ! -z "${BUILDDIR}" ]; then
 		sudo rm -rf --one-file-system ${BUILDDIR}
@@ -47,15 +50,20 @@ publish_file() {
 	ssh jenkins at jenkins.debian.net "${ACTION}" "${DESCRIPTION}" "${ORIGINAL_FILE}" "${PUBLISHED_NAME}"
 }
 
-publish_results() {
-	local RESULT=$1
-	output_echo "Publishing results: ${RESULT}"
-
+prepare_publishing() {
 	# Remotely remove previously published files if they don't exist locally
 	[ ! -f ${DESKTOP}-${SUITE}.iso ] || publish_file delete ISOfile ${DESKTOP}-${SUITE}.iso
 	[ ! -f ${DESKTOP}-${SUITE}-summary.txt ] || publish_file delete Summary ${DESKTOP}-${SUITE}-summary.txt
 	[ ! -f ${DESKTOP}-${SUITE}.html ] || publish_file delete DiffoscopeOutput ${DESKTOP}-${SUITE}.html
 	[ ! -f ${DESKTOP}-${SUITE}-env.txt ] || publish_file delete Environment ${DESKTOP}-${SUITE}-env.txt
+}
+
+publish_results() {
+	local RESULT=$1
+	output_echo "Publishing results: ${RESULT}"
+
+	# remote cleanup files if they don't exist locally
+	prepare_publishing
 
 	if [ "${RESULT}" == "success" ]; then
 		output_echo "Info: no differences found."
@@ -236,7 +244,7 @@ mv summary.txt ${RESULTSDIR}/summary_build2.txt
 output_echo "Running lb clean after the 2nd build."
 sudo lb clean --purge
 
-# The workspace is no longer required
+# We are done
 cd ..
 
 if [ $(cat ${RESULTSDIR}/summary_build1.txt ${RESULTSDIR}/summary_build2.txt | grep Checksum: | uniq | wc -l) -ne 1 ]; then


=====================================
bin/reproducible_debian_live_sync_result.sh
=====================================
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # Copyright 2022 Mattia Rizzolo <mattia at debian.org>
+# Copyright 2022 Holger Levsen <holger at layer-acht.org>
 # released under the GPLv2
 
 DEBUG=false
@@ -47,6 +48,8 @@ delete_live_build_file() {
     fi
     if [ -f "$filename" ]; then
         rm -vf "$filename"
+	# also delete .tmp file if it exists
+	[ ! -f "$filename.tmp" ] || rm -vf "$filename.tmp"
     else
         echo "E: File not found" >&2
         exit 1



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/4b58ab1a81eff86b9a2dea082c998ab854110e83

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/4b58ab1a81eff86b9a2dea082c998ab854110e83
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/20220916/3a537504/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list