summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2014-09-28 11:27:06 +0200
committerHelmut Grohne <helmut@subdivi.de>2014-09-28 11:27:06 +0200
commit23d28b7cbbea7121d063d5a39bae90fe02eb9f71 (patch)
tree67582b9e9fc26e77ef198025996ffa4d06071cfe
parent7a6eee49d49db578d68629c75db43b78fc0381c1 (diff)
downloadjenkins.debian.net-23d28b7cbbea7121d063d5a39bae90fe02eb9f71.tar.xz
move chroot and pbuilder builds to tmpfs
For this change update_jdn.sh will only work well, if jenkins is not running. It avoids breaking running builds at the cost of potentially not applying configuration. The changes are: * /srv/workspace becomes a tmpfs mounted location * /etc/init.d/jenkins-workspace creates subdirectories on that tmpfs * Old locations for chroots and pbuilder are moved using symlinks.
-rwxr-xr-xetc/init.d/jenkins-workspace22
-rwxr-xr-xupdate_jdn.sh35
2 files changed, 56 insertions, 1 deletions
diff --git a/etc/init.d/jenkins-workspace b/etc/init.d/jenkins-workspace
new file mode 100755
index 00000000..128d828c
--- /dev/null
+++ b/etc/init.d/jenkins-workspace
@@ -0,0 +1,22 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: jenkins-workspace
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# X-Start-Before: jenkins
+# Short-Description: Create jenkins workspace directory structure
+### END INIT INFO
+
+WORKSPACE=/srv/workspace
+
+case "$1" in
+ start)
+ echo "Creating jenkins workspace"
+ mkdir "$WORKSPACE/chroots"
+ chown jenkins:jenkins "$WORKSPACE/chroots"
+ mkdir "$WORKSPACE/pbuilder"
+ echo done
+ ;;
+esac
diff --git a/update_jdn.sh b/update_jdn.sh
index 99438d44..f256c15a 100755
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -13,14 +13,46 @@ explain() {
echo
}
+mkdir -p /srv/workspace
+
+if ! grep -q '^tmpfs\s\+/srv/workspace\s'; then
+ echo "tmpfs /srv/workspace tmpfs defaults,size=60g 0 0" >> /etc/fstab
+fi
+
+if ! mountpoint -q /srv/workspace; then
+ if test -z "$(ls -A /srv/workspace)"; then
+ mount /srv/workspace
+ else
+ echo "mountpoint /srv/workspace is non-empty"
+ fi
+fi
+
# make sure needed directories exists
-for directory in /srv/jenkins /chroots /schroots; do
+for directory in /srv/jenkins /schroots; do
if [ ! -d $directory ] ; then
sudo mkdir $directory
sudo chown jenkins.jenkins $directory
fi
done
+if ! test -h /chroots; then
+ rmdir /chroots || rm -f /chroots # do not recurse
+ if test -e /chroots; then
+ echo could not clear /chroots
+ else
+ ln -s /srv/workspace/chroots /chroots
+ fi
+fi
+
+if ! test -h /var/cache/pbuilder/build; then
+ rmdir /var/cache/pbuilder/build || rm -f /var/cache/pbuilder/build
+ if test -e /var/cache/pbuilder/build; then
+ echo could not clear /var/cache/pbuilder/build
+ else
+ ln -s /srv/workspace/pbuilder /var/cache/pbuilder/build
+ fi
+fi
+
#
# install packages we need
# (more or less grouped into more-then-nice-to-have, needed-while-things-are-new, needed)
@@ -42,6 +74,7 @@ sudo apt-get build-dep installation-guide
#
cd $BASEDIR
sudo cp -r etc/* /etc
+update-rc.d jenkins-workspace defaults
#
# more configuration than a simple cp can do