Skip to content

Commit

Permalink
Resolves #1090 Stage plugin before deleting existing plugin, remove, …
Browse files Browse the repository at this point in the history
…then move
  • Loading branch information
zoojar committed Mar 21, 2024
1 parent 66938db commit fadd25f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@
$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,
Expand All @@ -197,6 +197,12 @@
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}",
}
$archive_require = Archive[$plugin]
} else {
$archive_require = undef
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/jenkins_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
it do

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on sles-11-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on opensuse-15-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on centos-9-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on ubuntu-20.04-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on rocky-8-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on oraclelinux-8-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on almalinux-8-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on redhat-8-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on sles-12-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"

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

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

jenkins::plugin on rocky-9-x86_64 without version is expected to contain Archive[myplug.hpi] that requires File[/var/lib/jenkins/plugins] Failure/Error: is_expected.to contain_archive("#{title}.hpi").with( source: "#{plugin_host}/latest/myplug.hpi", path: "#{pdir}/#{title}.hpi.staging", cleanup: false, extract: false ).that_requires("File[#{pdir}]"). that_notifies('Service[jenkins]') expected that the catalogue would contain Archive[myplug.hpi] with path set to "/var/lib/jenkins/plugins/myplug.hpi.staging" but it is set to "/var/lib/jenkins/plugins/myplug.hpi.staged"
is_expected.to contain_archive("#{title}.hpi").with(
source: "#{plugin_host}/latest/myplug.hpi",
path: "#{pdir}/#{title}.hpi",
path: "#{pdir}/#{title}.hpi.staging",
cleanup: false,
extract: false
).that_requires("File[#{pdir}]").
Expand Down

0 comments on commit fadd25f

Please sign in to comment.