jenkins the definitive guide

(Jeff_L) #1
</repository>
<mail>
<recipients>[email protected]</recipients>
<sendForUnstable>false</sendForUnstable>
</mail>
</job>

This would generate the job shown in Figure 10.28, “jenkins-master job generated”.


Figure 10.28. jenkins-master job generated


The plugin’s documentation^4 provides a detailed reference of all settings that can be configured.


10.5.2. Reusing Job Configuration with Inheritance


Being able to generate Jenkins jobs using centralized configuration, such as Maven POM, solves the
problem of creating and updating many jobs at once. All you has to do now is to modify the job
definitions, re-run the plugin and load definitions updated with Manage Jenkins#“Reload Configuration
from Disk”. This approach also has the advantage of making it easy to store your job configurations in
your version control system, which in turn makes it easier to keep track of changes made to the build
configurations.


But we still didn’t solve the problem of maintaining jobs that share a number of identical properties, such
as Maven goals, email recipients or code repository URL. For that, the Maven Jenkins Plugin provides
jobs inheritance, demonstrated in the following example:


<jobs>
<job>
<id>google-guice-inheritance-base</id>
<abstract>true</abstract>
<jdkName>jdk1.6.0</jdkName>
<mavenName>apache-maven-3</mavenName>
<daysToKeep>5</daysToKeep>
<useUpdate>true</useUpdate>
<mavenGoals>-B -e -U clean install</mavenGoals>

(^4) http://evgeny-goldin.com/wiki/Maven-jenkins-plugin#.3Cjob.3E

Free download pdf