From cc765a7dceb3fbf8eec5404d9130f6a9206634e4 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 2 Mar 2015 15:19:33 -0800 Subject: [PATCH] Allow for plugin pinning Add a pin flag to the plugin define that will pin that plugin if set to true. Change-Id: I8402d1d6ed611d29241b9b2c36ab45ef3b235d21 --- manifests/plugin.pp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 639df96..03bb4c5 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -19,6 +19,7 @@ define jenkins::plugin( $version=0, + $pin=false, ) { $plugin = "${name}.hpi" $plugin_dir = '/var/lib/jenkins/plugins' @@ -67,4 +68,18 @@ define jenkins::plugin( # outage timing better. # notify => Service['jenkins'], } + + if ($pin) { + file { "${plugin_dir}/${plugin}.pinned": + ensure => present, + require => Exec["download-${name}"], + owner => 'jenkins', + group => 'jenkins', + mode => '0644', + } + } else { + file { "${plugin_dir}/${plugin}.pinned": + ensure => absent, + } + } }