summaryrefslogtreecommitdiff
path: root/vm-data
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-08-26 22:54:49 +0100
committerLars Wirzenius <liw@liw.fi>2012-08-26 22:54:49 +0100
commit3f175a98cb064c262561e44c25c402b341f721d9 (patch)
tree719d54e5b07e71e80c44d10a17cda8e301730930 /vm-data
parent45d664460a4913e3de49e362824e66bfeaad11ea (diff)
downloadjenkinstool-3f175a98cb064c262561e44c25c402b341f721d9.tar.gz
Build worker images as well (sid-amd64 for now)
Diffstat (limited to 'vm-data')
-rw-r--r--vm-data/common.conf1
-rw-r--r--vm-data/jenkins.conf3
-rwxr-xr-xvm-data/jenkins.customize14
-rw-r--r--vm-data/sid-amd64.conf8
-rwxr-xr-xvm-data/worker.customize54
5 files changed, 75 insertions, 5 deletions
diff --git a/vm-data/common.conf b/vm-data/common.conf
index 19536c3..cb977b0 100644
--- a/vm-data/common.conf
+++ b/vm-data/common.conf
@@ -2,6 +2,5 @@
log = vmdebootstrap.log
mirror = http://cdn.debian.net/debian
enable-dhcp = yes
-arch = amd64
size = 10G
verbose = yes
diff --git a/vm-data/jenkins.conf b/vm-data/jenkins.conf
index 7a4fa71..9de2d3f 100644
--- a/vm-data/jenkins.conf
+++ b/vm-data/jenkins.conf
@@ -1,7 +1,8 @@
[config]
distribution = squeeze
hostname = jenkins
+arch = amd64
image = jenkins.img
customize = vm-data/jenkins.customize
-package = bzr, git, ssh, vim, less, rsync, apache2, reprepro
+package = bzr, git, ssh, vim, less, rsync, apache2, reprepro, sudo
diff --git a/vm-data/jenkins.customize b/vm-data/jenkins.customize
index b181303..a372aea 100755
--- a/vm-data/jenkins.customize
+++ b/vm-data/jenkins.customize
@@ -62,9 +62,17 @@ install -m 0600 vm-data/jenkins.host-key "$rootdir/etc/ssh/ssh_host_rsa_key"
install -m 0644 vm-data/jenkins.host-key.pub \
"$rootdir/etc/ssh/ssh_host_rsa_key.pub"
-# Install the worker user key into Jenkins's allowed_keys file.
+# Install the Jenkins user ssh key.
mkdir -m 0700 "$rootdir/var/lib/jenkins/.ssh"
-cp vm-data/worker.user-key.pub "$rootdir/var/lib/jenkins/.ssh/authorized_keys"
-chmod 0600 "$rootdir/var/lib/jenkins/.ssh/authorized_keys"
+install -m 0600 vm-data/jenkins.user-key \
+ "$rootdir/var/lib/jenkins/.ssh/id_rsa"
+install -m 0644 vm-data/jenkins.user-key.pub \
+ "$rootdir/var/lib/jenkins/.ssh/id_rsa.pub"
+
+# Install the worker user key into Jenkins's allowed_keys file.
+install -m 0600 vm-data/worker.user-key.pub \
+ "$rootdir/var/lib/jenkins/.ssh/authorized_keys"
+
+# Make sure the Jenkins .ssh directory, with contents, is all owned by Jenkins.
chroot "$rootdir" chown -R jenkins:jenkins /var/lib/jenkins/.ssh/.
diff --git a/vm-data/sid-amd64.conf b/vm-data/sid-amd64.conf
new file mode 100644
index 0000000..91102d8
--- /dev/null
+++ b/vm-data/sid-amd64.conf
@@ -0,0 +1,8 @@
+[config]
+arch = amd64
+distribution = sid
+hostname = jenkins-sid-amd64
+image = jenkins-sid-amd64.img
+customize = vm-data/worker.customize
+package = build-essential, bzr, git, debhelper, devscripts, ssh, vim, less, rsync, pbuilder, fakeroot, dput
+
diff --git a/vm-data/worker.customize b/vm-data/worker.customize
new file mode 100755
index 0000000..3b130bd
--- /dev/null
+++ b/vm-data/worker.customize
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# vm-data/worker.customize - customize disk image for jenkins worker node
+#
+# Copyright 2012 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -eux
+
+export LC_ALL=C
+
+rootdir="$1"
+
+# Install signing key for the code.liw.fi repository.
+wget -q -O - http://code.liw.fi/apt.asc |
+ chroot "$rootdir" apt-key add -
+
+# Create a user for Jenkins, with home directory, but don't install Jenkins,
+# since we don't need it on the worker.
+chroot "$rootdir" adduser --gecos 'Jenkins' \
+ --disabled-password --home=/var/lib/jenkins jenkins
+chroot "$rootdir" install -d -o jenkins -g jenkins /var/lib/jenkins
+
+# Install ssh host keys.
+install -m 0600 vm-data/worker.host-key "$rootdir/etc/ssh/ssh_host_rsa_key"
+install -m 0644 vm-data/worker.host-key.pub \
+ "$rootdir/etc/ssh/ssh_host_rsa_key.pub"
+
+# Install the worker's user key.
+mkdir -m 0700 "$rootdir/var/lib/jenkins/.ssh"
+install -m 0600 vm-data/worker.user-key \
+ "$rootdir/var/lib/jenkins/.ssh/id_rsa"
+install -m 0644 vm-data/worker.user-key.pub \
+ "$rootdir/var/lib/jenkins/.ssh/id_rsa.pub"
+
+# Install the Jenkins user key into Jenkins's allowed_keys file.
+install -m 0600 vm-data/jenkins.user-key.pub \
+ "$rootdir/var/lib/jenkins/.ssh/authorized_keys"
+
+# Make sure the Jenkins .ssh directory, with contents, is all owned by Jenkins.
+chroot "$rootdir" chown -R jenkins:jenkins /var/lib/jenkins/.ssh/.
+