[JENKINS] Add defaults for Maven

Maven configured by default

Change-Id: I01372ebf1a8c2b2690104b4f9170165b5341973b
This commit is contained in:
Artem Silenkov 2016-05-06 10:50:34 +03:00
parent fae7118e2b
commit fe0a0c135a
6 changed files with 78 additions and 0 deletions

View File

@ -69,6 +69,7 @@ Methods:
- $.configureZMQPlugin()
- $.configureGitPlugin($.gitUser, $.gitEmail)
- $.configureMavenPlugin()
- If: $.instance.assignFloatingIp
Then:
@ -155,6 +156,13 @@ Methods:
- $template: $resources.yaml('ConfigureGit.template')
- $.instance.agent.call($template, $resources)
configureMavenPlugin:
Body:
- $resources: new(sys:Resources)
- $._environment.reporter.report($this, 'Configure Jenkins Maven plugin...')
- $template: $resources.yaml('ConfigureMaven.template')
- $.instance.agent.call($template, $resources)
destroy:
Body:
- $.reportDestroyed()

View File

@ -0,0 +1,19 @@
FormatVersion: 2.1.0
Version: 1.0.0
Name: Configure Maven
Body: |
return configureMaven().stdout
Scripts:
configureMaven:
Type: Application
Version: 1.0.0
EntryPoint: configure_maven.sh
Files:
- configure_maven/templates/hudson.tasks.Maven.xml.erb
- configure_maven/manifests/init.pp
- configure_maven.pp
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,6 @@
node default {
class { 'configure_maven':
maven_name => 'MAVEN',
maven_id => '3.3.9',
}
}

View File

@ -0,0 +1,11 @@
#!/bin/bash
# No error if already exists.
mkdir -p /etc/puppet/modules/configure_maven
mkdir -p /etc/puppet/modules/configure_maven/manifests/
mkdir -p /etc/puppet/modules/configure_maven/templates/
cp configure_maven/manifests/init.pp /etc/puppet/modules/configure_maven/manifests/
cp configure_maven/templates/hudson.tasks.Maven.xml.erb /etc/puppet/modules/configure_maven/templates/
puppet apply configure_maven.pp

View File

@ -0,0 +1,17 @@
class configure_maven (
$maven_name = undef,
$maven_id = undef,
) {
service { 'jenkins':
ensure => running,
enable => true,
}
file { '/var/lib/jenkins/hudson.tasks.Maven.xml':
notify => Service['jenkins'],
ensure => present,
owner => 'jenkins',
group => 'jenkins',
mode => '0644',
content => template('configure_maven/hudson.tasks.Maven.xml.erb'),
}
}

View File

@ -0,0 +1,17 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson.tasks.Maven_-DescriptorImpl>
<installations>
<hudson.tasks.Maven_-MavenInstallation>
<name><%= maven_name %></name>
<properties>
<hudson.tools.InstallSourceProperty>
<installers>
<hudson.tasks.Maven_-MavenInstaller>
<id><%= maven_id %></id>
</hudson.tasks.Maven_-MavenInstaller>
</installers>
</hudson.tools.InstallSourceProperty>
</properties>
</hudson.tasks.Maven_-MavenInstallation>
</installations>
</hudson.tasks.Maven_-DescriptorImpl>