[Qa-jenkins-scm] [jenkins.debian.net] 03/04: schroot-create: revert back to directory-based schroot for reproducible stuff
Mattia Rizzolo
mattia at debian.org
Thu Apr 5 12:50:41 UTC 2018
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository jenkins.debian.net.
commit 6ef480393d14863a2f4b9c53144c516606995b73
Author: Mattia Rizzolo <mattia at debian.org>
Date: Thu Apr 5 14:40:57 2018 +0200
schroot-create: revert back to directory-based schroot for reproducible stuff
file-based schroots don't do union mounts, and turns out we would end up
with too many unpacked chroots filling our disk.
This is actually a issue only for diffoscope, but we plan on moving away
from schroot for the other jobs soon.
To still mitigate the concurrency issues on upgrade that we used to
have, save the chroot in a different location each time, and just clean
up old ones in the maintenance jobs.
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
bin/schroot-create.sh | 35 +++++++++++++++++++++++++++--------
hosts/jenkins/etc/sudoers.d/jenkins | 1 +
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh
index cadba2a..3c6d729 100755
--- a/bin/schroot-create.sh
+++ b/bin/schroot-create.sh
@@ -193,12 +193,21 @@ bootstrap $@
trap - INT TERM EXIT
# pivot the new schroot in place
-cd "$SCHROOT_TARGET"
-rand="$RANDOM"
-echo "$(date -u) - tarballing the chroot…"
-sudo tar -c --exclude ./sys/* --exclude ./proc/* -f "$SCHROOT_BASE/$TARGET-$rand.tar" ./*
-echo "$(date -u) - moving the chroot in place…"
-sudo mv "$SCHROOT_BASE/$TARGET-$rand.tar" "$SCHROOT_BASE/$TARGET.tar"
+rand="$(date -u +%Y%m%d)-$RANDOM"
+if $REPRODUCIBLE ; then
+ # for diffoscope we really need a directory schroot, as otherwise we end up
+ # with too many unpacked chroots
+ # Let's just keep changing the trailing number and trust the maintenance job
+ # to clean up old chroots.
+ echo "$(date -u) This chroot will be placed in $SCHROOT_BASE/$TARGET-$rand"
+ sudo mv "$SCHROOT_TARGET" "$SCHROOT_BASE/$TARGET-$rand"
+else
+ cd "$SCHROOT_TARGET"
+ echo "$(date -u) - tarballing the chroot…"
+ sudo tar -c --exclude ./sys/* --exclude ./proc/* -f "$SCHROOT_BASE/$TARGET-$rand.tar" ./*
+ echo "$(date -u) - moving the chroot in place…"
+ sudo mv "$SCHROOT_BASE/$TARGET-$rand.tar" "$SCHROOT_BASE/$TARGET.tar"
+fi
# write the schroot config
@@ -206,10 +215,20 @@ echo "$(date -u) - writing schroot configuration"
sudo tee /etc/schroot/chroot.d/jenkins-"$TARGET" <<-__END__
[jenkins-$TARGET]
description=Jenkins schroot $TARGET
- file=$SCHROOT_BASE/$TARGET.tar
- type=file
root-users=jenkins
source-root-users=jenkins
+__END__
+if $REPRODUCIBLE ; then
+ sudo tee -a /etc/schroot/chroot.d/jenkins-"$TARGET" <<-__END__
+ file=$SCHROOT_BASE/$TARGET-$rand
+ type=directory
+ union-type=overlay
+ __END__
+else
+ sudo tee -a /etc/schroot/chroot.d/jenkins-"$TARGET" <<-__END__
+ file=$SCHROOT_BASE/$TARGET.tar
+ type=file
__END__
+fi
echo "schroot $TARGET set up successfully in $SCHROOT_BASE/$TARGET.tar - exiting now."
diff --git a/hosts/jenkins/etc/sudoers.d/jenkins b/hosts/jenkins/etc/sudoers.d/jenkins
index 21c3345..2c04b0b 100644
--- a/hosts/jenkins/etc/sudoers.d/jenkins
+++ b/hosts/jenkins/etc/sudoers.d/jenkins
@@ -3,6 +3,7 @@ jenkins ALL= \
/usr/bin/tee /schroots/*, \
/usr/bin/tee -a /schroots/*, \
/usr/bin/tee /etc/schroot/chroot.d/jenkins*, \
+ /usr/bin/tee -a /etc/schroot/chroot.d/jenkins*, \
/bin/chmod +x /schroots/*, \
/bin/chmod +x /chroots/*, \
/bin/tar -c --exclude ./sys/\* --exclude ./proc/\* -f /schroots/*, \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list