Reputation: 157
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!
Upvotes: 0
Views: 516
Reputation: 1641
the most easy that I found was, using jenkins::job::present
intent of jenkins::job
jenkins::job::present { 'testjob':
config_file => '/var/testjob.xml',
require => File['testjobxml'],
}
Upvotes: 0
Reputation: 677
In order to create a job using puppet-jenkins project : (https://github.com/jenkinsci/puppet-jenkins), i've create a job like this :
jenkins::job {
'build' :
config => '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties></properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>';
}
After run vagrant up and go into your jenkins, you will see this job read to build.
Upvotes: 1
Reputation: 5200
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
Upvotes: 1