3

I am looking for a method to automatically create a set of jenkins jobs (typically after new (git) branches have been created). I have tried this plugin for maven:

http://evgeny-goldin.com/wiki/Maven-jenkins-plugin

and it works fine + its pretty cool to manage all jenkins jobs from a single pom.xml file where names, branch ids etc can be parameterized (eg. through properties)!

The only downside is that I have not figured out how to remove the jobs again but its should be easy to throw in a cleanup script.

Are there better approaches out there to auto-generate jenkins jobs? Eg. using the jenkins api directly from a build script (pom.xml, build.gradle, etc).

Other approaches I am looking into:

http://entagen.github.com/jenkins-build-per-branch/

http://amokti.me/2011/10/11/automatic-opt-in-branch-building-with-jenkins-and-git-2/

so12345
  • 565
  • 1
  • 5
  • 12

1 Answers1

0

An alternative approach is to introduce Gerrit into the workflow. Patchsets submitted for review are implemented within Gerrit as branches.There is a Jenkins plugin which can automatically build and test these review requests, a very handy feature, which I think would fulfil you needs.

Gerrit is used by several large open source projects:

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • 1
    Yes I definitely need to try Gerrit at some point. But for the current task at hand it seems a bit overkill. I just found this: https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API which looks very interesting. – so12345 Jan 06 '13 at 19:34
  • @jserup Yeah, create new jobs via the Jenkins API is pretty easy. Another option to investigate is the Jenkins CLI program (for embedding Jenkins commands in scripts) https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI – Mark O'Connor Jan 07 '13 at 11:46