Skip to content

Commit

Permalink
Merge pull request #307 from puppetlabs/CONT-422-release_2.6.0
Browse files Browse the repository at this point in the history
(CONT-422) PDK v2.6.0
  • Loading branch information
GSPatton authored Jan 17, 2023
2 parents eece308 + 5f9414f commit e8ee92f
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 131 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def location_for(place)
end
end

gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || '~> 0.26.2')
gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '>= 0.106.2')
gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || '~> 0.31.0')
gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '>= 0.108.0')

# csv > 3.1.5 requires 'stringio' which the latest version of requires Ruby >= 2.5.0
gem 'csv', '3.1.5' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.5.0')
Expand Down
2 changes: 1 addition & 1 deletion configs/components/gem-prune.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
gem_bins[local_settings[:ruby_api]] = local_settings[:host_gem]
end

pdk_ruby_versions = ['2.4.0', '2.5.0', '2.7.0']
pdk_ruby_versions = ['2.5.0', '2.7.0']

pdk_ruby_versions.map do |rubyapi|
gem_paths = [
Expand Down
4 changes: 2 additions & 2 deletions configs/components/pdk-templates.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ref": "9a16c87c3487b8211ee2c9e061ec171e088d7204",
"url": "https://github.com/puppetlabs/pdk-templates",
"version": "unknown"
}
"version": "2.7.1"
}
32 changes: 7 additions & 25 deletions configs/components/pdk-templates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

pkg.build_requires "pdk-runtime"
pkg.build_requires "rubygem-bundler"
pkg.build_requires "rubygem-mini_portile2"
pkg.build_requires "rubygem-nokogiri"
pkg.build_requires "rubygem-pdk"
pkg.build_requires "puppet-versions"

Expand All @@ -27,6 +25,9 @@
ruby_cachedir = File.join(settings[:cachedir], 'ruby', settings[:ruby_api])
puppet_cachedir = File.join(settings[:privatedir], 'puppet', 'ruby')

# Work is needed here. This should account for the presence of the SHA or version.
template_ref = pkg.get_version == 'unknown' || pkg.get_version.nil? ? 'main' : pkg.get_version

gem_path_with_puppet_cache = [
File.join(settings[:privatedir], 'ruby', settings[:ruby_version], 'lib', 'ruby', 'gems', settings[:ruby_api]),
File.join(puppet_cachedir, settings[:ruby_api]),
Expand All @@ -49,23 +50,13 @@
pre_build_commands = []
build_commands = []

# Pre-install some native gems.
mini_portile2_version = settings[:mini_portile2_version][settings[:ruby_api]][:version]
pre_build_commands << "#{gem_env.join(' ')} #{settings[:gem_install]} ../mini_portile2-#{mini_portile2_version}.gem"

if platform.is_windows?
nokogiri_version = settings[:nokogiri_version][settings[:ruby_api]][:version]
pre_build_commands << "#{gem_env.join(' ')} #{settings[:gem_install]} ../nokogiri-#{nokogiri_version}-x64-mingw32.gem"
pre_build_commands << "#{gem_env.join(' ')} #{settings[:gem_install]} ../unf_ext-0.0.7.7-x64-mingw32.gem"
end

# Clone this component repo to a bare repo inside the project cachedir.
# Need --no-hardlinks because this is a local clone and hardlinks mess up packaging later.
build_commands << "#{git_bin} clone --mirror --no-hardlinks . #{File.join(settings[:cachedir], 'pdk-templates.git')}"

# Use previously installed pdk gem to generate a new module using the
# cached module template.
build_commands << "#{pdk_bin} new module #{mod_name} --skip-interview --template-ref=main --template-url=file:///#{File.join(settings[:cachedir], 'pdk-templates.git')} --skip-bundle-install"
build_commands << "#{pdk_bin} new module #{mod_name} --skip-interview --template-ref=#{template_ref} --template-url=file:///#{File.join(settings[:cachedir], 'pdk-templates.git')} --skip-bundle-install"

# Run 'bundle lock' in the generated module and cache the Gemfile.lock
# inside the project cachedir. We add the private/puppet paths to
Expand All @@ -77,10 +68,10 @@
build_commands << "cp #{mod_name}/Gemfile.lock #{settings[:cachedir]}/Gemfile.lock"

# Add some additional gems to support experimental features
build_commands << "echo 'gem \"puppet-debugger\", require: false' >> #{mod_name}/Gemfile"
# build_commands << "echo 'gem \"puppet-debugger\", require: false' >> #{mod_name}/Gemfile"
build_commands << "echo 'gem \"guard\", require: false' >> #{mod_name}/Gemfile"
build_commands << "echo 'gem \"listen\", require: false' >> #{mod_name}/Gemfile"
build_commands << "echo 'gem \"codecov\", require: false' >> #{mod_name}/Gemfile"
# build_commands << "echo 'gem \"codecov\", require: false' >> #{mod_name}/Gemfile"
build_commands << "echo 'gem \"license_finder\", require: false' >> #{mod_name}/Gemfile"

# Add some Beaker dependencies for Linux
Expand Down Expand Up @@ -123,28 +114,24 @@
"GEM_HOME=\"#{local_ruby_cachedir}\"",
]

