Skip to content

Commit

Permalink
Fixes #1090 Stage plugin before deleting existing plugin, remove, the…
Browse files Browse the repository at this point in the history
…n move
  • Loading branch information
zoojar committed Mar 22, 2024
1 parent 66938db commit c76db6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
14 changes: 10 additions & 4 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,26 @@
$checksum_type = undef
}

exec { "force ${plugin}-${version}":
command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}",
exec { "force staged ${plugin}-${version}":
command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}.staged",
}
-> archive { $plugin:
source => $download_url,
path => "${jenkins::plugin_dir}/${plugin}",
path => "${jenkins::plugin_dir}/${plugin}.staged",
checksum_verify => $checksum_verify,
checksum => $checksum,
checksum_type => $checksum_type,
proxy_server => $jenkins::proxy::url,
cleanup => false,
extract => false,
require => $plugindir,
notify => $notify,
}
-> exec { "force ${plugin}-${version}":
command => "/bin/rm -rf ${jenkins::plugin_dir}/${plugin}",
}
-> exec { "stage ${plugin}-${version}":
command => "/bin/mv -f ${jenkins::plugin_dir}/${plugin}.staged ${jenkins::plugin_dir}/${plugin}",
notify => $notify,
}
$archive_require = Archive[$plugin]
} else {
Expand Down
11 changes: 9 additions & 2 deletions spec/defines/jenkins_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@
it do
is_expected.to contain_archive("#{title}.hpi").with(
source: "#{plugin_host}/latest/myplug.hpi",
path: "#{pdir}/#{title}.hpi",
path: "#{pdir}/#{title}.hpi.staged",
cleanup: false,
extract: false
).that_requires("File[#{pdir}]").
that_comes_before("Exec[force #{title}.hpi-]")
end

Check failure on line 23 in spec/defines/jenkins_plugin_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/EmptyLineAfterExample: Add an empty line after `it`. (https://rspec.rubystyle.guide/#empty-lines-around-examples, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample)
it do
is_expected.to contain_("Exec[force #{title}.hpi-]").
that_comes_before("Exec[stage #{title}.hpi-]")
end

Check failure on line 27 in spec/defines/jenkins_plugin_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/EmptyLineAfterExample: Add an empty line after `it`. (https://rspec.rubystyle.guide/#empty-lines-around-examples, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample)
it do
is_expected.to contain_("Exec[stage #{title}.hpi-]").
that_notifies('Service[jenkins]')
end

Check failure on line 31 in spec/defines/jenkins_plugin_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/EmptyLineAfterExample: Add an empty line after `it`. (https://rspec.rubystyle.guide/#empty-lines-around-examples, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample)

it do
is_expected.to contain_file("#{pdir}/#{title}.hpi").with(
owner: 'jenkins',
Expand Down

0 comments on commit c76db6c

Please sign in to comment.