From 62c2056266526303bdddd3fb20417f8c7c7230bb Mon Sep 17 00:00:00 2001 From: Ramy Asselin Date: Fri, 20 Nov 2015 11:13:02 -0800 Subject: [PATCH] Add the ability to set your own plugin url Using your own url is an equivalent to Manage Jenkins -> Manage Plugins -> Advanced -> Upload Plugin option. Change-Id: Iac6d2cd1b679443f631bf174e5d3322d7574687a --- manifests/plugin.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 2d9b932..0676a7e 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -20,6 +20,7 @@ define jenkins::plugin( $version='latest', $pin=false, + $plugin_url=undef, ) { $plugin = "${name}.hpi" $plugin_dir = '/var/lib/jenkins/plugins' @@ -31,6 +32,12 @@ define jenkins::plugin( $base_url = "http://updates.jenkins-ci.org/download/plugins/${name}/${version}" } + if $plugin_url == undef { + $_plugin_url = "${base_url}/${plugin}" + } else { + $_plugin_url = $plugin_url + } + if (!defined(File[$plugin_dir])) { file { [ @@ -57,7 +64,7 @@ define jenkins::plugin( } exec { "download-${name}" : - command => "wget --no-check-certificate ${base_url}/${plugin}", + command => "wget --no-check-certificate ${_plugin_url}", cwd => $plugin_dir, require => File[$plugin_dir], path => ['/usr/bin', '/usr/sbin',],