local_nokogiri_version = settings[:nokogiri_version][local_settings[:ruby_api]][:version]

local_gem_env << "PUPPET_GEM_VERSION=\"#{local_settings[:latest_puppet]}\"" if local_settings[:latest_puppet]

local_mod_name = "vanagon_module_#{local_settings[:ruby_version].gsub(/[^0-9]/, '')}"

# Generate a new module for this ruby version.
build_commands << "#{pdk_bin} new module #{local_mod_name} --skip-interview --template-ref=main --template-url=file:///#{File.join(settings[:cachedir], 'pdk-templates.git')} --skip-bundle-install"
build_commands << "#{pdk_bin} new module #{local_mod_name} --skip-interview --template-ref=#{template_ref} --template-url=file:///#{File.join(settings[:cachedir], 'pdk-templates.git')} --skip-bundle-install"

# Resolve default gemfile deps
build_commands << "pushd #{local_mod_name} && #{local_gem_env.join(' ')} #{local_settings[:host_bundle]} update && popd"

build_commands << "mv #{local_mod_name}/Gemfile.lock #{settings[:cachedir]}/Gemfile-#{rubyver}.lock"

# Add some additional gems to support experimental features
build_commands << "echo 'gem \"puppet-debugger\", require: false' >> #{local_mod_name}/Gemfile"
build_commands << "echo 'gem \"guard\", require: false' >> #{local_mod_name}/Gemfile"

build_commands << "echo 'gem \"puppet-strings\", require: false' >> #{local_mod_name}/Gemfile"
build_commands << "echo 'gem \"codecov\", require: false' >> #{local_mod_name}/Gemfile"
build_commands << "echo 'gem \"license_finder\", require: false' >> #{local_mod_name}/Gemfile"
build_commands << "echo 'gem \"nokogiri\", \"<= #{local_nokogiri_version}\", require: false' >> #{local_mod_name}/Gemfile"

# Add some Beaker dependencies for Linux
unless platform.is_windows?
Expand All @@ -164,17 +151,12 @@
# Install bundler itself into the gem cache for this ruby
build_commands << "#{local_gem_env.join(' ')} #{local_settings[:host_gem]} install --no-document --local --bindir /tmp ../bundler-#{settings[:bundler_version]}.gem"

# Prepend native gem installation commands for this ruby
local_mini_portile2_version = settings[:mini_portile2_version][local_settings[:ruby_api]][:version]
pre_build_commands << "#{local_gem_env.join(' ')} #{local_settings[:gem_install]} ../mini_portile2-#{local_mini_portile2_version}.gem"

if platform.is_windows?
# The puppet gem has files in it's 'spec' directory with very long paths which
# bump up against MAX_PATH on Windows. Since the 'spec' directory is not required
# at runtime, we just purge it before attempting to package.
build_commands << "/usr/bin/find #{local_ruby_cachedir} -regextype posix-extended -regex '.*/puppet-[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+[^/]*/spec/.*' -delete"

pre_build_commands << "#{local_gem_env.join(' ')} #{local_settings[:gem_install]} ../nokogiri-#{local_nokogiri_version}-x64-mingw32.gem"
unless local_settings[:ruby_api].start_with?('2.1.')
pre_build_commands << "#{local_gem_env.join(' ')} #{local_settings[:gem_install]} ../unf_ext-0.0.7.7-x64-mingw32.gem"
end
Expand Down
2 changes: 1 addition & 1 deletion configs/components/puppet-specifications.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
component "puppet-specifications" do |pkg, settings, platform|
pkg.ref "master"
pkg.url "git@github.com:puppetlabs/puppet-specifications.git"
pkg.url "https://github.com/puppetlabs/puppet-specifications"

pkg.build_requires "pdk-runtime"

Expand Down
3 changes: 2 additions & 1 deletion configs/components/puppet-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def ruby_for_puppet(version)
ruby_dirs[local_settings[:ruby_api]] = local_settings[:ruby_dir]
end

recent_puppets = available_puppet_gem_versions('>=5.5.21 <8.0.0')
recent_puppets = available_puppet_gem_versions('>=6.0.10 <8.0.0')
latest_puppets = latest_z_releases(recent_puppets)
puppet_rubyapi_versions = Hash[latest_puppets.collect { |pupver| [pupver.version, ruby_for_puppet(pupver)] }]
pdk_ruby_versions = puppet_rubyapi_versions.values.uniq
Expand Down Expand Up @@ -130,6 +130,7 @@ def ruby_for_puppet(version)
# Update rubygems on "primary" Ruby
build_commands += rubygems_update.call(settings[:ruby_version], settings[:ruby_api])


# Update rubygems on "additional" rubies
settings[:additional_rubies]&.each do |rubyver, local_settings|
build_commands += rubygems_update.call(rubyver, local_settings[:ruby_api])
Expand Down
15 changes: 0 additions & 15 deletions configs/components/rubygem-mini_portile2.rb

This file was deleted.

46 changes: 0 additions & 46 deletions configs/components/rubygem-nokogiri.rb

