Skip to content

Commit

Permalink
(bug) - Remove build:pdk rake task
Browse files Browse the repository at this point in the history
This updates the build rake tasks to build modules with modulebuilder
as oppose to pdk::module::build. This class was removed in pdk 3.3.0, and as such we
should update to use the recommended tooling for the job
puppet-modulebuilder.

This change is backwards-incompatible as it includes the deletion of the
build:pdk rake task.
  • Loading branch information
jordanbreen28 committed Sep 12, 2024
1 parent 6e600d1 commit 1c64d80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
25 changes: 5 additions & 20 deletions lib/puppetlabs_spec_helper/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,11 @@

desc 'Build puppet module package'
task :build do
Rake::Task['build:pdk'].invoke
end

namespace :build do
desc 'Build Puppet module with PDK'
task :pdk do
require 'pdk/util'
require 'pdk/module/build'

path = PDK::Module::Build.invoke(force: true, 'target-dir': File.join(Dir.pwd, 'pkg'))
puts "Module built: #{path}"
rescue LoadError
_ = `pdk --version`
unless $CHILD_STATUS.success?
warn 'Unable to build module. Please install PDK or add the `pdk` gem to your Gemfile.'
abort
end

system('pdk build --force')
end
require 'puppet/modulebuilder'
target_dir = File.join(Dir.pwd, 'pkg')

Check failure on line 127 in lib/puppetlabs_spec_helper/rake_tasks.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 3.2) / spec

Lint/UselessAssignment: Useless assignment to variable - `target_dir`. (https://rubystyle.guide#underscore-unused-vars)

Check failure on line 127 in lib/puppetlabs_spec_helper/rake_tasks.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 2.7) / spec

Lint/UselessAssignment: Useless assignment to variable - `target_dir`. (https://rubystyle.guide#underscore-unused-vars)

Check failure on line 127 in lib/puppetlabs_spec_helper/rake_tasks.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 3.3) / spec

Lint/UselessAssignment: Useless assignment to variable - `target_dir`. (https://rubystyle.guide#underscore-unused-vars)
builder = Puppet::Modulebuilder::Builder.new(Dir.pwd)
package = builder.build
puts "Module built: #{package}"
end

desc 'Clean a built module package'
Expand Down
1 change: 1 addition & 0 deletions puppetlabs_spec_helper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'mocha', '>= 1.0', '< 3'
spec.add_runtime_dependency 'pathspec', '>= 0.2', '< 3'
spec.add_runtime_dependency 'puppet-lint', '~> 4.0'
spec.add_runtime_dependency 'puppet-modulebuilder', '~> 1.0'
spec.add_runtime_dependency 'puppet-syntax', '~> 4.1', '>= 4.1.1'
spec.add_runtime_dependency 'rspec-github', '~> 2.0'
spec.add_runtime_dependency 'rspec-puppet', '~> 5.0'
Expand Down

0 comments on commit 1c64d80

Please sign in to comment.