From 39b2ec0f1e323e174bc359be52f4c1a98dd8d532 Mon Sep 17 00:00:00 2001 From: Alexander Over Date: Thu, 28 Jul 2022 11:44:40 +0200 Subject: [PATCH] Add download option to jenkins module This allows forcing HTTP 1.1 per official suggestion[1], since HTTP 2 regularly fails when downloading. cURL on RHEL7 doesn't support HTTP 2 and thus does not have a --http1.1 switch. [1]: https://github.com/jenkins-infra/helpdesk/issues/3078#issuecomment-1198084336 --- manifests/plugin.pp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fb6f7558..e80a4b5e0 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -45,6 +45,9 @@ # Pin the plugin to a specific version. This prevents the updater from # updating it. # +# @param download_options +# Add options to Archive's curl +# define jenkins::plugin ( Optional[String] $version = undef, Optional[String] $config_filename = undef, @@ -56,6 +59,7 @@ Boolean $enabled = true, String $digest_type = 'sha1', Boolean $pin = false, + Array $download_options = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? { true => [], default => ['--http1.1'] }, ) { include jenkins @@ -186,16 +190,17 @@ command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}", } -> archive { $plugin: - source => $download_url, - path => "${jenkins::plugin_dir}/${plugin}", - checksum_verify => $checksum_verify, - checksum => $checksum, - checksum_type => $checksum_type, - proxy_server => $jenkins::proxy::url, - cleanup => false, - extract => false, - require => $plugindir, - notify => $notify, + source => $download_url, + path => "${jenkins::plugin_dir}/${plugin}", + checksum_verify => $checksum_verify, + checksum => $checksum, + checksum_type => $checksum_type, + proxy_server => $jenkins::proxy::url, + cleanup => false, + extract => false, + require => $plugindir, + notify => $notify, + download_options => $download_options, } $archive_require = Archive[$plugin] } else {