Commit 19a1f850 authored by Holger Levsen's avatar Holger Levsen
Browse files

initial version of chroot_tester and TODO file

parents
TODO
----
== About jenkins.debian.net
* This is pretty much work in progress, (hopefully) doing something useful since October 15th 2012
* Join #debian-qa on irc.debian.org to report bugs or give other feedback!
* git clone git://git.debian.org/git/users/holger/jenkins.debian.net.git
== general todo
- add copyright notes
- firewall host
- switch to /srv/jenkins to be fetch from git
- mv "welcome to jenkins.d.n"-intro text to "about jenkins.d.n" in navigation (and use the html rendered version of this very file (in asciidoc syntax))
- use mirror.1und1.d
- mail notifications (to where?)
- proper backup (=daily)
- moar tests (see below)
- use https://github.com/openstack-ci/jenkins-job-builder to create _all_ job configurations (if possible, else mix with job-dsl-plugin or https://github.com/JoelJ/Templating.git
- proper git repo, outside ~holger
=== minor stuff
- squid, cache files bigger than 20MB? (maximum_object_size in squid.conf)
- only trigger^wreally run jobs if available+used packages have changed (save packages in db and compare)
- install desktop-base, plymouth?
== more tests:
=== test images:
<h01ger> and i plan to test (at first) weekly images of amd64 std,kde,lxde+xfce weekly and the first sid daily daily. anything obvious+useful i miss?
<h01ger> .oO( "other archs" )
- use jigdo:
http://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-cd/
http://cdimage.debian.org/cdimage/daily-builds/sid_d-i/20121020-1/amd64/
- start client VMs using the profitbricks API: https://www.profitbricks.com/us/media/docs/PB_PublicAPI_EN.pdf (and dhcp)
=== test tasks:
<h01ger> how do i install a task outside d-i?
<h01ger> what interesting tasks are there?
<jcristau> tasksel install <task>
<daemonkeeper> h01ger: http://packages.debian.org/source/sid/tasksel
== to document properly
#missing: how jenkins was installed
apt-get install mtr-tiny dstat
apt-get install debootstrap sudo figlet graphviz apache2 python-yaml python-setuptools
apt-get install build-essential devscripts && apt-get build-dep python-jenkinsapi
a2enmod proxy
a2enmod proxy_http
== to backup
- backup: /etc /srv/jenkins /var/lib/jenkins/job/*/config.xml /var/lib/jenkins/userContent/
- mkdir /chroots ; chown jenkins.jenkins /chroots
- /etc/sudoers.d/jenkins
- /etc/squid/squid.conf
- /etc/apt/apt.conf.d/80proxy
- /etc/apache2/sites-enabled/000-default
#!/bin/bash
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
# $1 = base distro
# $2 = extra component
# $3 = upgrade distro
if [ "$1" == "" ] ; then
echo "need at least one distribution to act on"
echo '# $1 = base distro'
echo '# $2 = extra component (gnome, kde, xfce, lxce)'
echo '# $3 = upgrade distro'
exit 1
fi
SLEEP=$(shuf -i 1-10 -n 1)
echo "Sleeping $SLEEP seconds to randomize start times and parallel runs."
sleep $SLEEP
set -x
set -e
export LANG=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export SCRIPT_HEADER="#!/bin/bash
set -x
set -e
export DEBIAN_FRONTEND=noninteractive
export LANG=C
export http_proxy=$http_proxy"
export CHROOT_TARGET=$(mktemp -d -p /chroots/ $1.XXXXXXXXX)
export TMPFILE=$(mktemp -u)
export CTMPFILE=$CHROOT_TARGET/$TMPFILE
cleanup_all() {
# FIXME: test if it starts with /chroots/
if [ "$CHROOT_TARGET" = "" ] ; then
echo "HALP. CHROOT_TARGET = $CHROOT_TARGET"
exit 1
fi
sudo umount -l $CHROOT_TARGET/proc || true
sudo umount -l $CHROOT_TARGET/run/lock || true
sudo umount -l $CHROOT_TARGET/run/shm || true
sudo umount -l $CHROOT_TARGET/run || true
sudo rm -rf $CHROOT_TARGET
}
execute_ctmpfile() {
chmod +x $CTMPFILE
sudo chroot $CHROOT_TARGET $TMPFILE
rm $CTMPFILE
}
prepare_bootstrap() {
cat >> $CTMPFILE <<-EOF
$SCRIPT_HEADER
mount /proc -t proc /proc
echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
EOF
}
prepare_install_packages() {
cat >> $CTMPFILE <<-EOF
$SCRIPT_HEADER
apt-get update
apt-get -y install $1
EOF
}
prepare_upgrade2() {
cat >> $CTMPFILE <<-EOF
echo "deb $MIRROR $1 main contrib non-free" > /etc/apt/sources.list
$SCRIPT_HEADER
apt-get update
#apt-get -y install apt
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get -y dist-upgrade
apt-get -y autoremove
EOF
}
bootstrap() {
echo "Bootstraping $1 into $CHROOT_TARGET now."
sudo debootstrap $1 $CHROOT_TARGET $MIRROR
prepare_bootstrap
execute_ctmpfile
}
install_packages() {
echo "Installing extra packages for $1 now."
prepare_install_packages $2
execute_ctmpfile
}
upgrade2() {
echo "Upgrading to $1 now."
prepare_upgrade2 $1
execute_ctmpfile
}
trap cleanup_all INT TERM EXIT
case $1 in
squeeze)bootstrap squeeze;;
wheezy) bootstrap wheezy;;
sid) bootstrap sid;;
*) echo "unsupported distro." ; exit 1 ;;
esac
if [ "$2" != "" ] ; then
case $2 in
none) ;;
gnome) install_packages gnome gnome ;;
kde) install_packages kde kde-plasma-desktop ;;
xfce) install_packages xfce xfce4 ;;
lxde) install_packages lxde lxde ;;
*) echo "unsupported component." ; exit 1 ;;
esac
fi
if [ "$3" != "" ] ; then
case $3 in
squeeze)upgrade2 squeeze;;
wheezy) upgrade2 wheezy;;
sid) upgrade2 sid;;
*) echo "unsupported distro." ; exit 1 ;;
esac
fi
cleanup_all
trap - INT TERM EXIT
#/bin/bash
echo
uptime
echo
df -h
echo
HOUSE=$(ls /chroots/)
if [ "$HOUSE" != "" ] ; then
figlet "Warning:"
echo
echo "Probably manual cleanup needed:"
echo
echo "$ ls -la /chroots/"
ls -la /chroots/
exit 1
fi
echo "No problems found, all seems good."
figlet "Ok."
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment