system-config/modules/jenkins/manifests/plugin.pp
James E. Blair 3f4a70d1a3 Don't automatically restart jenkins on plugin changes
This way we can manually gracefully restart jenkins.  Since this
won't immediately install plugins, change the download test to
check whether an hpi or jpi file exists.

Change-Id: I41667684ad8a57f5ae554f866dcc38d5ecca6ba0
2013-08-03 02:34:32 +00:00

58 lines
1.3 KiB
Puppet

#
# Defined resource type to install jenkins plugins.
#
# Borrowed from: https://github.com/jenkinsci/puppet-jenkins
#
define jenkins::plugin(
$version=0,
) {
$plugin = "${name}.hpi"
$plugin_dir = '/var/lib/jenkins/plugins'
$plugin_parent_dir = '/var/lib/jenkins'
if ($version != 0) {
$base_url = "http://updates.jenkins-ci.org/download/plugins/${name}/${version}"
}
else {
$base_url = 'http://updates.jenkins-ci.org/latest'
}
if (!defined(File[$plugin_dir])) {
file {
[
$plugin_parent_dir,
$plugin_dir,
]:
ensure => directory,
owner => 'jenkins',
group => 'jenkins',
require => [Group['jenkins'], User['jenkins']],
}
}
if (!defined(Group['jenkins'])) {
group { 'jenkins' :
ensure => present,
}
}
if (!defined(User['jenkins'])) {
user { 'jenkins' :
ensure => present,
}
}
exec { "download-${name}" :
command => "wget --no-check-certificate ${base_url}/${plugin}",
cwd => $plugin_dir,
require => File[$plugin_dir],
path => ['/usr/bin', '/usr/sbin',],
user => 'jenkins',
unless => "test -f ${plugin_dir}/${name}.?pi",
# OpenStack modification: don't auto-restart jenkins so we can control
# outage timing better.
# notify => Service['jenkins'],
}
}