[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] Use and clean an isolated workspace
Holger Levsen (@holger)
gitlab at salsa.debian.org
Sun Jun 20 14:22:10 BST 2021
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
5ce264f5 by Roland Clobus at 2021-06-20T15:21:54+02:00
Use and clean an isolated workspace
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
1 changed file:
- bin/reproducible_debian_live_build.sh
Changes:
=====================================
bin/reproducible_debian_live_build.sh
=====================================
@@ -21,14 +21,38 @@ output_echo() {
echo
}
+cleanup() {
+ # Cleanup the workspace
+ if [ ! -z "${MY_WORKSPACE}" -a -d ${MY_WORKSPACE} ] ; then
+ rm -fr ${MY_WORKSPACE}
+ fi
+ # Cleanup the artifacts
+ if [ ! -z "${PROJECTNAME}" -a ! -z "${TMPDIR}" ] ; then
+ rm -fr $TMPDIR/b1/${PROJECTNAME}
+ rm -fr $TMPDIR/b2/${PROJECTNAME}
+ fi
+}
+
#
# main: follow https://wiki.debian.org/ReproducibleInstalls/LiveImages
#
+# Cleanup if something goes wrong
+trap cleanup INT TERM EXIT
+
+# Generate and use an isolated workspace
+export PROJECTNAME="live-build"
+export MY_WORKSPACE=$(mktemp -d -t ${PROJECTNAME}.XXXXXXXX)
+cd ${MY_WORKSPACE}
+
# Fetch and use the latest version of live build
-export LIVE_BUILD=$(mktemp -d -t live-build.XXXXXXXX)
+export LIVE_BUILD=${MY_WORKSPACE}/latest-live-build
git clone https://salsa.debian.org/live-team/live-build.git ${LIVE_BUILD} --single-branch --no-tags
-export LB_OUTPUT=$(mktemp -t live-build.XXXXXXXX)
+pushd ${LIVE_BUILD}
+output_echo "Received git version $(git log -1 --pretty=oneline)"
+popd
+
+export LB_OUTPUT=${MY_WORKSPACE}/lb_output.txt
# Use 'now' as the basic timestamp
export SOURCE_DATE_EPOCH=$(date +%s)
@@ -200,8 +224,8 @@ if [ "$RESULT" != "0" ] ; then
fi
# Move the image away
-mkdir -p $TMPDIR/b1/live-build
-mv live-image-amd64.hybrid.iso $TMPDIR/b1/live-build
+mkdir -p $TMPDIR/b1/${PROJECTNAME}
+mv live-image-amd64.hybrid.iso $TMPDIR/b1/${PROJECTNAME}
# Clean for the second build
lb clean --purge | tee -a $LB_OUTPUT
@@ -218,8 +242,8 @@ if [ "$RESULT" != "0" ] ; then
fi
# Move the image away
-mkdir -p $TMPDIR/b2/live-build
-mv live-image-amd64.hybrid.iso $TMPDIR/b2/live-build
+mkdir -p $TMPDIR/b2/${PROJECTNAME}
+mv live-image-amd64.hybrid.iso $TMPDIR/b2/${PROJECTNAME}
# Clean up
lb clean --purge | tee -a $LB_OUTPUT
@@ -228,13 +252,14 @@ if [ "$RESULT" != "0" ] ; then
output_echo "Warning: lb config failed with $RESULT"
fi
+# The workspace is no longer required
+cd ..
+
# Compare the images
-call_diffoscope live-build live-image-amd64.hybrid.iso
+call_diffoscope ${PROJECTNAME} live-image-amd64.hybrid.iso
-# Clean up
-rm -fr $TMPDIR/b1/live-build
-rm -fr $TMPDIR/b2/live-build
+cleanup success
+# Turn off the trap
+trap - INT TERM EXIT
-# the end
-rm -f $LIVE_BUILD $LB_OUTPUT
output_echo "the end."
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/5ce264f584356f102c95e91043db95ac176508c3
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/5ce264f584356f102c95e91043db95ac176508c3
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/20210620/e027f263/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list