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
8 changes: 8 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ jobs:
run: sudo -E /opt/puppetlabs/pdk/bin/pdk bundle install
- name: Run acceptance tests
run: sudo -E /opt/puppetlabs/pdk/bin/pdk bundle exec rake litmus:acceptance:localhost

typos:
name: typos
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: crate-ci/typos@v1.38.1
55 changes: 29 additions & 26 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
require:
plugins:
- rubocop-performance
- rubocop-rspec
- rubocop-rspec_rails
- rubocop-factory_bot
- rubocop-capybara
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: 3.1
TargetRubyVersion: 2.7
Include:
- "**/*.rb"
Exclude:
Expand Down Expand Up @@ -130,6 +133,12 @@ Capybara/CurrentPathExpectation:
Enabled: false
Capybara/VisibilityMatcher:
Enabled: false
FactoryBot/AttributeDefinedStatically:
Enabled: false
FactoryBot/CreateList:
Enabled: false
FactoryBot/FactoryClassName:
Enabled: false
Gemspec/DuplicatedAssignment:
Enabled: false
Gemspec/OrderedDependencies:
Expand Down Expand Up @@ -304,8 +313,6 @@ Performance/UriDefaultParser:
Enabled: false
RSpec/Be:
Enabled: false
RSpec/Capybara/FeatureMethods:
Enabled: false
RSpec/ContainExactly:
Enabled: false
RSpec/ContextMethod:
Expand All @@ -314,6 +321,8 @@ RSpec/ContextWording:
Enabled: false
RSpec/DescribeClass:
Enabled: false
RSpec/Dialect:
Enabled: false
RSpec/EmptyHook:
Enabled: false
RSpec/EmptyLineAfterExample:
Expand All @@ -330,12 +339,6 @@ RSpec/ExpectChange:
Enabled: false
RSpec/ExpectInHook:
Enabled: false
RSpec/FactoryBot/AttributeDefinedStatically:
Enabled: false
RSpec/FactoryBot/CreateList:
Enabled: false
RSpec/FactoryBot/FactoryClassName:
Enabled: false
RSpec/HooksBeforeExamples:
Enabled: false
RSpec/ImplicitBlockExpectation:
Expand Down Expand Up @@ -510,6 +513,12 @@ Capybara/SpecificFinders:
Enabled: false
Capybara/SpecificMatcher:
Enabled: false
FactoryBot/ConsistentParenthesesStyle:
Enabled: false
FactoryBot/FactoryNameStyle:
Enabled: false
FactoryBot/SyntaxMethods:
Enabled: false
Gemspec/DeprecatedAttributeAssignment:
Enabled: false
Gemspec/DevelopmentDependencies:
Expand Down Expand Up @@ -610,28 +619,12 @@ RSpec/DuplicatedMetadata:
Enabled: false
RSpec/ExcessiveDocstringSpacing:
Enabled: false
RSpec/FactoryBot/ConsistentParenthesesStyle:
Enabled: false
RSpec/FactoryBot/FactoryNameStyle:
Enabled: false
RSpec/FactoryBot/SyntaxMethods:
Enabled: false
RSpec/IdenticalEqualityAssertion:
Enabled: false
RSpec/NoExpectationExample:
Enabled: false
RSpec/PendingWithoutReason:
Enabled: false
RSpec/Rails/AvoidSetupHook:
Enabled: false
RSpec/Rails/HaveHttpStatus:
Enabled: false
RSpec/Rails/InferredSpecType:
Enabled: false
RSpec/Rails/MinitestAssertions:
Enabled: false
RSpec/Rails/TravelAround:
Enabled: false
RSpec/RedundantAround:
Enabled: false
RSpec/SkipBlockInsideExample:
Expand All @@ -642,6 +635,16 @@ RSpec/SubjectDeclaration:
Enabled: false
RSpec/VerifiedDoubleReference:
Enabled: false
RSpecRails/AvoidSetupHook:
Enabled: false
RSpecRails/HaveHttpStatus:
Enabled: false
RSpecRails/InferredSpecType:
Enabled: false
RSpecRails/MinitestAssertions:
Enabled: false
RSpecRails/TravelAround:
Enabled: false
Security/CompoundHash:
Enabled: false
Security/IoMethods:
Expand Down
10 changes: 10 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configure https://github.com/crate-ci/typos
[default.extend-words]
"facter" = "facter"

[default]
extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*typos:ignore-line$",
"(?s)(#|//)\\s*typos:ignore-start.*?\\n\\s*(#|//)\\s*typos:ignore-end",
"(#|//)\\s*typos:ignore-next-line\\n.*"
]
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
* Synced with [PDK][] and disabled Puppet 6 testing, since the package signing
key is no longer valid.
* Switched to Ruby 3.1 for automated testing since PDK no longer supports 2.7.
* Fixed a few spelling mistakes.

[PDK]: https://www.puppet.com/docs/pdk/latest/pdk.html

Expand Down Expand Up @@ -53,7 +54,7 @@ GitHub security advisory: [GHSA-8h8m-h98f-vv84]
### Changes

As part of the security fix mentioned above, it became necessary to be more
agressive about ensuring that the owner and group of files in the installation
aggressive about ensuring that the owner and group of files in the installation
are correct. dp-golang now deletes and recreates any Go installation it finds
that has a file or directory with the wrong owner or group.

