Search code examples
mavenjenkinspuppet

Puppet + Jenkins: how to invoke top-level Maven target


I'm trying to set up a Jenkins' job on a virtual machine using Puppet, having this virtual machine as agent and another one as master in Puppet. What I want to do is to make Puppet download and install Jenkins and all the necessary packages to do the job, set up the job and build it. I've been able to do a big part of this, but now I need to have a Maven's target invoked during the build in Jenkins, and I have no idea how to make Puppet configure this. So the question is: is there someone that know how to do this? Thanks.

PS: I'm learning both Jenkins and Puppet "by doing" from just a week, so I'm clearly a newbie with them!


Solution

  • Have you looked into using the official Jenkins Puppet module?

    https://github.com/jenkinsci/puppet-jenkins

    You should be able to add this code:

    puppet module install rtyler/jenkins
    puppet apply -e 'include jenkins'
    

    Then, if you want to manage jenkins jobs, do something like this:

    jenkins::job { 'test-build-job':
     config => template("${templates}/test-build-job.xml.erb"),
    }
    

    Where you can define your given job as an XML file