[Engine-devel] How to utilize Jenkins to do your dirty (build) work for you...

Mike Kolesnik mkolesni at redhat.com
Tue Mar 27 15:02:52 UTC 2012


> On 03/26/2012 04:08 PM, Mike Kolesnik wrote:
> > Hi,
> > 
> > 
> > -- Intro --
> >   When working on your local GIT repo you probably do a lot of:
> >     mvn clean install
> > 
> >   Additionally, if you're working on oVirt-engine you might be
> >   doing some of:
> >     mvn test -Penable-dao-tests
> >     mvn install -Pgwt-admin
> >     etc..
> > 
> >   This, of course, might take your development computer a while,
> >   and hog your resources.
> > 
> >   Usually though, if you work on oVirt, you have a host that you
> >   use for testing your changes..
> >   This host probably has a 2/4 cores CPU and at least 4Gb of RAM..
> > 
> >   This host is sitting quietly most of the time, consuming mostly
> >   electricity but not doing much.
> >   You're probably not even utilizing it that much even when you are
> >   testing something on it.
> >   It is like a powerful guard dog that you keep tied in the
> >   back-yard most of the time, instead of letting it run free.
> > 
> >   Well, I have a suggestion how to put that puppy into good use and
> >   also free up your resources..
> > 
> > -- End Intro --
> > 
> > You can install Jenkins on the host, and have it monitor your local
> > GIT repo for changes, building your commits as necessary.
> > This works with every local branch you have - Jenkins will pick up
> > the change (be it a local commit you just did, or a rebase over
> > the origin) and generate a build for it.
> > 
> > This will allow you to monitor your build results just as you would
> > monitor locally, while in the same time utilize a (probably) more
> > powerful machine to do this for you. It will also probably speed
> > up your build cycle, as builds will be executed in parallel.
> > 
> > I have written an installation guide which explains how to do it in
> > the oVirt wiki:
> >   http://www.ovirt.org/wiki/Local_Jenkins_For_The_People
> > 
> > I have also written a script that will run the installation part on
> > the host for you,
> > so you just need to download the attachment and run it as root on
> > the host, but you will still need to do some manual work so make
> > sure to check the wiki.
> > 
> > -- Example Jobs --
> >   I am also attaching sample jobs to import to Jenkins.
> >   Make sure to replace the GIT repo URL, you can do this before
> >   importing with sed:
> >    # sed -i
> >    's#[git-repo-url]#ssh://[user]@[git-host]/[git-repo-location]#'
> >    oVirt-engine.*
> > 
> >   For example:
> >    # sed -i
> >    's#[git-repo-url]#ssh://mkolesni@myhost/~/git/ovirt-engine#'
> >    oVirt-engine.*
> > 
> >   You can import them with the command:
> >    # cat [job].xml | java -jar /tmp/jenkins-cli.jar -s
> >    http://localhost:8080 create-job [job-name]
> > 
> >   For example:
> >    # cat oVirt-engine.xml | java -jar /tmp/jenkins-cli.jar -s
> >    http://localhost:8080 create-job oVirt-engine
> > -- End Example Jobs --
> > 
> > Of course, this might not be ideal in cases when you need 100%
> > percent of your host..
> > But in such a case you can simply turn off Jenkins, and turn it
> > back on later. ;)
> 
> Great idea.
> One comment -
> I noticed that if u specify */* in "branches to build" then it of
> course
> fetches for you all the branches. If you want to build the current
> branch you're working on - use HEAD instead.

Yes that should work relatively well, but it limits you in the sense that it ONLY monitors the HEAD, while if you use default (** or */*) then it will monitor changes on all branches regardless if you on them or not - it could be a double edged sword if you have a lot of garbage in the repo, but on the other hand it might drive you to clean it :)

> 
> > 
> > 
> > Regards,
> > Mike
> 
> 



More information about the Engine-devel mailing list