Skip to content

Commit

Permalink
Feature uplift puppet8 (#2)
Browse files Browse the repository at this point in the history
* Update module, bump pdk version

* Fix origin pe primary variable

* added optional to origin_pe_primary_server

* Fix variable line 175

* Update fail_plan pe_primary target.

* Update change log
  • Loading branch information
benjamin-robertson authored Oct 28, 2024
1 parent ee26029 commit c975c2e
Show file tree
Hide file tree
Showing 16 changed files with 268 additions and 137 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: "Lint testing"

on:
pull_request:
branches:
- "main"

jobs:
setup_matrix:
name: "Setup Test Matrix"
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}

steps:
- name: Checkout Source
uses: actions/checkout@v3

- name: Activate Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.3"
bundler-cache: true

- name: Print bundle environment
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: Setup Integration Test Matrix
id: get-matrix
run: |
echo "matrix=$(cat test_matrix.json | tr -s '\n' ' ')" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
lint:
name: "Lint tests (${{matrix.collection.agent_version}})"
needs:
- setup_matrix
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}

runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}

env:
PUPPET_GEM_VERSION: ${{matrix.collection.gem_version}}
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?

steps:
- name: Checkout Source
uses: actions/checkout@v3

- name: Activate Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.3"
bundler-cache: true

- name: Print bundle environment
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Run tests"
run: |
bundle exec rake validate
71 changes: 71 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: "Unit Testing"

on:
pull_request:
branches:
- "main"

jobs:
setup_matrix:
name: "Setup Test Matrix"
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}

steps:
- name: Checkout Source
uses: actions/checkout@v3

- name: Activate Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.3"
bundler-cache: true

- name: Print bundle environment
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: Setup Integration Test Matrix
id: get-matrix
run: |
echo "matrix=$(cat test_matrix.json | tr -s '\n' ' ')" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
Unit:
name: "Unit tests (${{matrix.collection.agent_version}})"
needs:
- setup_matrix
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}

runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}

env:
PUPPET_GEM_VERSION: ${{matrix.collection.gem_version}}
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?

steps:
- name: Checkout Source
uses: actions/checkout@v3

- name: Activate Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.3"
bundler-cache: true

- name: Print bundle environment
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Run tests"
run: |
bundle exec rake parallel_spec
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
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require:
- rubocop-performance
- rubocop-rspec
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: '2.6'
Include:
Expand Down Expand Up @@ -527,6 +528,8 @@ Lint/DuplicateBranch:
Enabled: false
Lint/DuplicateMagicComment:
Enabled: false
Lint/DuplicateMatchPattern:
Enabled: false
Lint/DuplicateRegexpCharacterClassElement:
Enabled: false
Lint/EmptyBlock:
Expand Down Expand Up @@ -643,6 +646,8 @@ Style/ComparableClamp:
Enabled: false
Style/ConcatArrayLiterals:
Enabled: false
Style/DataInheritance:
Enabled: false
Style/DirEmpty:
Enabled: false
Style/DocumentDynamicEvalDefinition:
Expand Down Expand Up @@ -711,6 +716,8 @@ Style/RedundantHeredocDelimiterQuotes:
Enabled: false
Style/RedundantInitialize:
Enabled: false
Style/RedundantLineContinuation:
Enabled: false
Style/RedundantSelfAssignmentBranch:
Enabled: false
Style/RedundantStringEscape:
Expand Down
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"
]
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file.

## Release 1.0.0

**Features**

- Added support Puppet 8.
- Migrate_node plan will now automatically locate the origin primary server.
- Added lint test to github actions.

## Release 0.1.0

**Features**
Expand Down
23 changes: 14 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,30 @@ group :development do
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
gem "metadata-json-lint", '~> 4.0', require: false
gem "rspec-puppet-facts", '~> 4.0', require: false
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 "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "rexml", '>= 3.0.0', '< 3.2.7', require: false
end
group :development, :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
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

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ Include the module within your Puppetfile.
Run the plan **migrate_nodes::migrate_node** from the Puppet Enterprise console.

**Required parameters**
- origin_pe_primary_server (String - Puppet Primary server the node is being migrated from. Must match Primary server FQDN(Certname))
- target_pe_address (Array/Sting - either compiler address or FQDN of Primary server. Use array to specify multiple compilers.)

**Optional parameters**
- targets (TargetSpec - [see here](https://www.puppet.com/docs/bolt/latest/bolt_types_reference.html#targetspec))
- origin_pe_primary_server (String - Puppet Primary server the node is being migrated from. Must match Primary server FQDN(Certname))
- fact_name (String)
- fact_value (String)
- ignore_infra_status_error (Boolean - Ignore errors from puppet infrastructure status command. May allow the plan to operate if some Puppet infrastructure components are failing)
Expand All @@ -64,10 +64,13 @@ Verified with the following OS\Primary combinations.
Puppet Enterprise

* 2021.7.6
* 2021.7.9
* 2023.8.0

Puppet Nodes

* Windows 2019
* Windows 2022
* RHEL 8
* RHEL 9

Expand Down
Loading

0 comments on commit c975c2e

Please sign in to comment.