christian hofstaedtler
Configuring Hudson for grml autobuilds on EC2
Suppose you want to do automated builds of grml using the excellent grml-live framework, and host this in a nice autobuilder, like, Hudson. Also you don't have the necessary disk space, RAM, etc. locally so you want to use Amazon EC2 to host the worker machine.

Install Hudson

The Hudson web interface should now be listening on port 8080. Go there and configure it.

Configure Hudson

By now you should be able to manually add a node on EC2 from 'Mange Hudson' -> 'Manage Nodes' (click "Provision from EC2"). If this works well, you're mostly done.

Setup a build job

Now create a new job for building grml. Job name can be "grml-small amd64 testing" or whatever you actually build :-)
Choose "Build a free-style software project" as the proper option.

Configure your job

From the job dashboard choose your job, and select "Configure".

Check "this build is parameterized" and add two String parameters: For the build, you'll need to add two shell steps, with the following script contents:
Execute shell step #1:
#!/bin/bash
echo "setup system and cleanup"
set +e
set +x
apt-get install -y mksh fai-client fai-server fakeroot squashfs-tools squashfs-lzma-tools bc perl
apt-get install -y grml-live grml-live-addons

cat > /etc/grml/grml-live.local << EOF
GRML_LIVE_SOURCES="
deb http://localhost/apt-cacher/http.us.debian.org/debian squeeze main contrib non-free
deb http://localhost/apt-cacher/deb.grml.org/ grml-stable  main
deb http://localhost/apt-cacher/deb.grml.org/ grml-testing main
"
FAI_DEBOOTSTRAP="squeeze http://localhost/apt-cacher/http.us.debian.org/debian"
#SQUASHFS_OPTIONS="-nolzma"
SUITE="squeeze"
CLASSES="${CLASSES}"
VERSION="${BUILD_ID}"
EOF

grep /grml /proc/mounts | awk '{print $2}' | sort -r | xargs umount
rm -rf /grml

rm -rf work
mkdir -p work

Execute shell step #2:
#!/bin/bash
echo "actual build"
set -x
set -e
mkdir -p /grml
mount -t tmpfs -o suid,dev none /grml
cd /grml
set +e
grml-live -g ${FLAVOUR} -F
RC=$?
set -e
cd -
mv /grml/grml-live/grml_isos/* work/
umount /grml
exit $RC


For post-build Actions you'll want to check "Archive the artifacts" and use "work/**/*.iso" as the files to archive. This way the built ISO will be copied to the Hudson master.

Test it

After saving your job config, do a test run by clicking "Build now". After a few moments you should see a build running, and console output should show grml-live doing it's work!


You obviously want to customize the parameters to your job as well as the first shell fragment, if you want to build something different than some grml-small amd64 ISO ;-)