Skip to content

Commit

Permalink
Merge branch 'main' into maint-fix_rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcmaw authored Dec 19, 2023
2 parents dc2df47 + 05d8e0a commit 7f1aa65
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 33 deletions.
23 changes: 17 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ All 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).

## [v3.0.0](https://github.com/puppetlabs/pdk/tree/v3.0.0) - 2023-07-04
## [v3.0.1](https://github.com/puppetlabs/pdk/tree/v3.0.1) - 2023-12-07

[Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.7.1...v3.0.0)
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v3.0.0...v3.0.1)

### Added
### Fixed

- (CONT-1053) Update bundle command [#1255](https://github.com/puppetlabs/pdk/pull/1255) ([chelnak](https://github.com/chelnak))
- (ISS-1123) Verbose output w/ junit file [#1246](https://github.com/puppetlabs/pdk/pull/1246) ([coreymbe](https://github.com/coreymbe))
- Take "operatingsystem_support" parameter from answer.json [#1165](https://github.com/puppetlabs/pdk/pull/1165) ([me-minus](https://github.com/me-minus))
- (CAT-345) Update doc links where needed [#1285](https://github.com/puppetlabs/pdk/pull/1285) ([david22swan](https://github.com/david22swan))
- (CAT-270) Adjusting expected Puppet/Ruby versions [#1283](https://github.com/puppetlabs/pdk/pull/1283) ([LukasAud](https://github.com/LukasAud))
- (maint) - add stricter puppetlabs_spec_helper dependency [#1280](https://github.com/puppetlabs/pdk/pull/1280) ([jordanbreen28](https://github.com/jordanbreen28))
- (PUPDOC-5439) Add Trademark icon [#1277](https://github.com/puppetlabs/pdk/pull/1277) ([pmcmaw](https://github.com/pmcmaw))

## [v3.0.0](https://github.com/puppetlabs/pdk/tree/v3.0.0) - 2023-07-04

[Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.7.1...v3.0.0)

### Changed
- (CONT-1134) Bump PDK Templates REF [#1264](https://github.com/puppetlabs/pdk/pull/1264) ([chelnak](https://github.com/chelnak))
Expand All @@ -25,6 +30,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- (CONT-755) - Bump gem version [#1240](https://github.com/puppetlabs/pdk/pull/1240) ([chelnak](https://github.com/chelnak))
- (CONT-755) Ruby 3 / Puppet 8 support [#1230](https://github.com/puppetlabs/pdk/pull/1230) ([chelnak](https://github.com/chelnak))

### Added

- (CONT-1053) Update bundle command [#1255](https://github.com/puppetlabs/pdk/pull/1255) ([chelnak](https://github.com/chelnak))
- (ISS-1123) Verbose output w/ junit file [#1246](https://github.com/puppetlabs/pdk/pull/1246) ([coreymbe](https://github.com/coreymbe))
- Take "operatingsystem_support" parameter from answer.json [#1165](https://github.com/puppetlabs/pdk/pull/1165) ([me-minus](https://github.com/me-minus))

### Fixed

- (CONT-1069) Update compatibility handling [#1259](https://github.com/puppetlabs/pdk/pull/1259) ([chelnak](https://github.com/chelnak))
Expand Down
13 changes: 8 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
## Reporting Bugs

We welcome error reports and patches to the PDK repository.
If you have discovered an issue, please raise it here: https://github.com/puppetlabs/pdk/issues
PRs to resolve issues discovered are greatly appreciated - please start a Discussion [here](https://github.com/puppetlabs/pdk/discussions) or post a question to [[email protected]](https://groups.google.com/forum/#!forum/puppet-users).
If you have discovered an issue, you can raise it [here](https://github.com/puppetlabs/pdk/issues) or reach out to us directly on the [Puppet Community Slack](https://slack.puppet.com/).

In addition if there is something that you do not understand, or a point that you wish to clarify you can start a Discussion [here](https://github.com/puppetlabs/pdk/discussions) or post a question to [[email protected]](https://groups.google.com/forum/#!forum/puppet-users).

Finally if you have a fix for an issue you can open a PR to resolve it [here](https://github.com/puppetlabs/pdk/pulls).

## Raising Feature Requests

Feature requests are also welcome.
To raise a request, please start a ['Feature Request' Discussion](https://github.com/puppetlabs/pdk/discussions/categories/feature-request).
After there is consensus on how to proceed, a Discussion will be converted in to a Feature Issue and prioritized, accordingly.
Once there is consensus on how to proceed, we can then create a ticket for our backlog and plan for bringing it in to a future sprint.

# Running from source

If you need to run `pdk` in a working directory outside the cloned repository, either set `BUNDLE_GEMFILE` to the pdk's Gemfile location, or install and use the [binstubs of bundler](http://bundler.io/v1.15/bundle_binstubs.html). These binstubs are small proxy binaries that set up the environment for running the tool.
If you need to run `pdk` in a working directory outside the cloned repository, either set `BUNDLE_GEMFILE` to the pdk's Gemfile location, or install and use the [binstubs of bundler](http://bundler.io/bundle_binstubs.html). These binstubs are small proxy binaries that set up the environment for running the tool.

```
# assuming ~/bin is already on your path:
Expand Down Expand Up @@ -70,7 +73,7 @@ Environment Variable | Usage
*--or--* |
**LOCAL_PKG** | Full path to a locally built package that you want to test.
**TEST_TARGET** | A beaker-hostgenerator string for the OS of the VM you want to test on e.g. _redhat7-64workstation._ or _windows2012r2-64workstation._ (The period character after workstation is required by beaker-hostgenerator).
**BUILD_SERVER** | (Defaults to 'builds.delivery.puppetlabs.net' if not set) (Only required if testing a SHA on a Windows VM). The hostname of the build server that hosts packages. A Puppet JIRA ticket ([BKR-1109](https://tickets.puppetlabs.com/browse/BKR-1109)) has been filed to update beaker so this would never be required.
**BUILD_SERVER** | (Defaults to 'builds.delivery.puppetlabs.net' if not set) (Only required if testing a SHA on a Windows VM). The hostname of the build server that hosts packages.
**SUITE_VERSION** | (If not set, will be automatically determined if possible) The build tag/version string used when installing packages on certain platforms - e.g. if the package you built is `pdk-0.5.0.0.21.gb84d40e-1.osx10.12.dmg` then **SUITE_VERSION** would be `0.5.0.0.21.gb84d40e`

# Release Process
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ group :acceptance do
end

group :acceptance_ci do
gem 'puppetlabs_spec_helper', '~> 6.0', require: false
gem 'puppetlabs_spec_helper', '~> 7.0', require: false
end
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ This command validates the metadata, Puppet code syntax and style, and Ruby synt

### Run unit tests

PDK's [default template](https://github.com/puppetlabs/pdk-templates) sets up [rspec](http://rspec.info/) for Ruby-level unit testing, and [rspec-puppet](https://github.com/rodjek/rspec-puppet/) for catalog-level unit testing.
PDK's [default template](https://github.com/puppetlabs/pdk-templates) sets up [rspec](http://rspec.info/) for Ruby-level unit testing, and [rspec-puppet](https://github.com/puppetlabs/rspec-puppet/) for catalog-level unit testing.

In the module's directory, run unit tests with:

Expand All @@ -116,6 +116,10 @@ This command runs all available unit tests.

PDK encourages community contributions. See the [CONTRIBUTING.md](CONTRIBUTING.md) file for development notes.

## License

This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.

## Contact Information

* [For reporting bugs](https://github.com/puppetlabs/pdk/blob/main/CONTRIBUTING.md#reporting-bugs)
Expand Down
2 changes: 1 addition & 1 deletion docs/pdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ validate, and test modules.
<ul>
<li><a class="xref" href="https://github.com/puppetlabs/puppet-lint" target="_blank">puppet-lint</a>, included in PDK, validates Puppet code against the recommended language style guide.</li>
<li><a class="xref" href="https://github.com/voxpupuli/metadata-json-lint" target="_blank">metadata-json-lint</a>, included in PDK, validates your module metadata file.</li>
<li><a class="xref" href="http://rspec-puppet.com/" target="_blank">rspec-puppet</a>, included in PDK, provides an RSpec test framework for Puppet.</li>
<li><a class="xref" href="http://rspec-puppet.com/" target="_blank">puppetlabs-rspec</a>, included in PDK, provides an RSpec test framework for Puppet.</li>
<li><a class="xref" href="https://github.com/voxpupuli/rspec-puppet-facts" target="_blank">rspec-puppet-facts</a>, included in PDK, provides support for running rspec tests for your module's supported operating systems.</li>
<li><a class="xref" href="https://rubocop.org/" target="_blank">Rubocop</a>, a Ruby code analyzer.</li>
<li><a class="xref" href="https://www.youtube.com/watch?v=GgNrxLfoDF8" target="_blank">Introduction to testing Puppet code</a>: a talk by David Schmitt.</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/pdk_building_module_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `pdk build` command performs a series of checks on your module and builds a
`tar.gz` package so that you can upload your module to the Forge. To learn more
about publishing your module to the Forge, see the documentation about
[publishing your
module](https://www.puppet.com/docs/puppet/latest/modules_publishing.html#modules_publishing_prep-publishing-remove-symlinks)
module](https://www.puppet.com/docs/puppet/latest/modules_publishing.html).

When you run the `pdk build` command, PDK checks your module metadata, looks for
any symlinks, and excludes from the package any files listed in the `.gitignore`
Expand Down
2 changes: 1 addition & 1 deletion docs/pdk_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ By default, PDK installs to the following locations:

PDK uses the latest versions of Puppet 7 and 8 available at the time of release.
Modules created with PDK work with all Puppet and Ruby version combinations currently under maintenance.
See [open source Puppet](https://puppet.com/docs/puppet/latest/about_agent.html) and
See the [open source Puppet](https://puppet.com/docs/puppet/latest/about_agent.html) and
[Puppet Enterprise](https://www.puppet.com/docs/pe/2023.0/getting_support_for_pe.html#getting_support_for_pe) lifecycle pages for details.

PDK functions, such as creating classes, testing, and validation, are supported only on modules created or converted with PDK.
Expand Down
4 changes: 2 additions & 2 deletions docs/pdk_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ topic.
|--------|-----------|------|-------|
|`<module_name>`|Required. Specifies the name of the module being created.|A module name beginning with a lowercase letter and including only lowercase letters, digits, and underscores.|No default.|
|`--full-interview`|Include interview questions related to publishing modules on the Forge to create module metadata.|None.|If not specified, PDK asks only basic module metadata questions. |
|`--license=<IDENTIFIER>`|Specifies the license for this module is written under.|See the [SPDX](https://spdx.org) License List for a list of open source licenses, or use `proprietary`.|`Apache-2.0`|
|`--license=<IDENTIFIER>`|Specifies the license for this module is written under.|See the [SPDX](https://spdx.org/licenses/) License List for a list of open source licenses, or use `proprietary`.|`Apache-2.0`|
|`--skip-interview`|Skip interview questions and use default values to create module metadata.|None.|If not specified, PDK asks basic module metadata questions.|
|`<TARGET_DIR>`|Specifies the directory that the new module will be created in.|A valid directory path.|Creates a directory with the given `module_name` inside the current directory.|
|`--template-ref=<VALUE>`|Specifies the reference to use for the specified template for this module. This option is valid only if you have specified a template with the `--template-url` option.|A template branch name, tag name, or commit SHA for the specified template.|If you have specified a custom template, or if you installed PDK as a gem, this option defaults to "main". Otherwise, defaults to the defaults to the currently installed PDK version.|
Expand Down Expand Up @@ -420,7 +420,7 @@ topic.
|`--puppet-dev`|When specified, PDK runs unit tests against the current Puppet source from GitHub. To use this option, you must have network access to https://github.com. You cannot specify `--puppet-dev` together with the `--puppet-version=` options.|None.|If not specified, PDK runs unit tests against default values or those specified by `--puppet-version`.|
|`--puppet-version`|Specifies the Puppet gem version to run unit tests against.|A string indicating the Puppet version to test against, such as "5.4.2" or "5.5".|If not specified, tests against the most recent compatible Puppet version included in the PDK package.|
|`--tests=<TEST_LIST>`|A comma-separated list of tests to run. Use this during development to pinpoint a single failing test.|See the `--list` output for available values.|No default.|
|`--verbose`|When specified, PDK outputs a single line description for each test as the test is executed. This option uses the RSpec `documentation` format. For more information, see [RSpec Core 2.5](https://relishapp.com/rspec/rspec-core/v/2-5/docs/command-line/format-option#documentation-format).|None.|None.|
|`--verbose`|When specified, PDK outputs a single line description for each test as the test is executed. This option uses the RSpec `documentation` format. For more information, see [RSpec Core Formatters](https://rubydoc.info/gems/rspec-core/RSpec/Core/Formatters).|None.|None.|
## `pdk update` command
Expand Down
8 changes: 4 additions & 4 deletions docs/pdk_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ By default, the PDK module template includes tools that can:


If you are working behind a proxy, before you begin, ensure that you've added
the correct environment variables. See [Running PDK behind a
proxy](pdk_install.md#running-pdk-behind-a-proxy) for details.
the correct environment variables. See [Setting up PDK behind a
proxy](pdk_install.md#setting-up-pdk-behind-a-proxy) for details.

To ensure that your module works with Puppet, validate and unit test your
modules against specific versions of Puppet and Puppet Enterprise. This allows
Expand All @@ -33,7 +33,7 @@ examples, see the unit testing and validation topics below.
You can validate or test against any version of Puppet or PE that is currently
under maintenance. See [open source
Puppet](https://docs.puppet.com/puppet/latest/about_agent.html) and [Puppet
Enterprise](https://puppet.com/docs/pe/2017.3/overview/getting_support_for_pe.html#supported-puppet-enterprise-versions)
Enterprise](https://www.puppet.com/products/puppet-enterprise/support-lifecycle)
lifecycle pages for details.

## Validating modules
Expand Down Expand Up @@ -176,7 +176,7 @@ For more information about RSpec and writing unit tests, see:
- [RSpec](http://rspec.info/)
- [rspec-puppet](https://github.com/rodjek/rspec-puppet/)
- [rspec-puppet](https://github.com/puppetlabs/rspec-puppet/)
- [Puppet spec helper](https://github.com/puppetlabs/puppetlabs_spec_helper)
Expand Down
8 changes: 8 additions & 0 deletions docs/release_notes_pdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

New features, enhancements, and resolved issues for PDK.

## PDK 3.0.1

### New features and enhancements

* Updated various dependencies
* Added stricter puppetlabs_spec_helper dependency
* Minor adjustments to our documentation

## PDK 3.0.0

> PDK 3.0 is a backwards incompatible release.
Expand Down
2 changes: 2 additions & 0 deletions lib/pdk/config/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def include_in_parent?
# @api private
def read_only!
@read_only = true
# pass the read_only! method as a block to the each_value method. This means that
# for each value in the @mounts hash, the read_only! method will be called on that value.
@mounts.each_value(&:read_only!)
end

Expand Down
8 changes: 6 additions & 2 deletions lib/pdk/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ def write_junit(target = self.class.default_target)
# This report is designed for interactive use by a human and so excludes
# all passing events in order to be consise.
#
# @param target [#write] an IO object that the report will be written to.
# Defaults to PDK::Report.default_target.
# @param target [String, IO] The IO target to write the report to.
# If a String is provided, the report will be written to a file with the given path.
# If an IO object is provided, the report will be written to the IO object.
# If no target is provided, the default target PDK::Report.default_target will be used.
#
# @return [void]
def write_text(target = self.class.default_target)
coverage_report = nil
report = []
Expand Down
4 changes: 4 additions & 0 deletions lib/pdk/util/puppet_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def find_in_rubygems(requirement)
version.nil? ? nil : { gem_version: version, ruby_version: PDK::Util::RubyVersion.default_ruby_version }
end

# Finds the specified requirement in the package cache.
#
# @param requirement [Gem::Requirement] The requirement to search for.
# @return [Hash] A hash containing the gem version and ruby version if found, or nil if not found.
def find_in_package_cache(requirement)
require 'pdk/util/ruby_version'

Expand Down
4 changes: 2 additions & 2 deletions lib/pdk/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PDK
VERSION = '3.0.0'.freeze
TEMPLATE_REF = '3.0.0'.freeze
VERSION = '3.0.1'.freeze
TEMPLATE_REF = '3.0.1'.freeze
end
4 changes: 2 additions & 2 deletions package-testing/spec/package/airgapped_usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
end

context 'when validating the module' do
context 'with puppet 7.x' do
puppet_version = '7.x'
context 'with puppet 8.x' do
puppet_version = '8.x'
let(:ruby_version) { ruby_for_puppet(puppet_version) }

describe command("pdk validate --puppet-version=#{puppet_version}") do
Expand Down
1 change: 1 addition & 0 deletions package-testing/spec/package/support/spec_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def ruby_for_puppet(pupver)
when /^5\./ then '2.4.*'
when /^6\./ then '2.5.*'
when /^7\./ then '2.7.*'
when /^8\./ then '3.2.*'
end

return unless ruby_pattern
Expand Down
4 changes: 2 additions & 2 deletions package-testing/spec/package/validate_a_new_module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
end

context 'when validating the module' do
context 'with puppet 7.x' do
puppet_version = '7.x'
context 'with puppet 8.x' do
puppet_version = '8.x'
let(:ruby_version) { ruby_for_puppet(puppet_version) }

describe command("pdk validate --puppet-version=#{puppet_version}") do
Expand Down
6 changes: 3 additions & 3 deletions package-testing/spec/package/version_selection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

describe 'Test puppet & ruby version selection' do
module_name = 'version_selection'
# IMPORTANT: The following block should be updated with the latest version of each major release supported for the
# IMPORTANT: The following block should be updated with the latest version of each release supported for the
# test cases to pass. If you are running integration testing prior to a release and its failing due to missing Puppet
# gems, verify that the following versions are correct.
test_cases = [
{ envvar: 'PDK_PUPPET_VERSION', version: '7.26.0', expected_puppet: '7.26.0', expected_ruby: '2.7.8' },
{ envvar: 'PDK_PUPPET_VERSION', version: '8.2.0', expected_puppet: '8.2.0', expected_ruby: '3.2.2' }
{ envvar: 'PDK_PUPPET_VERSION', version: '7.27.0', expected_puppet: '7.27.0', expected_ruby: '2.7.8' },
{ envvar: 'PDK_PUPPET_VERSION', version: '8.3.1', expected_puppet: '8.3.1', expected_ruby: '3.2.2' }
]

before(:all) do
Expand Down

0 comments on commit 7f1aa65

Please sign in to comment.