summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertagaz <bertagaz@ptitcanardnoir.org>2017-05-30 14:42:53 +0200
committerbertagaz <bertagaz@ptitcanardnoir.org>2017-05-30 14:42:53 +0200
commitbda19cc5e1ba5890881835b7fd4c7f9e102ff087 (patch)
tree88310c65669f006375ee8459ac4383c4e89c1ab4
parentc1618855b89ab80590292fa69c11b035d6432e2d (diff)
Add script to cleanup leftovers from previous badly failed or aborted builds.bugfix/12577-cleanup-build-jobs-leftovers
Refs: #12577
-rw-r--r--files/jenkins/slaves/isobuilders/cleanup_build_jobs_leftovers15
-rw-r--r--manifests/jenkins/slave/iso_builder.pp7
2 files changed, 22 insertions, 0 deletions
diff --git a/files/jenkins/slaves/isobuilders/cleanup_build_jobs_leftovers b/files/jenkins/slaves/isobuilders/cleanup_build_jobs_leftovers
new file mode 100644
index 0000000..d8b6d5c
--- /dev/null
+++ b/files/jenkins/slaves/isobuilders/cleanup_build_jobs_leftovers
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+set -u
+set -x
+
+[ "${WORKSPACE}" ] || exit 2
+
+[ -d "${WORKSPACE}" ] || exit 3
+
+for dir in /var/lib/jenkins/workspace/build_Tails_ISO_*; do
+ if [ "${dir}" != "${WORKSPACE}" ]; then
+ rm -rf "${dir}/vagrant/"
+ fi
+done
diff --git a/manifests/jenkins/slave/iso_builder.pp b/manifests/jenkins/slave/iso_builder.pp
index 3d7b1b7..e0b4b18 100644
--- a/manifests/jenkins/slave/iso_builder.pp
+++ b/manifests/jenkins/slave/iso_builder.pp
@@ -48,6 +48,13 @@ class tails::jenkins::slave::iso_builder (
group => 'root',
}
+ file { '/usr/local/bin/cleanup_build_jobs_leftovers':
+ source => 'puppet:///modules/tails/jenkins/slaves/isobuilders/cleanup_build_jobs_leftovers',
+ mode => '0755',
+ owner => 'root',
+ group => 'root',
+ }
+
file { '/usr/local/bin/sign_artifacts':
source => 'puppet:///modules/tails/jenkins/slaves/isobuilders/sign_artifacts',
mode => '0755',