This file was deleted.

4 changes: 2 additions & 2 deletions configs/components/rubygem-pdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ref": "",
"version": "2.5.0",
"ref": "ddf4151ca088e3e1ece9c444fcaaa193298cc219",
"version": "2.6.0",
"url": "https://github.com/puppetlabs/pdk"
}
20 changes: 20 additions & 0 deletions configs/platforms/fedora-36-x86_64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
platform 'fedora-36-x86_64' do |plat|
plat.servicedir '/usr/lib/systemd/system'
plat.defaultdir '/etc/sysconfig'
plat.servicetype 'systemd'
plat.dist 'fc36' # There's an issue with the version of binutils (2.37) in Fedora 36's repos

# We temporarily use a newer version from rawhide. See PA-4448
plat.provision_with('/usr/bin/dnf install -y fedora-repos-rawhide')
plat.provision_with('/usr/bin/dnf install -y --enablerepo rawhide binutils')

packages = %w[
autoconf automake bzip2-devel gcc gcc-c++ libselinux-devel
libsepol libsepol-devel make cmake pkgconfig readline-devel
rpmdevtools rsync swig zlib-devel systemtap-sdt-devel
perl-lib perl-FindBin
]
plat.provision_with("/usr/bin/dnf install -y --best --allowerasing #{packages.join(' ')}")

plat.install_build_dependencies_with '/usr/bin/dnf install -y --best --allowerasing'
end
41 changes: 5 additions & 36 deletions configs/projects/pdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

module_directory = File.join(proj.datadir.sub(/^.*:\//, ''), 'PowerShell', 'Modules')
proj.extra_file_to_sign File.join(module_directory, 'PuppetDevelopmentKit', 'PuppetDevelopmentKit.psm1')
proj.signing_hostname 'mozart.delivery.puppetlabs.net'
proj.signing_hostname 'composer-deb-prod-2.delivery.puppetlabs.net'
proj.signing_username 'jenkins'
proj.signing_command 'source /usr/local/rvm/scripts/rvm; rvm use 2.7.5; /var/lib/jenkins/bin/extra_file_signer'
else
Expand All @@ -56,11 +56,6 @@
'2.7.0' => ['11.1.3'],
}.tap { |h| h.default = ['9.0.6', '11.1.3'] })

default_mini_portile2 = {
version: '2.4.0',
checksum: '6bb790b78b70beb3a7f9076791ecf225',
}

proj.setting(:json_pure_component, {
'default' => {
version: "2.1.0",
Expand All @@ -72,29 +67,6 @@
}
})

proj.setting(:mini_portile2_version, {
#'2.1.0' => {
# version: '2.3.0',
# checksum: '3dca7ae71a5ac1ce2b33b5ac92ae647c',
#},
}.tap { |h| h.default = default_mini_portile2 })

# Default is >= 1.10.8 to mitigate against CVE-2020-7595.
default_nokogiri = {
version: '1.10.10',
posix_checksum: '51fabf2fab8036031579d3cb1d56500a',
win_checksum: '949abe78f08be16cb827cee0bcbaa661',
}

proj.setting(:nokogiri_version, {
# if you need to override nokogiri for a specific Ruby version:
#'2.1.0' => {
# version: '1.8.5',
# posix_checksum: 'a8ee8d3da2a686dd27bd9c2786eb2216',
# win_checksum: '2e7c07baa7db36b31f33d5a0656db649', # Checksum of nokogiri (x64-mingw32) 1.8.5 on https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources
#},
}.tap { |h| h.default = default_nokogiri })

proj.setting(:cachedir, File.join(proj.datadir, "cache"))

if platform.is_windows?
Expand All @@ -109,8 +81,7 @@
].join(':'))
end

if (platform.is_fedora? && platform.os_version.to_i >= 28) ||
(platform.is_el? && platform.os_version.to_i >= 8)
if platform.is_fedora? || (platform.is_el? && platform.os_version.to_i >= 8)
# Disable shebang mangling for certain paths inside PDK.
# See https://fedoraproject.org/wiki/Packaging:Guidelines#Shebang_lines
brp_mangle_shebangs_exclude_from = [
Expand All @@ -122,7 +93,9 @@

# Disable build-id generation since it's currently generating conflicts
# with system libgcc and libstdc++
proj.package_override("# Disable build-id generation to avoid conflicts\n%global _build_id_links none")
# proj.package_override("# Disable build-id generation to avoid conflicts\n%global _build_id_links none")
proj.package_override("# Disable the removal of la files, they are still required\n%global __brp_remove_la_files %{nil}")
proj.package_override("# Disable check-rpaths since /opt/* is not a valid path\n%global __brp_check_rpaths %{nil}")
end

def use_plgcc?(platform)
Expand Down Expand Up @@ -188,10 +161,6 @@ def use_plgcc?(platform)
proj.component "rubygem-hitimes"
proj.component "rubygem-minitar"

# nokogiri and deps
proj.component "rubygem-mini_portile2"
proj.component "rubygem-nokogiri"

# PDK
proj.component "rubygem-pdk"

Expand Down

0 comments on commit e8ee92f

Please sign in to comment.