summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Hands <phil@hands.com>2016-06-02 17:23:50 +0200
committerPhilip Hands <phil@hands.com>2016-06-03 00:02:26 +0200
commit5e6bee5e9acfea7242298f4cb5e7e6a5a49a423c (patch)
treed6295a705495b57b213a4ffa761ec1bcbe6b35cc
parent3d2cbb8c58953a39237f9af2c854e75edd61c32d (diff)
downloadjenkins.debian.net-5e6bee5e9acfea7242298f4cb5e7e6a5a49a423c.tar.xz
lvc: discard only outdated snapshots
-rwxr-xr-xbin/lvc.sh18
-rw-r--r--cucumber/features/step_definitions/snapshots.rb2
-rw-r--r--hosts/jenkins-test-vm/etc/sudoers.d/jenkins2
-rw-r--r--hosts/jenkins/etc/sudoers.d/jenkins2
-rw-r--r--hosts/profitbricks-build10-amd64/etc/sudoers.d/jenkins2
5 files changed, 14 insertions, 12 deletions
diff --git a/bin/lvc.sh b/bin/lvc.sh
index 902ace00..6f801e65 100755
--- a/bin/lvc.sh
+++ b/bin/lvc.sh
@@ -39,10 +39,15 @@ fetch_if_newer() {
fi
}
-discard_snapshots() {
- domain=$1
- for snap in $(sudo /usr/bin/virsh snapshot-list $domain --name) ; do
+discard_stale_snapshots() {
+ domain=$1
+ netboot=$2
+
+ sudo /usr/bin/virsh -q snapshot-list $domain | \
+ while read snap date time tz state ; do
+ if [ "$(find /srv/jenkins/cucumber /srv/jenkins/bin/lvc.sh $netboot -newermt "$date $time $tz" -print -quit)" ] ; then
sudo /usr/bin/virsh snapshot-delete $domain $snap
+ fi
done
}
@@ -59,10 +64,7 @@ mkdir -p $RESULTS
mkdir -p $WORKSPACE/DebianToasterStorage
-# FIXME this should discover the 'target' bit of the path, probably via: virsh vol-list
-if [ ! -e "$WORKSPACE/DebianToasterStorage/target" ] ; then
- discard_snapshots DebianToaster
-fi
+discard_stale_snapshots DebianToaster $NETBOOT
trap cleanup_all INT TERM EXIT
@@ -117,7 +119,7 @@ fi
echo "Debug log available at runtime at https://jenkins.debian.net/view/lvc/job/$JOB_NAME/ws/results/debug.log"
-/srv/jenkins/cucumber/bin/run_test_suite --capture-all --vnc-server-only --iso $IMAGE --tmpdir $PWD --old-iso $IMAGE -- --format pretty /srv/jenkins/cucumber/features/step_definitions /srv/jenkins/cucumber/features/support "${@}"
+/srv/jenkins/cucumber/bin/run_test_suite --capture-all --keep-snapshots --vnc-server-only --iso $IMAGE --tmpdir $PWD --old-iso $IMAGE -- --format pretty /srv/jenkins/cucumber/features/step_definitions /srv/jenkins/cucumber/features/support "${@}"
cleanup_all
diff --git a/cucumber/features/step_definitions/snapshots.rb b/cucumber/features/step_definitions/snapshots.rb
index 0f4b49a8..bbd66d1a 100644
--- a/cucumber/features/step_definitions/snapshots.rb
+++ b/cucumber/features/step_definitions/snapshots.rb
@@ -26,7 +26,7 @@ def checkpoints
['minimal', 'non-GUI', 'Gnome', 'XFCE', 'LXDE', 'KDE'].each do |de|
cp["debian-#{m}-#{de}-install"] = {
- :temporary => 'XFCE' != de,
+ #:temporary => 'XFCE' != de,
:description => "I install a #{de} Debian system, in #{m} mode",
:parent_checkpoint => "boot-d-i-#{m}-to-tasksel",
:steps => [
diff --git a/hosts/jenkins-test-vm/etc/sudoers.d/jenkins b/hosts/jenkins-test-vm/etc/sudoers.d/jenkins
index 1f457531..901bcf41 100644
--- a/hosts/jenkins-test-vm/etc/sudoers.d/jenkins
+++ b/hosts/jenkins-test-vm/etc/sudoers.d/jenkins
@@ -28,7 +28,7 @@ jenkins ALL= \
/usr/bin/qemu-system-x86_64 *, \
/usr/bin/qemu-img *, \
/sbin/lvcreate *, /sbin/lvremove *, \
- /usr/bin/virsh snapshot-list *, /usr/bin/virsh snapshot-delete *, \
+ /usr/bin/virsh -q snapshot-list *, /usr/bin/virsh snapshot-delete *, \
/bin/mkdir -p /media/*, \
/usr/bin/guestmount *, \
/bin/cp -rv /media/*, \
diff --git a/hosts/jenkins/etc/sudoers.d/jenkins b/hosts/jenkins/etc/sudoers.d/jenkins
index 1f457531..901bcf41 100644
--- a/hosts/jenkins/etc/sudoers.d/jenkins
+++ b/hosts/jenkins/etc/sudoers.d/jenkins
@@ -28,7 +28,7 @@ jenkins ALL= \
/usr/bin/qemu-system-x86_64 *, \
/usr/bin/qemu-img *, \
/sbin/lvcreate *, /sbin/lvremove *, \
- /usr/bin/virsh snapshot-list *, /usr/bin/virsh snapshot-delete *, \
+ /usr/bin/virsh -q snapshot-list *, /usr/bin/virsh snapshot-delete *, \
/bin/mkdir -p /media/*, \
/usr/bin/guestmount *, \
/bin/cp -rv /media/*, \
diff --git a/hosts/profitbricks-build10-amd64/etc/sudoers.d/jenkins b/hosts/profitbricks-build10-amd64/etc/sudoers.d/jenkins
index 1f457531..901bcf41 100644
--- a/hosts/profitbricks-build10-amd64/etc/sudoers.d/jenkins
+++ b/hosts/profitbricks-build10-amd64/etc/sudoers.d/jenkins
@@ -28,7 +28,7 @@ jenkins ALL= \
/usr/bin/qemu-system-x86_64 *, \
/usr/bin/qemu-img *, \
/sbin/lvcreate *, /sbin/lvremove *, \
- /usr/bin/virsh snapshot-list *, /usr/bin/virsh snapshot-delete *, \
+ /usr/bin/virsh -q snapshot-list *, /usr/bin/virsh snapshot-delete *, \
/bin/mkdir -p /media/*, \
/usr/bin/guestmount *, \
/bin/cp -rv /media/*, \