Continuous Integration with Jenkins, git and psake
Right now, I’m using a Continuous Integration (CI) setup consisting of:
- A Jenkins CI server, running on a Rackspace Ubuntu 12.04 server
- git source control, backed by a github project
- .net projects, with psake build scripts
- Windows 7 build machine
Here are a few take-aways:
Windows slave
- Use labels to identify a build machine as a Windows machine.
- Since my build machine isn’t accessible from the Internet,
I used Java Web start to get started and install
it as Windows service from the UI .
Note you might want to run the `javaws … `
from a command prompt with elevated privileges
to be able to install a Windows Service.
- I configured the Jenkins Slave service to log on as
dedicated user on the build machine that has all the build paths
and ssh keys set up to work with my bot account on Github
- Don’t forget that your slave has to give consent to restore missing
using NuGet ; id did this by setting the
EnableNuGetPackageRestore environment variable to true.
- Install the Windows (7/8/…) SDK
- You might need to copy some build targets from
C:Program Files (x86)MSBuildMicrosoftVisualStudio,
or alternatively install Visual Studio on your build server
(now WHO would want to do THAT?).
psake
- Don’t forget to set the PS execution policy to RemoteSigned
on your build slave.
- When using the Jenkins PS plugin,
use the psake.ps1 helper script with $psake.use_exit_on_error = $true
.
This to make sure the build script exits with an exit code not equal to 0
in the case of build errors.
I didn’t get this to work; not sure why. So …
- Instead of using the Jenkins PowerShell[#PSPLugin]_ plugin for executing
psake build scripts, I used the psake.cmd deployed with psake.
By default, psake.cmd bypasses the execution policy,
so you might not want to do this.
Footnotes