[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible_debian_live_build: Publish the files directly.

Holger Levsen (@holger) gitlab at salsa.debian.org
Thu Jun 2 14:58:39 BST 2022



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


Commits:
62df66d4 by Roland Clobus at 2022-06-02T15:58:29+02:00
reproducible_debian_live_build: Publish the files directly.

The artifacts that need to be published on the web server are published
directly in the job, instead of using
reproducible_html_rsync_remote_results.

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

- - - - -


3 changed files:

- bin/reproducible_debian_live_build.sh
- bin/reproducible_debian_live_sync_result.sh
- job-cfg/reproducible.yaml


Changes:

=====================================
bin/reproducible_debian_live_build.sh
=====================================
@@ -27,28 +27,30 @@ output_echo() {
 	fi
 }
 
+# Copy a single file to the web server
+#
+# Argument 1 = description (one word)
+# Argument 2 = absolute path of a file that will be published on the web server
+# Argument 3 = filename for the published file
+publish_file() {
+	local DESCRIPTION=$1
+	local ORIGINAL_FILE=$2
+	local PUBLISHED_NAME=$(basename $3)
+
+	ssh jenkins at jenkins.debian.net ${DESCRIPTION} ${ORIGINAL_FILE} ${PUBLISHED_NAME}
+}
+
 cleanup() {
+	local RESULT=$1
 	output_echo "Publishing results."
 
-	if [ "$1" == "success" ]; then
-		# Publish the ISO image and its summary
-		export PAGE=last-reproducible-image.txt
-		cp -a ${RESULTSDIR}/summary_build1.txt ${PAGE}
-		publish_page debian_live_build
-
-		export PAGE=last-reproducible-image.iso
-		cp -a ${RESULTSDIR}/b1/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso ${PAGE}
-		publish_page debian_live_build
-
-		export PAGE=${CONFIGURATION}-${DEBIAN_VERSION}.txt
-		mv ${RESULTSDIR}/summary_build1.txt ${PAGE}
-		rm ${RESULTSDIR}/summary_build2.txt
+	if [ "${RESULT}" == "success" ]; then
 		output_echo "Info: no differences found."
 
-		# Upload the ISO file to the web server
-		ISONAME=${SNAPSHOT_TIMESTAMP}_${DEBIAN_VERSION}_${CONFIGURATION}.iso
-		mv ${RESULTSDIR}/b1/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso ${ISONAME}
-		ssh jenkins at jenkins.debian.net ISOname ${PWD}/${ISONAME}
+		# Upload the ISO file and its summary to the web server
+		ISONAME=${CONFIGURATION}-${DEBIAN_VERSION}.iso
+		publish_file ISOfile ${RESULTSDIR}/b1/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso ${ISONAME}
+		publish_file Summary ${RESULTSDIR}/summary_build1.txt ${CONFIGURATION}-${DEBIAN_VERSION}.txt
 
 		# Invoke openQA
 		DESKTOP=${CONFIGURATION}
@@ -57,31 +59,20 @@ cleanup() {
 		elif [ ${DESKTOP} == "standard" ]; then
 			DESKTOP="text"
 		fi
-		CHECKSUM=$(grep "Checksum:" ${PAGE} | cut -f 2 -d " ")
-		#openqa-cli api -X POST isos ISO=${ISONAME} DISTRI=debian VERSION=${DEBIAN_VERSION}_${CONFIGURATION} FLAVOR=live-build ARCH=x86_64 BUILD=:${CONFIGURATION}_${DEBIAN_VERSION}_${SNAPSHOT_TIMESTAMP} DESKTOP=${DESKTOP} CHECKSUM=${CHECKSUM} TIMESTAMP=${SNAPSHOT_TIMESTAMP} ISO_URL=https://tests.reproducible-builds.org/debian_live_build/${ISONAME} --odn --apikey ${OPENQA_APIKEY} --apisecret ${OPENQA_APISECRET}
+		CHECKSUM=$(grep "Checksum:" ${RESULTSDIR}/summary_build1.txt | cut -f 2 -d " ")
+		#openqa-cli api -X POST isos ISO=${SNAPSHOT_TIMESTAMP}_${DEBIAN_VERSION}_${CONFIGURATION}.iso DISTRI=debian VERSION=${DEBIAN_VERSION}_${CONFIGURATION} FLAVOR=live-build ARCH=x86_64 BUILD=:${CONFIGURATION}_${DEBIAN_VERSION}_${SNAPSHOT_TIMESTAMP} DESKTOP=${DESKTOP} CHECKSUM=${CHECKSUM} TIMESTAMP=${SNAPSHOT_TIMESTAMP} ISO_URL=https://tests.reproducible-builds.org/debian_live_build/${ISONAME} --odn --apikey ${OPENQA_APIKEY} --apisecret ${OPENQA_APISECRET}
 	else
 		if [ -f "${RESULTSDIR}/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso.html" ]; then
 			# Publish the output of diffoscope, there are differences
-			export PAGE=${CONFIGURATION}-${DEBIAN_VERSION}.html
-			cp -a ${RESULTSDIR}/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso.html ${PAGE}
-			output_echo "Warning: diffoscope detected differences in the images."
+			publish_file DiffoscopeOutput ${RESULTSDIR}/${PROJECTNAME}/${CONFIGURATION}/live-image-amd64.hybrid.iso.html ${CONFIGURATION}-${DEBIAN_VERSION}.html
 		else
-			export PAGE=${CONFIGURATION}-${DEBIAN_VERSION}.txt
-			printenv >${PAGE}
 			output_echo "Error: Something went wrong."
-		fi
-		if [ ! -z "${RESULTSDIR}" ]; then
-			# Do not publish the ISO images as artifact, they would be able to consume too much disk space
-			rm -rf ${RESULTSDIR}/b1
-			rm -rf ${RESULTSDIR}/b2
-
-			TMPDIR=${RESULTSDIR}
-			save_artifacts debian_live_build ${CONFIGURATION}-${DEBIAN_VERSION} https://wiki.debian.org/ReproducibleInstalls/LiveImages
+			printenv > environment.txt
+			publish_file Environment ${PWD}/environment.txt ${CONFIGURATION}-${DEBIAN_VERSION}.txt
 		fi
 	fi
-	publish_page debian_live_build
 
-	output_echo Cleanup $1
+	output_echo Cleanup ${RESULT}
 	# Cleanup the workspace
 	if [ ! -z "${BUILDDIR}" ]; then
 		sudo rm -rf --one-file-system ${BUILDDIR}
@@ -120,9 +111,6 @@ fi
 # Randomize start time
 delay_start
 
-# Cleanup possible artifacts of a previous build (see reproducible_common.sh for the path)
-rm -rf $BASE/debian_live_build/artifacts/r00t-me/${CONFIGURATION}-${DEBIAN_VERSION}_tmp-*
-
 # Generate and use an isolated workspace
 export PROJECTNAME="live-build"
 mkdir -p /srv/workspace/live-build


=====================================
bin/reproducible_debian_live_sync_result.sh
=====================================
@@ -15,30 +15,34 @@ set -u
 PROJECT=debian_live_build
 NODE=osuosl173-amd64.debian.net
 
+# Argument 1 = absolute path on $NODE
+# Argument 2 = published name
 rsync_remote_results() {
     local origfile=$1
-    echo "$(date -u) - Starting to sync the remote file"
-    # copy the new results from build node to webserver node
+    local filename=$(basename "$2")
+    echo "$(date -u) - Starting to sync the remote file '$filename'."
+    # copy the new results from build node to web server node
     cd "$BASE"/"$PROJECT"
-    filename=$(basename "$origfile")
-    scp -o Batchmode=yes "$NODE":"$origfile" "$filename.tmp"
+    # Preserve timestamp
+    scp -p -o Batchmode=yes "$NODE":"$origfile" "$filename.tmp"
     chmod 755 "$filename.tmp"
     mv "$filename.tmp" "$filename"
 }
 
+# Argument 1 = filename part of the published name that was synced with 'rsync_remote_results'
 delete_live_build_file() {
     local filetodelete=$1
-    echo "$(date -u) - Starting to delete the requested file $filetodelete"
+    local filename=$(basename "$filetodelete")
+    echo "$(date -u) - Starting to delete the requested file '$filename'."
     cd "$BASE"/"$PROJECT"
-    filename=$(basename "$filetodelete")
-    if [[ "$filename" != "$origfile" ]]; then
-        echo "You provided a full path, ignoring for safety" >&2
+    if [[ "$filename" != "$filetodelete" ]]; then
+        echo "E: You provided a full path, ignoring for safety" >&2
         exit 1
     fi
     if [ -f "$filename" ]; then
-        rm -v "$filename"
+        rm -vf "$filename"
     else
-        echo "File not found" >&2
+        echo "E: File not found" >&2
         exit 1
     fi
 }


=====================================
job-cfg/reproducible.yaml
=====================================
@@ -256,9 +256,6 @@
     publishers:
       - logparser: *logparser
       - email: *email
-      - trigger:
-          project: '{my_trigger}'
-          threshold: UNSTABLE
 
 - job-template:
     defaults: reproducible
@@ -1025,5 +1022,4 @@
             my_description: 'Build Debian {imagetype} live image for {debian_version} using live-build'
             my_hname: 'osuosl173'
             my_shell: '/srv/jenkins/bin/jenkins_master_wrapper.sh {imagetype} {debian_version}'
-            my_trigger: 'reproducible_html_rsync_remote_results'
 



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

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/62df66d434ea7924c6e98bed69900e9a4873cab4
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/20220602/68dc3c31/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list