Merge "Adding gearman plugin configuration to Jenkins"

This commit is contained in:
Nikolay Mahotkin 2016-04-21 14:34:53 +04:00 committed by Gerrit Code Review
commit d04af5eb8c
6 changed files with 74 additions and 0 deletions

View File

@ -108,6 +108,21 @@ Methods:
- $template: $resources.yaml('ConfigureZMQ.template')
- $.instance.agent.call($template, $resources)
configureGearmanPlugin:
Arguments:
- host:
Contract: $.string().notNull()
- port:
Contract: $.int()
Default: 4730
Body:
- $.instance.setHieraValue('gearman_host', $host)
- $.instance.setHieraValue('gearman_port', $port)
- $resources: new(sys:Resources)
- $._environment.reporter.report($this, 'Configure Jenkins Gearman plugin...')
- $template: $resources.yaml('ConfigureGearman.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 Gearman
Body: |
return configureGearman().stdout
Scripts:
configureGearman:
Type: Application
Version: 1.0.0
EntryPoint: configure_gearman.sh
Files:
- 'configure_gearman/templates/hudson.plugins.gearman.GearmanPluginConfig.xml.erb'
- 'configure_gearman/manifests/init.pp'
- 'configure_gearman.pp'
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,6 @@
node default {
class { 'configure_gearman':
gearman_host => hiera('gearman_host'),
gearman_port => hiera('gearman_port')
}
}

View File

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

View File

@ -0,0 +1,17 @@
class configure_gearman (
$gearman_host = undef,
$gearman_port = undef
) {
service { 'jenkins':
ensure => running,
enable => true,
}
file { '/var/lib/jenkins/hudson.plugins.gearman.GearmanPluginConfig.xml':
notify => Service['jenkins'],
ensure => present,
owner => 'jenkins',
group => 'jenkins',
mode => '0644',
content => template('configure_gearman/hudson.plugins.gearman.GearmanPluginConfig.xml.erb'),
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson.plugins.gearman.GearmanPluginConfig plugin="gearman-plugin@0.1.1">
<enablePlugin>true</enablePlugin>
<host><%= gearman_host %></host>
<port><%= gearman_port %></port>
</hudson.plugins.gearman.GearmanPluginConfig>