[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible: don't be so trigger-happy in deleting schroot internal stuff, ...
Mattia Rizzolo (@mattia)
gitlab at salsa.debian.org
Tue Oct 5 12:10:41 BST 2021
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
ab993ac3 by Mattia Rizzolo at 2021-10-05T13:09:51+02:00
reproducible: don't be so trigger-happy in deleting schroot internal stuff, call to schroot -e to terminate the schroots instead
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
2 changed files:
- bin/reproducible_maintenance.sh
- logparse/reproducible.rules
Changes:
=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -405,34 +405,51 @@ fi
# remove too old schroot session data from diffoscope
if [ "$HOSTNAME" = "$MAINNODE" ] ; then
echo "$(date -u) - Removing diffoscope schroot session data older than 2 days."
- for path in session union/underlay union/overlay ; do
- dir=/var/lib/schroot/$path/
- if [ "$path" = "session" ] ; then
- FILETYPE=f
- RM=rm
- else
- FILETYPE=d
- RM=rmdir
- fi
- OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec ls -lad {} \; || true)
- if [ ! -z "$OLDSTUFF" ]; then
- echo
- echo "data in $dir older than 2 days found, which will be deleted:"
- echo "$OLDSTUFF" | sed "s#$dir#./#g"
-
- echo
- find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec sudo $RM -v {} \; || true
- OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec ls -lad {} \; || true)
- if [ ! -z "$OLDSTUFF" ]; then
- echo
- echo "Warning: Tried, but failed to delete these in $dir:"
- echo "$OLDSTUFF" | sed "s#$dir#./#g"
- echo "Manual cleanup needed."
- fi
- echo
+ mapfile -t OLDSTUFF < <(find /var/lib/schroot/session -name "jenkins-reproducible-*-diffoscope-*" -type f -mtime +1 -exec ls -lad {} \;)
+ if [ "${#OLDSTUFF[@]}" -ne 0 ]; then
+ echo
+ echo "Found old schroot (from diffoscope) sessions, which will be terminated now:"
+ echo "${OLDSTUFF[@]}"
+ echo
+ for session_path in "${OLDSTUFF[@]}"; do
+ # don't use `basename` because session_path contains the whole output from ls -l, not just the path
+ session=${session_path##*/}
+ if ! schroot --end-session -c "$session" ; then
+ echo "Warning: failed to end schroot session: $session"
DIRTY=true
- fi
- done
+ fi
+ done
+ fi
+ # TODO: rewrite the below to not mess with schroot internals so happily.
+ # (i.e., it should verify first )hat those files aren't referenced in sessions files first of all)
+ #for path in session union/underlay union/overlay ; do
+ # dir=/var/lib/schroot/$path/
+ # if [ "$path" = "session" ] ; then
+ # FILETYPE=f
+ # RM=rm
+ # else
+ # FILETYPE=d
+ # RM=rmdir
+ # fi
+ # OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec ls -lad {} \; || true)
+ # if [ ! -z "$OLDSTUFF" ]; then
+ # echo
+ # echo "data in $dir older than 2 days found, which will be deleted:"
+ # echo "$OLDSTUFF" | sed "s#$dir#./#g"
+
+ # echo
+ # find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec sudo $RM -v {} \; || true
+ # OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type $FILETYPE -mtime +1 -exec ls -lad {} \; || true)
+ # if [ ! -z "$OLDSTUFF" ]; then
+ # echo
+ # echo "Warning: Tried, but failed to delete these in $dir:"
+ # echo "$OLDSTUFF" | sed "s#$dir#./#g"
+ # echo "Manual cleanup needed."
+ # fi
+ # echo
+ # DIRTY=true
+ # fi
+ #done
fi
# cleanup old schroots
=====================================
logparse/reproducible.rules
=====================================
@@ -5,6 +5,7 @@ warning /Warning: .+ is not a source package, or was removed or renamed. Please
warning /Warning: Download of .+ sources failed./
warning /Warning: .+ contains invalid yaml, please fix./
warning /Warning: lock .+ still exists, exiting./
+warning /^Warning: failed to end schroot session:/
warning /Warning: Tried, but failed to delete these/
warning /Warning: processes found which should not be there/
warning /Warning: found reproducible_build.sh processes which have pid 1 as parent.+/
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/ab993ac3eb79701b5ea1289edb5b93378beeebdf
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/ab993ac3eb79701b5ea1289edb5b93378beeebdf
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/20211005/76d872eb/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list