Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: 'Syntax validation'
runs-on: ubuntu-latest
timeout-minutes: 10
container: puppet/pdk:3.0.0.0
container: puppet/pdk:3.4.0.1.55.g4519dd0
steps:
- uses: actions/checkout@v4
- name: Run static validations
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
# container: puppet/puppet-dev-tools:4.x
container: puppet/pdk:3.0.0.0
container: puppet/pdk:3.4.0.1.55.g4519dd0
steps:
- uses: actions/checkout@v4
- name: Run unit tests on Puppet 8
Expand All @@ -39,7 +39,7 @@ jobs:
name: 'Unit tests Legacy Puppet'
runs-on: ubuntu-latest
timeout-minutes: 60
container: puppet/puppet-dev-tools:4.x
container: puppet/pdk:3.4.0.1.55.g4519dd0
steps:
- uses: actions/checkout@v4
- name: Run unit tests on Puppet 6
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
name: 'Deploy to forge'
runs-on: ubuntu-latest
if: github.repository_owner == 'example42'
container: puppet/pdk:2.6.1.0
container: puppet/pdk:3.4.0.1.55.g4519dd0
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "PDK Build"
uses: docker://puppet/pdk:2.6.1.0
uses: docker://puppet/pdk:3.4.0.1.55.g4519dd0
with:
args: 'build'
- name: "Push to Forge"
uses: docker://puppet/pdk:2.6.1.0
uses: docker://puppet/pdk:3.4.0.1.55.g4519dd0
with:
args: 'release publish --forge-token ${{ secrets.PUPPET_FORGE_API_KEY }} --force'

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
/spec/fixtures/modules/*
/tmp/
/vendor/
/.vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
8 changes: 8 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@
/spec/fixtures/modules/*
/tmp/
/vendor/
/.vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
/.fixtures.yml
/Gemfile
/.gitattributes
/.github/
/.gitignore
/.pdkignore
/.puppet-lint.rc
Expand Down
9 changes: 8 additions & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
--fail-on-warnings
--relative
--no-parameter_documentation-check
--no-80chars-check
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-autoloader_layout-check
--no-documentation-check
--no-single_quote_string_with_variables-check
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"puppet.puppet-vscode",
"rebornix.Ruby"
"Shopify.ruby-lsp"
]
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

## Release 1.1.1

- A few more puppet 8 fixes
- Actions updates

## Release 1.1.0

- More updates for full Puppet 8 compatibility
Expand Down
55 changes: 31 additions & 24 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,53 @@ def location_for(place_or_version, fake_version = nil)
end

group :development do
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "deep_merge", '~> 1.2.2', require: false
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
gem "facterdb", '~> 1.18', require: false
gem "metadata-json-lint", '~> 3.0', require: false
gem "puppetlabs_spec_helper", '~> 6.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "codecov", '~> 0.2', require: false
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "metadata-json-lint", '~> 4.0', require: false
gem "json-schema", '< 5.1.1', require: false
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "dependency_checker", '~> 1.0.0', require: false
gem "parallel_tests", '= 3.12.1', require: false
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.5', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "rubocop", '= 1.48.1', require: false
gem "rubocop", '~> 1.50.0', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "puppet-strings", '~> 2.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
end
#group :system_tests do
# gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
# gem "serverspec", '~> 2.41', require: false
#end

puppet_version = ENV['PUPPET_GEM_VERSION']
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']
group :development, :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 8.0', require: false
gem "puppet-blacksmith", '~> 7.0', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end

gems = {}
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)

gems['puppet'] = location_for(puppet_version)

# If facter or hiera versions have been specified via the environment
# variables
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
# Otherwise, do as before and use location_for to fetch gems from the default source
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
else
gems['puppet'] = location_for(puppet_version)
gems['facter'] = location_for(facter_version) if facter_version
end

gems['facter'] = location_for(facter_version) if facter_version
gems['hiera'] = location_for(hiera_version) if hiera_version

gems.each do |gem_name, gem_params|
Expand Down
86 changes: 8 additions & 78 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,15 @@ require 'bundler'
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator'
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'

def changelog_user
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator user:#{returnVal}"
returnVal
end

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"

returnVal = nil
returnVal ||= begin
metadata_source = JSON.load(File.read('metadata.json'))['source']
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})

metadata_source_match && metadata_source_match[1]
end

raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?

puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
end

PuppetLint.configuration.send('disable_relative')


if Gem.loaded_specs.key? 'github_changelog_generator'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
config.user = "#{changelog_user}"
config.project = "#{changelog_project}"
config.future_release = "#{changelog_future_release}"
config.exclude_labels = ['maintenance']
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
config.add_pr_wo_labels = true
config.issues = false
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
config.configure_sections = {
"Changed" => {
"prefix" => "### Changed",
"labels" => ["backwards-incompatible"],
},
"Added" => {
"prefix" => "### Added",
"labels" => ["enhancement", "feature"],
},
"Fixed" => {
"prefix" => "### Fixed",
"labels" => ["bug", "documentation", "bugfix"],
},
}
end
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
The changelog tasks depends on recent features of the github_changelog_generator gem.
Please manually add it to your .sync.yml for now, and run `pdk update`:
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
version: '~> 1.15'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
EOM
end
end
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_autoloader_layout')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]

4 changes: 2 additions & 2 deletions docs/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ and manage proxy settings with:
password: xxx # Optional
no_proxy:
- localhost
- "%{::domain}"
- "%{::fqdn}"
- "%{facts.networking.domain}"
- "%{facts.networking.fqdn}"
scheme: http

You can customise the components for which proxy should be configured, here are the default params:
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
# password: xxx # Optional
# no_proxy:
# - localhost
# - "%{::domain}"
# - "%{facts.networking.domain}"
# scheme: http
#
# @example Define arbitrary resources, with some defaults
Expand Down
2 changes: 1 addition & 1 deletion manifests/puppet/postrun.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
noop($noop_value)
}

$manage_content = tp_content($content, $template, $epp)
$manage_content = tp::content($content, $template, $epp)

File {
owner => 'root',
Expand Down
2 changes: 1 addition & 1 deletion manifests/services/init_script.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Optional[String] $service_ensure = undef,
Variant[Undef,Boolean,String] $service_enable = undef,
) {
$manage_content = tp_content($content, $template, $epp)
$manage_content = tp::content($content, $template, $epp)
file { "/etc/init.d/${title}":
ensure => $ensure,
content => $manage_content,
Expand Down
2 changes: 1 addition & 1 deletion manifests/services/systemd_script.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Optional[String] $systemd_after = 'network.target', # lint:ignore:optional_default
Optional[String] $systemd_before = undef,
) {
$manage_content = tp_content($content, $template, $epp)
$manage_content = tp::content($content, $template, $epp)
file { $path:
ensure => $ensure,
content => $manage_content,
Expand Down
6 changes: 1 addition & 5 deletions manifests/tools/create_dir.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
Optional[String] $group = undef,
Optional[Stdlib::Filemode] $mode = undef,
Stdlib::AbsolutePath $path = $title,
Optional[String] $command_provider = undef,
) {
$mkdir_command = $facts['os']['family'] ? {
'windows' => "New-Item -ItemType Directory -Force -Path '${path}'",
default => "mkdir -p '${path}'",
}
$command_provider = $facts['os']['family'] ? {
'windows' => 'powershell',
default => undef,
}

exec { "Create directory ${title}":
command => $mkdir_command,
path => $facts['path'],
Expand Down
Loading
Loading