Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
add support for hudson.plugins.ws__cleanup.PreBuildCleanup plugin (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgcarroll authored and JustMcAfee committed Apr 11, 2017
1 parent a79db22 commit 721080d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/jenkins_pipeline_builder/extensions/wrappers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,15 @@
end
end
end

wrapper do
name :prebuild_cleanup
plugin_id 'ws-cleanup'
description 'Deletes workspace before build starts.'
jenkins_name 'Delete workspace before build starts'
announced false

xml do |_|
send('hudson.plugins.ws__cleanup.PreBuildCleanup', 'plugin' => 'ws-cleanup')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
nodejs: ['0'],
rvm: ['0', '0.5'],
timestamp: ['0'],
xvfb: ['0']
xvfb: ['0'],
prebuild_cleanup: ['0']
}.freeze

PUBLISHERS = {
Expand Down
13 changes: 13 additions & 0 deletions spec/lib/jenkins_pipeline_builder/extensions/wrappers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,17 @@
expect(node.first.content).to match 'Node-0.10.24'
end
end

context 'prebuild_cleanup' do
before :each do
JenkinsPipelineBuilder.registry.registry[:job][:wrappers][:prebuild_cleanup].installed_version = '0.0'
end

it 'generates correct xml' do
JenkinsPipelineBuilder.registry.traverse_registry_path('job', { wrappers: { prebuild_cleanup: true } }, @n_xml)

node = @n_xml.root.xpath('//buildWrappers/hudson.plugins.ws__cleanup.PreBuildCleanup')
expect(node.first).to_not be_nil
end
end
end

0 comments on commit 721080d

Please sign in to comment.