Hydra: Top-Notch Continuous Integration for...
Transcript of Hydra: Top-Notch Continuous Integration for...
HYDRA: TOP-NOTCHCONTINUOUS INTEGRATIONFOR DEMANDING PEOPLE
Ludovic CourtesService d’experimentation & developpementInria Bordeaux Sud-Ouest
3 November 2011
introduction
features
practice
closing
L. Courtes — Hydra: continuous integration for demanding people 2
scenario 1: a peaceful development team...
L. Courtes — Hydra: continuous integration for demanding people 3
scenario 1: ... software that works ...
L. Courtes — Hydra: continuous integration for demanding people 4
scenario 1: ... and suddenly ...
L. Courtes — Hydra: continuous integration for demanding people 5
scenario 1: who broke it?!
L. Courtes — Hydra: continuous integration for demanding people 6
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me.
Which platform?
I user : Darwin 10.4.
On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 7
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me.
Which platform?
I user : Darwin 10.4.
On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 8
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4.
On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 9
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4.
On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 10
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64.
With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 11
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2.
Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 12
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 13
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686
, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 14
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 15
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 16
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 17
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 18
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 19
scenario 2: “works for me”
I user : It’s broken.
I dev : Weird, it works for me. Which platform?
I user : Darwin 10.4. On x86 64. With Apple GCC 4.0.1, GMP4.2.4, MPFR 2.4.2, BDB 4.2. Et avec --disable-color.
I dev : Well, too bad. I rather test on GNU/Linux, i686, withGCC 4.6.2, GMP 4.2.1, MPFR 2.4.1, GDBM 1.8.2, GTK+2.12. Oh, and with --enable-color --enable-gui.
L. Courtes — Hydra: continuous integration for demanding people 20
why continuous integration is so great
1. continuous compilation/test
2. quick feedback
3. pristine build environment
4. different configurations under test
5. build results published
L. Courtes — Hydra: continuous integration for demanding people 21
why continuous integration is so great
1. continuous compilation/test
2. quick feedback
3. pristine build environment
4. different configurations under test
5. build results published
L. Courtes — Hydra: continuous integration for demanding people 22
why continuous integration is so great
1. continuous compilation/test
2. quick feedback
3. pristine build environment
4. different configurations under test
5. build results published
L. Courtes — Hydra: continuous integration for demanding people 23
why continuous integration is so great
1. continuous compilation/test
2. quick feedback
3. pristine build environment
4. different configurations under test
5. build results published
L. Courtes — Hydra: continuous integration for demanding people 24
why continuous integration is so great
1. continuous compilation/test
2. quick feedback
3. pristine build environment
4. different configurations under test
5. build results published
L. Courtes — Hydra: continuous integration for demanding people 25
the true cost of doing it yourself
while true
do
rm -rf foo
svn co svn+ssh://scm.gforge.inria.fr/svn/foo/trunk foo
cd foo
make
2>&1 > build-log || \
mail [email protected] -s "Build failed!" \
< build-log
sleep 300
done
L. Courtes — Hydra: continuous integration for demanding people 26
the true cost of doing it yourself
while true
do
rm -rf foo
svn co svn+ssh://scm.gforge.inria.fr/svn/foo/trunk foo
cd foo
make 2>&1 > build-log || \
mail [email protected] -s "Build failed!" \
< build-log
sleep 300
done
L. Courtes — Hydra: continuous integration for demanding people 27
the true cost of doing it yourself
function svn revision {
( cd "$1"
svn info | \
grep ’\^R.vision *: *\([0-9]\+\)$’ | \
sed -e’s/[0-9]//g’ )
}
function svn update {
( prev rev="$(svn revision $1)"
( cd "$1" ; svn update )
new rev="$(svn revision $1)"
test $prev rev -ne $new rev )
}
function update html report {
local stamp="$(date -u +%Y%m%d-%H%M)"
local test log="$builddir/testsuite/log"
local failure rate="(tests not run)"
gzip --best < "$2" > "build-$stamp.log.gz"
scp "build-$stamp.log.gz" "$ssh remote dir/"
if [ -f "$test log" ]
then
failure rate="$(test failure rate $test log)"
gzip --best < "$builddir/testsuite/log" > "test-$stamp.log.gz"
scp "test-$stamp.log.gz" "$ssh remote dir/"
fi
local result bgcolor
if [ $1 -ne 0 ]
then
result="<b>FAIL</b>"
bgcolor="lightred"
else
result="PASS"
bgcolor="lightgreen"
fi
local rev="$(svn revision $srcdir)"
local html="<tr bgcolor=¨$bgcolor>
<td><a href=¨$(gforge revision url foo $rev)>$rev</a></td>
<td>$stamp</td>
<td>$failure rate</td>
<td>
$result
[ <a href=build-$stamp.log.gz>build</a> |
<a href=test-$stamp.log.gz>test</a> ]
</td>
</tr>"
ed "$html report" <<EOF
/INSERT BUILD RESULTS
+1
i
$html
.
wq
EOF
scp "$html report" "$ssh remote dir/index.html"
}
L. Courtes — Hydra: continuous integration for demanding people 28
the true cost of doing it yourself
function svn revision {
( cd "$1"
svn info | \
grep ’\^R.vision *: *\([0-9]\+\)$’ | \
sed -e’s/[0-9]//g’ )
}
function svn update {
( prev rev="$(svn revision $1)"
( cd "$1" ; svn update )
new rev="$(svn revision $1)"
test $prev rev -ne $new rev )
}
function update html report {
local stamp="$(date -u +%Y%m%d-%H%M)"
local test log="$builddir/testsuite/log"
local failure rate="(tests not run)"
gzip --best < "$2" > "build-$stamp.log.gz"
scp "build-$stamp.log.gz" "$ssh remote dir/"
if [ -f "$test log" ]
then
failure rate="$(test failure rate $test log)"
gzip --best < "$builddir/testsuite/log" > "test-$stamp.log.gz"
scp "test-$stamp.log.gz" "$ssh remote dir/"
fi
local result bgcolor
if [ $1 -ne 0 ]
then
result="<b>FAIL</b>"
bgcolor="lightred"
else
result="PASS"
bgcolor="lightgreen"
fi
local rev="$(svn revision $srcdir)"
local html="<tr bgcolor=¨$bgcolor>
<td><a href=¨$(gforge revision url foo $rev)>$rev</a></td>
<td>$stamp</td>
<td>$failure rate</td>
<td>
$result
[ <a href=build-$stamp.log.gz>build</a> |
<a href=test-$stamp.log.gz>test</a> ]
</td>
</tr>"
ed "$html report" <<EOF
/INSERT BUILD RESULTS
+1
i
$html
.
wq
EOF
scp "$html report" "$ssh remote dir/index.html"
}
L. Courtes — Hydra: continuous integration for demanding people 29
lots of tools!
I BuildBot
I Jenkins (formerly Hudson)
I CruiseControl
I ...
I Hydra
L. Courtes — Hydra: continuous integration for demanding people 30
suitability of a continuous integration tool
I languages & build systems?
I build notification & visualization?
I portability?
I reproducibility?
I scalability?
L. Courtes — Hydra: continuous integration for demanding people 31
introduction
features
practice
closing
L. Courtes — Hydra: continuous integration for demanding people 32
testimonial
“Thanks to Hydra, my software projects shine more than ever!”
— Ludovic C.
L. Courtes — Hydra: continuous integration for demanding people 33
Hydra, Nix, & youhttp://nixos.org/hydra/
I NixI build toolI focus on controlling the build environment
I HydraI continuous integration tool based on Nix
I web interface + email notificationI GNU/Linux, FreeBSD, MacOS X, CygwinI distributed buildsI SSH/root access to the build host not neededI manage the build environment by yourself!
L. Courtes — Hydra: continuous integration for demanding people 34
Hydra, Nix, & youhttp://nixos.org/hydra/
I NixI build toolI focus on controlling the build environment
I HydraI continuous integration tool based on NixI web interface + email notificationI GNU/Linux, FreeBSD, MacOS X, CygwinI distributed builds
I SSH/root access to the build host not neededI manage the build environment by yourself!
L. Courtes — Hydra: continuous integration for demanding people 35
Hydra, Nix, & youhttp://nixos.org/hydra/
I NixI build toolI focus on controlling the build environment
I HydraI continuous integration tool based on NixI web interface + email notificationI GNU/Linux, FreeBSD, MacOS X, CygwinI distributed buildsI SSH/root access to the build host not needed
I manage the build environment by yourself!
L. Courtes — Hydra: continuous integration for demanding people 36
Hydra, Nix, & youhttp://nixos.org/hydra/
I NixI build toolI focus on controlling the build environment
I HydraI continuous integration tool based on NixI web interface + email notificationI GNU/Linux, FreeBSD, MacOS X, CygwinI distributed buildsI SSH/root access to the build host not neededI manage the build environment by yourself!
L. Courtes — Hydra: continuous integration for demanding people 37
a project
L. Courtes — Hydra: continuous integration for demanding people 38
a job set
L. Courtes — Hydra: continuous integration for demanding people 39
a build
L. Courtes — Hydra: continuous integration for demanding people 40
build inputs
L. Courtes — Hydra: continuous integration for demanding people 41
build input changes
L. Courtes — Hydra: continuous integration for demanding people 42
view of a successful job set
L. Courtes — Hydra: continuous integration for demanding people 43
a failed build
L. Courtes — Hydra: continuous integration for demanding people 44
build input changes that led to a failure
L. Courtes — Hydra: continuous integration for demanding people 45
build environments vs. reproducibility
I versions of the dependencies
I compiler
I compilation options, and those of dependencies
I miscellaneous (locale, timezone, etc.)
I paths
L. Courtes — Hydra: continuous integration for demanding people 46
-I/path/to/headers $CPATH
-L/path/to/lib $LIBRARY PATH
$LD LIBRARY PATH
RPATH RUNPATH
$PYTHONPATH
$PERL5LIB$XML CATALOG FILES $GUILE LOAD PATH
$CLASSPATH
build environments vs. reproducibility
I versions of the dependencies
I compiler
I compilation options, and those of dependencies
I miscellaneous (locale, timezone, etc.)
I paths
L. Courtes — Hydra: continuous integration for demanding people 47
-I/path/to/headers $CPATH
-L/path/to/lib $LIBRARY PATH
$LD LIBRARY PATH
RPATH RUNPATH
$PYTHONPATH
$PERL5LIB$XML CATALOG FILES $GUILE LOAD PATH
$CLASSPATH
build environments vs. reproducibility
I versions of the dependencies
I compiler
I compilation options, and those of dependencies
I miscellaneous (locale, timezone, etc.)
I paths
L. Courtes — Hydra: continuous integration for demanding people 48
-I/path/to/headers $CPATH
-L/path/to/lib $LIBRARY PATH
$LD LIBRARY PATH
RPATH RUNPATH
$PYTHONPATH
$PERL5LIB$XML CATALOG FILES $GUILE LOAD PATH
$CLASSPATH
build environments vs. reproducibility
I versions of the dependencies
I compiler
I compilation options, and those of dependencies
I miscellaneous (locale, timezone, etc.)
I paths
L. Courtes — Hydra: continuous integration for demanding people 49
-I/path/to/headers $CPATH
-L/path/to/lib $LIBRARY PATH
$LD LIBRARY PATH
RPATH RUNPATH
$PYTHONPATH
$PERL5LIB$XML CATALOG FILES $GUILE LOAD PATH
$CLASSPATH
build environments vs. reproducibility
I versions of the dependencies
I compiler
I compilation options, and those of dependencies
I miscellaneous (locale, timezone, etc.)
I paths
L. Courtes — Hydra: continuous integration for demanding people 50
-I/path/to/headers $CPATH
-L/path/to/lib $LIBRARY PATH
$LD LIBRARY PATH
RPATH RUNPATH
$PYTHONPATH
$PERL5LIB$XML CATALOG FILES $GUILE LOAD PATH
$CLASSPATHAhem, reproducible builds?
build environment control without Nix
hello
qt4
which compiler? which libc?
and now your favorite admin upgrades the system...Segmentation fault
L. Courtes — Hydra: continuous integration for demanding people 51
build environment control without Nix
hello
qt4
which compiler? which libc?and now your favorite admin upgrades the system...
Segmentation fault
L. Courtes — Hydra: continuous integration for demanding people 52
build environment control without Nix
hello
qt4
which compiler? which libc?and now your favorite admin upgrades the system...
Segmentation fault
L. Courtes — Hydra: continuous integration for demanding people 53
build environment control without Nix
hello
qt4
which compiler? which libc?and now your favorite admin upgrades the system...
Segmentation fault
L. Courtes — Hydra: continuous integration for demanding people 54
uncontrolled build environment = untraceable failures
build environment control with Nix
hello-2.3.drv
default-builder.sh
bash-4.0-p17.drv
bison-2.3.drv
gnum4-1.4.13.drv
curl-7.19.4.drv
openssl-0.9.8k.drv
zlib-1.2.3.drvperl-5.10.0.drv
binutils-2.19.1.drv
texinfo-4.13a.drv gmp-4.3.1.drv
mpfr-2.4.1.drv
lzma-4.32.7.drvncurses-5.7.drv gnum4-1.4.13.drv
linux-headers-2.6.28.5.drv
perl-5.10.0.drv
gawk-3.1.6.drv
coreutils-7.2.drv
gnupatch-2.5.4.drv gnutar-1.22.drv
findutils-4.4.1.drv
replace-2.24.drv gnused-4.1.5.drv gnumake-3.81.drv
diffutils-2.8.1.drv
gnugrep-2.5.4.drv
patchelf-0.4.drv gzip-1.3.12.drv
acl-2.2.47.drv
attr-2.4.43.drv
gettext-0.17.drv
libtool-2.2.6a.drv
perl-5.10.0.drvlzma-4.32.7.drvpcre-7.8.drv
bootstrap-glibc.drv
hello-2.3.tar.bz2.drv
stdenv-linux.drv
mirrors-list.drv
gcc-wrapper-4.3.3.drv
bash40-006.drv bash40-002.drvbash-4.0.tar.gz.drv
stdenv-linux-boot.drv
bzip2-1.0.5.drv
bash40-009.drv
bootstrap-tools.drv
bash40-012.drv bash40-008.drvbash40-013.drv bash40-007.drvbash40-003.drvbash40-001.drvbash40-017.drv bash40-015.drv bash40-005.drvbash40-016.drv bash40-010.drv bash40-004.drv bash40-014.drvbash40-011.drv
mirrors-list.drv
stdenv-linux-boot.drv
bison-2.3.tar.bz2.drv
gcc-wrapper-4.3.3.drv
m4-1.4.13.tar.bz2.drv curl-7.19.4.tar.bz2.drvopenssl-0.9.8k.tar.gz.drvperl-5.10.0.tar.gz.drv zlib-1.2.3.tar.gz.drv
gcc-4.3.3.drv
glibc-2.9.drv
gcc-core-4.3.3.tar.bz2.drv
stdenv-linux-boot.drv
gcc-g++-4.3.3.tar.bz2.drvtexinfo-4.13a.tar.lzma.drvgmp-4.3.1.tar.bz2.drv lzma-4.32.7.tar.gz.drvncurses-5.7.tar.gz.drvglibc-2.9-20081208.tar.bz2.drv
stdenv-linux-boot.drv
bootstrap-gcc.drv
bootstrap-gcc.drv
linux-2.6.28.5.tar.bz2.drv gawk-3.1.6.tar.bz2.drvcoreutils-7.2.tar.gz.drvbzip2-1.0.5.tar.gz.drv patch-2.5.4.tar.gz.drvacl_2.2.47-1.tar.gz.drvattr_2.4.43-1.tar.gz.drv tar-1.22.tar.bz2.drvgettext-0.17.tar.gz.drv findutils-4.4.1.tar.gz.drvreplace-2.24-src-11.11.tar.gz.drvsed-4.1.5.tar.gz.drv libtool-2.2.6a.tar.lzma.drv make-3.81.tar.bz2.drvdiffutils-2.8.1.tar.gz.drvmpfr-2.4.1.tar.bz2.drv grep-2.5.4.tar.bz2.drvpcre-7.8.tar.bz2.drvbinutils-2.19.1.tar.bz2.drv patchelf-0.4.tar.bz2.drv gzip-1.3.12.tar.gz.drv
builder.sh
prehook.sh builder.sh setup.sh
bzip2
bootstrap-tools.cpio.bz2.drv unpack-bootstrap-tools.sh
mkdir curl.bz2 cpio sh
write-mirror-list.sh
connect-timeout.patch
no-sys-dirs.patch setup-hook.sh
builder.sh ld-wrapper.sh gcc-wrapper.shutils.sh setup-hook.sh add-flags
pass-cxxcpp.patch builder.sh no-sys-dirs.patch
locale-override.patch rpcgen-path.patchbuilder.sh nss-skip-unavail.patch
prehook.sh
builder.sh implausible.patch
findutils-path.patch change_echo_path.patch
malloc.patch gettext-fix.patch impure-dirs.patchlog.patch
new-dtags.patch
gnulib-futimens.patch
download.sh ln
... down to the compiler’s compiler!
I build environment entirely under control1
I all the build inputs are known to Nix
1Except for the kernel, the hardware, the direction of the wind, etc.
L. Courtes — Hydra: continuous integration for demanding people 55
build environment control with Nix
hello-2.3.drv
default-builder.sh
bash-4.0-p17.drv
bison-2.3.drv
gnum4-1.4.13.drv
curl-7.19.4.drv
openssl-0.9.8k.drv
zlib-1.2.3.drvperl-5.10.0.drv
binutils-2.19.1.drv
texinfo-4.13a.drv gmp-4.3.1.drv
mpfr-2.4.1.drv
lzma-4.32.7.drvncurses-5.7.drv gnum4-1.4.13.drv
linux-headers-2.6.28.5.drv
perl-5.10.0.drv
gawk-3.1.6.drv
coreutils-7.2.drv
gnupatch-2.5.4.drv gnutar-1.22.drv
findutils-4.4.1.drv
replace-2.24.drv gnused-4.1.5.drv gnumake-3.81.drv
diffutils-2.8.1.drv
gnugrep-2.5.4.drv
patchelf-0.4.drv gzip-1.3.12.drv
acl-2.2.47.drv
attr-2.4.43.drv
gettext-0.17.drv
libtool-2.2.6a.drv
perl-5.10.0.drvlzma-4.32.7.drvpcre-7.8.drv
bootstrap-glibc.drv
hello-2.3.tar.bz2.drv
stdenv-linux.drv
mirrors-list.drv
gcc-wrapper-4.3.3.drv
bash40-006.drv bash40-002.drvbash-4.0.tar.gz.drv
stdenv-linux-boot.drv
bzip2-1.0.5.drv
bash40-009.drv
bootstrap-tools.drv
bash40-012.drv bash40-008.drvbash40-013.drv bash40-007.drvbash40-003.drvbash40-001.drvbash40-017.drv bash40-015.drv bash40-005.drvbash40-016.drv bash40-010.drv bash40-004.drv bash40-014.drvbash40-011.drv
mirrors-list.drv
stdenv-linux-boot.drv
bison-2.3.tar.bz2.drv
gcc-wrapper-4.3.3.drv
m4-1.4.13.tar.bz2.drv curl-7.19.4.tar.bz2.drvopenssl-0.9.8k.tar.gz.drvperl-5.10.0.tar.gz.drv zlib-1.2.3.tar.gz.drv
gcc-4.3.3.drv
glibc-2.9.drv
gcc-core-4.3.3.tar.bz2.drv
stdenv-linux-boot.drv
gcc-g++-4.3.3.tar.bz2.drvtexinfo-4.13a.tar.lzma.drvgmp-4.3.1.tar.bz2.drv lzma-4.32.7.tar.gz.drvncurses-5.7.tar.gz.drvglibc-2.9-20081208.tar.bz2.drv
stdenv-linux-boot.drv
bootstrap-gcc.drv
bootstrap-gcc.drv
linux-2.6.28.5.tar.bz2.drv gawk-3.1.6.tar.bz2.drvcoreutils-7.2.tar.gz.drvbzip2-1.0.5.tar.gz.drv patch-2.5.4.tar.gz.drvacl_2.2.47-1.tar.gz.drvattr_2.4.43-1.tar.gz.drv tar-1.22.tar.bz2.drvgettext-0.17.tar.gz.drv findutils-4.4.1.tar.gz.drvreplace-2.24-src-11.11.tar.gz.drvsed-4.1.5.tar.gz.drv libtool-2.2.6a.tar.lzma.drv make-3.81.tar.bz2.drvdiffutils-2.8.1.tar.gz.drvmpfr-2.4.1.tar.bz2.drv grep-2.5.4.tar.bz2.drvpcre-7.8.tar.bz2.drvbinutils-2.19.1.tar.bz2.drv patchelf-0.4.tar.bz2.drv gzip-1.3.12.tar.gz.drv
builder.sh
prehook.sh builder.sh setup.sh
bzip2
bootstrap-tools.cpio.bz2.drv unpack-bootstrap-tools.sh
mkdir curl.bz2 cpio sh
write-mirror-list.sh
connect-timeout.patch
no-sys-dirs.patch setup-hook.sh
builder.sh ld-wrapper.sh gcc-wrapper.shutils.sh setup-hook.sh add-flags
pass-cxxcpp.patch builder.sh no-sys-dirs.patch
locale-override.patch rpcgen-path.patchbuilder.sh nss-skip-unavail.patch
prehook.sh
builder.sh implausible.patch
findutils-path.patch change_echo_path.patch
malloc.patch gettext-fix.patch impure-dirs.patchlog.patch
new-dtags.patch
gnulib-futimens.patch
download.sh ln
... down to the compiler’s compiler!
I build environment entirely under control1
I all the build inputs are known to Nix
1Except for the kernel, the hardware, the direction of the wind, etc.
L. Courtes — Hydra: continuous integration for demanding people 56
introduction
features
practice
closing
L. Courtes — Hydra: continuous integration for demanding people 57
hello, world!
L. Courtes — Hydra: continuous integration for demanding people 58
a job set
L. Courtes — Hydra: continuous integration for demanding people 59
writing a Hydra job set in Nix
{
tarball = ...;
build = ...;
coverage = ...;
deb = ...;}
L. Courtes — Hydra: continuous integration for demanding people 60
job set
job name
writing a Hydra job set in Nix
{
tarball = ...;
build = ...;
coverage = ...;
deb = ...;}
L. Courtes — Hydra: continuous integration for demanding people 61
make dist
make && make check...
make CFLAGS=--coverage...
qemu... checkinstall...
writing Hydra jobs in Nix
tarball =
{ nixpkgs , helloSrc } :
let pkgs = import nixpkgs { }; in
pkgs.releaseTools.sourceTarball {
name = "hello";
src = helloSrc;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 62
functionparameters
writing Hydra jobs in Nix
tarball =
{ nixpkgs , helloSrc } :
let pkgs = import nixpkgs { }; in
pkgs.releaseTools.sourceTarball {
name = "hello";
src = helloSrc;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 63
checkout of Hello
checkout of the distro
writing Hydra jobs in Nix
build =
{ nixpkgs , tarball , system } :
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.nixBuild {
name = "hello";
src = tarball;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 64
result of tarball job
x86 64-linux, or x86 64-darwin, etc.
writing Hydra jobs in Nix
build =
{ nixpkgs , tarball , system } :
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.nixBuild {
name = "hello";
src = tarball;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 65
hello
qt4
explicit dependency
writing Hydra jobs in Nix
build =
{ nixpkgs , tarball , system } :
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.nixBuild {
name = "hello";
src = tarball;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 66
writing Hydra jobs in Nix
coverage =
{ nixpkgs , tarball , system } :
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.coverageAnalysis {
name = "hello";
src = tarball;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 67
writing Hydra jobs in Nix
deb =
{ nixpkgs , tarball , system } :
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.debBuild {
name = "hello";
src = tarball;
buildInputs = [ pkgs.qt4 ];
configureFlags = "--with-colors";
diskImage = vmTools.diskImages.debian50x86 64;
};
L. Courtes — Hydra: continuous integration for demanding people 68
filling in the blanks...
L. Courtes — Hydra: continuous integration for demanding people 69
“But Autotools suck, CMake rocks.”
— Anonymous (and cavalier) attendee.
L. Courtes — Hydra: continuous integration for demanding people 70
building with CMake
build =
{ system, nixpkgs, helloSrc }:
let pkgs = import nixpkgs { inherit system; }; in
pkgs.releaseTools.nixBuild {
name = "hello-cmake" ;
src = helloSrc;
cmakeFlags = "-DFOO BAR=on";
buildInputs = [ pkgs.cmake pkgs.qt4 ];
};
L. Courtes — Hydra: continuous integration for demanding people 71
“All these C-ish things suck anyway; Java is the way.”
— Anonymous attendee.
L. Courtes — Hydra: continuous integration for demanding people 72
building with Ant
build =
{ nixpkgs, helloSrc }:
let pkgs = import nixpkgs { }; in
pkgs.releaseTools.antBuild {
name = "hello-ant" ;
src = helloSrc;
antTargets = [ "jar" "test" ];
doJavadoc = true;
doCheckstyle = true;
buildInputs = with pkgs; [ ant jdk ];
};
L. Courtes — Hydra: continuous integration for demanding people 73
building with Maven
build =
{ nixpkgs, helloSrc }:
let pkgs = import nixpkgs { }; in
pkgs.releaseTools.mvnBuild {
name = "hello-maven" ;
src = helloSrc;
doJavadoc = true;
doCheckstyle = true;
buildInputs = with pkgs; [ maven2 jdk ];
};
L. Courtes — Hydra: continuous integration for demanding people 74
building things differently
I customize existing build functions (nixBuild, etc.)
I define configureFlags, makeFlags, etc.I define configurePhase, buildPhase, etc. (shell snippets)I ...
I write your own build function
I pythonBuild anyone?
L. Courtes — Hydra: continuous integration for demanding people 75
building things differently
I customize existing build functions (nixBuild, etc.)I define configureFlags, makeFlags, etc.I define configurePhase, buildPhase, etc. (shell snippets)I ...
I write your own build functionI pythonBuild anyone?
L. Courtes — Hydra: continuous integration for demanding people 76
introduction
features
practice
closing
L. Courtes — Hydra: continuous integration for demanding people 77
Continuous integration pacifies developers!
I quick feedback to developers
I source + binaries + doc snapshots for users
I tests of various configurations
I available today!
L. Courtes — Hydra: continuous integration for demanding people 78
summary
Continuous integration pacifies developers!
I quick feedback to developers
I source + binaries + doc snapshots for users
I tests of various configurations
I available today!
L. Courtes — Hydra: continuous integration for demanding people 79
summary
Continuous integration pacifies developers!
I quick feedback to developers
I source + binaries + doc snapshots for users
I tests of various configurations
I available today!
L. Courtes — Hydra: continuous integration for demanding people 80
Hydra @ Inria: what’s missing
I production-ready!
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 81
Hydra @ Inria: what’s missing
I not quite production-ready
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 82
Hydra @ Inria: what’s missing
I not quite production-ready
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 83
Hydra @ Inria: what’s missing
I not quite production-ready
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 84
Hydra @ Inria: what’s missing
I not quite production-ready
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 85
Hydra @ Inria: what’s missing
I not quite production-ready
I no private/proprietary projects yet
I no GPUs, no webcams, no USB percolator (yet)
I some of your dependencies might be missing
I no blame list, no favorite Jenkins plug-in here
I ...
L. Courtes — Hydra: continuous integration for demanding people 86
Hydra @ Inria: what’s already there
I small & growing compile farm: 12 x86 64 cores
I GNU/Linux, MacOS X, and FreeBSD
I kernel & distributed tests in virtual machines
I virtual build environments: Debian, Fedora, openSuSE, etc.
I 6.5 projects being built (C/C++/Fortran, Autotools/CMake)
I ...
L. Courtes — Hydra: continuous integration for demanding people 87
Hydra @ Inria: what’s already there
I small & growing compile farm: 12 x86 64 cores
I GNU/Linux, MacOS X, and FreeBSD
I kernel & distributed tests in virtual machines
I virtual build environments: Debian, Fedora, openSuSE, etc.
I 6.5 projects being built (C/C++/Fortran, Autotools/CMake)
I ...
L. Courtes — Hydra: continuous integration for demanding people 88
Hydra @ Inria: what’s already there
I small & growing compile farm: 12 x86 64 cores
I GNU/Linux, MacOS X, and FreeBSD
I kernel & distributed tests in virtual machines
I virtual build environments: Debian, Fedora, openSuSE, etc.
I 6.5 projects being built (C/C++/Fortran, Autotools/CMake)
I ...
L. Courtes — Hydra: continuous integration for demanding people 89
Hydra @ Inria: what’s already there
I small & growing compile farm: 12 x86 64 cores
I GNU/Linux, MacOS X, and FreeBSD
I kernel & distributed tests in virtual machines
I virtual build environments: Debian, Fedora, openSuSE, etc.
I 6.5 projects being built (C/C++/Fortran, Autotools/CMake)
I ...
L. Courtes — Hydra: continuous integration for demanding people 90
Hydra @ Inria: what’s already there
I small & growing compile farm: 12 x86 64 cores
I GNU/Linux, MacOS X, and FreeBSD
I kernel & distributed tests in virtual machines
I virtual build environments: Debian, Fedora, openSuSE, etc.
I 6.5 projects being built (C/C++/Fortran, Autotools/CMake)
I ...
L. Courtes — Hydra: continuous integration for demanding people 91
getting started
1. email [email protected]
2. add your recipes tohttp://gforge.inria.fr/projects/hydra-recipes
3. watch your project at http://hydra.bordeaux.inria.fr/
L. Courtes — Hydra: continuous integration for demanding people 92
getting started
1. email [email protected]
2. add your recipes tohttp://gforge.inria.fr/projects/hydra-recipes
3. watch your project at http://hydra.bordeaux.inria.fr/
L. Courtes — Hydra: continuous integration for demanding people 93
getting started
1. email [email protected]
2. add your recipes tohttp://gforge.inria.fr/projects/hydra-recipes
3. watch your project at http://hydra.bordeaux.inria.fr/
L. Courtes — Hydra: continuous integration for demanding people 94
getting help
I copy/paste fromhttp://gforge.inria.fr/projects/hydra-recipes
I read the fine manual at http://nixos.org/hydra/
I email [email protected]
L. Courtes — Hydra: continuous integration for demanding people 95
http://sed.bordeaux.inria.fr/