Expand Down
11 changes: 8 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ group :development do
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.6', 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 "rubocop", '~> 1.73.0', require: false
gem "rubocop-performance", '~> 1.24.0', require: false
gem "rubocop-rspec", '~> 3.5.0', require: false
gem "rubocop-rspec_rails", '~> 2.31.0', require: false
gem "rubocop-factory_bot", '~> 2.27.0', require: false
gem "rubocop-capybara", '~> 2.22.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw]
end
Expand All @@ -71,10 +74,12 @@ group :system_tests do
end

gems = {}
bolt_version = ENV.fetch('BOLT_GEM_VERSION', nil)
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['bolt'] = location_for(bolt_version, nil, { source: gemsource_puppetcore })
gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore })
gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore })
gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This [Puppet][] module has sane defaults to keep a standard installation simple,
but is flexible enough to support automatic updates, multiple installations of
diferent versions, and running [Puppet as a non-root user][non-root].
different versions, and running [Puppet as a non-root user][non-root].

[Puppet]: https://github.com/puppetlabs/puppet
[non-root]: #running-puppet-as-a-non-root-user
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Functions

* [`golang::latest_version`](#golang--latest_version): Get the lastest stable version number for Go
* [`golang::latest_version`](#golang--latest_version): Get the latest stable version number for Go
* [`golang::state_file`](#golang--state_file): Figure out the default state file path for a given `$go_dir`

### Data types
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/functions/golang/latest_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'net/http'
require 'uri'

# @summary Get the lastest stable version number for Go
# @summary Get the latest stable version number for Go
#
# Makes a request to the passed URL to find the latest stable version of Go. The
# request will be cached for 10 minutes, so repeated calls to this function will
Expand All @@ -31,7 +31,7 @@ def latest_version(url)
if !@@golang_latest_version_cache[url] \
|| time - @@golang_latest_version_cache[url][:time] >= 600
@@golang_latest_version_cache[url] = {
time:,
time: time,
version: load_latest_version(url),
}
end
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@
],
"pdk-version": "3.4.0",
"template-url": "https://github.com/danielparks/pdk-templates#main",
"template-ref": "heads/main-0-g1e26f60"
"template-ref": "heads/main-0-g8b32367"
}
16 changes: 8 additions & 8 deletions release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def fix_links(root, path)
IO.write(path, lines.join(''))
end

# Huge kludge. Only works on unorderd lists at the moment.
# Huge kludge. Only works on unordered lists at the moment.
def unwrap_markdown!(md)
while md.gsub!(%r{^( *)([*+-])( +\S.+?)\n\1 +([^ *+-])}, '\1\2\3 \4')
end
Expand Down Expand Up @@ -273,8 +273,8 @@ def confirm_no_changes
end

run('git', 'commit', '-m', "Release #{version}: #{summary.chomp('.')}.",
dry_run:)
run('git', 'tag', "v#{version}", '-sm', <<~MSG.chomp, dry_run:)
dry_run: dry_run)
run('git', 'tag', "v#{version}", '-sm', <<~MSG.chomp, dry_run: dry_run)
#{version}: #{summary}

#{release_notes}
Expand All @@ -283,10 +283,10 @@ def confirm_no_changes
update_for_forge(metadata)

run('pdk', 'build', '--force')
run('pdk', 'release', 'publish', dry_run:)
run('pdk', 'release', 'publish', dry_run: dry_run)

# Reset Forge-specific changes
run('git', 'restore', '.', dry_run:)
run('git', 'restore', '.', dry_run: dry_run)

# Add "## main branch" header to CHANGELOG.md
insert_main_branch_header!(changelog)
Expand All @@ -295,10 +295,10 @@ def confirm_no_changes

run('git', 'add', 'CHANGELOG.md')
run('git', 'commit', '-m', 'Add “## main branch” header back to CHANGELOG.md.',
dry_run:)
dry_run: dry_run)

# Push release to GitHub
run('git', 'push', '--tags', 'origin', 'main', dry_run:)
run('git', 'push', '--tags', 'origin', 'main', dry_run: dry_run)

unwrap_markdown!(release_notes)

Expand All @@ -307,4 +307,4 @@ def confirm_no_changes
'--notes', release_notes,
"v#{version}",
Dir["pkg/*-#{version}.tar.gz"].first,
dry_run:)
dry_run: dry_run)
2 changes: 1 addition & 1 deletion spec/classes/golang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'golang' do
let(:pre_condition) { <<~'PUPPET' }
# Overide golang::latest_version to avoid dependence on https://go.dev.
# Override golang::latest_version to avoid dependence on https://go.dev.
function golang::latest_version($_url) { '1.0.0' }

# Make deprecations testable with rspec-puppet.
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/installation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'golang::installation' do
let(:pre_condition) { <<~'PUPPET' }
# Overide golang::latest_version to avoid dependence on https://go.dev.
# Override golang::latest_version to avoid dependence on https://go.dev.
function golang::latest_version($_url) { '1.0.0' }
PUPPET

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

begin
require 'deep_merge'
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
default_facts.deep_merge!(YAML.safe_load_file(f, permitted_classes: [], permitted_symbols: [], aliases: true))
rescue StandardError => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
Expand Down