Showing with 1,436 additions and 228 deletions.
  1. +2 −0 .gitattributes
  2. +67 −0 .github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml
  3. +48 −0 .github/workflows/static_code_analysis.yaml
  4. +43 −0 .github/workflows/task_acceptance_tests.yaml
  5. +58 −0 .github/workflows/unit_tests_with_nightly_puppet_gem.yaml
  6. +47 −0 .github/workflows/unit_tests_with_released_puppet_gem.yaml
  7. +613 −11 .rubocop.yml
  8. +0 −47 .travis.yml
  9. +18 −0 CHANGELOG.md
  10. +28 −24 Gemfile
  11. +21 −7 README.markdown
  12. +2 −6 Rakefile
  13. +1 −1 acceptance/Gemfile
  14. +6 −1 acceptance/Rakefile
  15. +6 −2 acceptance/helpers.rb
  16. +11 −6 acceptance/tests/test_upgrade_puppet5_to_puppet6.rb
  17. +14 −9 acceptance/tests/{test_upgrade_pc1_to_puppet5.rb → test_upgrade_puppet6_to_puppet7.rb}
  18. +18 −0 files/helpers.ps1
  19. +35 −46 files/install_puppet.ps1
  20. +71 −0 files/prerequisites_check.ps1
  21. +2 −2 lib/facter/env_temp_variable.rb
  22. +5 −5 lib/facter/mco_config.rb
  23. +2 −2 lib/facter/puppet_agent_appdata.rb
  24. +6 −0 lib/facter/settings.rb
  25. +25 −0 lib/puppet/functions/any_resources_of_type.rb
  26. +1 −1 lib/puppet/parser/functions/windows_native_path.rb
  27. +2 −2 lib/puppet/provider/puppet_agent_upgrade_error/puppet_agent_upgrade_error.rb
  28. +9 −0 manifests/init.pp
  29. +1 −1 manifests/install.pp
  30. +31 −2 manifests/install/windows.pp
  31. +1 −1 metadata.json
  32. +3 −3 spec/acceptance/class_spec.rb
  33. +41 −0 spec/classes/puppet_agent_spec.rb
  34. +40 −3 spec/classes/puppet_agent_windows_install_spec.rb
  35. +8 −3 spec/spec_helper_acceptance.rb
  36. +10 −8 spec/spec_helper_local.rb
  37. +44 −31 spec/unit/facter/settings_spec.rb
  38. +92 −0 spec/unit/functions/any_resources_of_type_spec.rb
  39. +4 −4 task_spec/spec/acceptance/init_spec.rb
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#This file is generated by ModuleSync, do not edit.
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
67 changes: 67 additions & 0 deletions .github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: '[Daily] Unit Tests with nightly Puppet gem'

on:
schedule:
- cron: '0 5 * * 1-5'

jobs:
daily_unit_tests_with_nightly_puppet_gem:
name: ${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }}
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6, 7 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5
- puppet_version: 7
ruby: 2.7

- os: 'ubuntu-18.04'
os_type: 'Linux'
env_set_cmd: 'export '
gem_file: 'puppet-latest.gem'
- os: 'macos-10.15'
os_type: 'macOS'
env_set_cmd: 'export '
gem_file: 'puppet-latest-universal-darwin.gem'
- os: 'windows-2016'
os_type: 'Windows'
env_set_cmd: '$env:'
gem_file: 'puppet-latest-x64-mingw32.gem'

runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install ruby version ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Install the latest nightly build of puppet${{ matrix.puppet_version }} gem
run: |
curl http://nightlies.puppet.com/downloads/gems/puppet${{ matrix.puppet_version }}-nightly/${{ matrix.gem_file }} --output puppet.gem
gem install puppet.gem -N
- name: Prepare testing environment with bundler
run: |
bundle config set system 'true'
${{ matrix.env_set_cmd }}PUPPET_GEM_VERSION=$(ruby -e 'puts /puppet\s+\((.+)\)/.match(`gem list -eld puppet`)[1]')
bundle update --jobs 4 --retry 3
- name: Run unit tests
run: bundle exec rake parallel_spec

notify-via-slack:
name: Notify workflow conclusion via Slack
if: ${{ always() }}
needs: daily_unit_tests_with_nightly_puppet_gem
runs-on: 'ubuntu-latest'
steps:
- uses: luchihoratiu/notify-via-slack@main
with:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
48 changes: 48 additions & 0 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Static Code Analysis

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
static_code_analysis:
name: Run checks

env:
ruby_version: 2.5

runs-on: 'ubuntu-18.04'
steps:
- name: Checkout current PR code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install ruby version ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}

- name: Prepare testing environment with bundler
run: bundle update --jobs 4 --retry 3

- name: Run commits check
run: bundle exec rake commits

- name: Run validate check
run: bundle exec rake validate

- name: Run lint check
run: bundle exec rake lint

- name: Run metadata_lint check
run: bundle exec rake metadata_lint

- name: Run syntax check
run: bundle exec rake syntax syntax:hiera syntax:manifests syntax:templates

- name: Run rubocop check
run: bundle exec rake rubocop
43 changes: 43 additions & 0 deletions .github/workflows/task_acceptance_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Task Acceptance Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
task_acceptance_tests:
name: On ${{ matrix.os }}
strategy:
matrix:
os: [ 'centos-7', 'ubuntu-18.04' ]

env:
ruby_version: 2.4
GEM_BOLT: true
BEAKER_debug: true
BEAKER_set: docker/${{ matrix.os }}

runs-on: 'ubuntu-18.04'
steps:
- name: Checkout current PR code
uses: actions/checkout@v2

- name: Install docker
uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true

- name: Install ruby version ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}

- name: Prepare testing environment with bundler
run: |
bundle update --jobs 4 --retry 3
- name: Run task acceptance tests
run: cd task_spec && bundle exec rake task_acceptance
58 changes: 58 additions & 0 deletions .github/workflows/unit_tests_with_nightly_puppet_gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Unit Tests with nightly Puppet gem

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unit_tests_with_nightly_puppet_gem:
name: ${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }}
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6, 7 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5
- puppet_version: 7
ruby: 2.7

- os: 'ubuntu-18.04'
os_type: 'Linux'
env_set_cmd: 'export '
gem_file: 'puppet-latest.gem'
- os: 'macos-10.15'
os_type: 'macOS'
env_set_cmd: 'export '
gem_file: 'puppet-latest-universal-darwin.gem'
- os: 'windows-2016'
os_type: 'Windows'
env_set_cmd: '$env:'
gem_file: 'puppet-latest-x64-mingw32.gem'

runs-on: ${{ matrix.os }}
steps:
- name: Checkout current PR code
uses: actions/checkout@v2

- name: Install ruby version ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Install the latest nightly build of puppet${{ matrix.puppet_version }} gem
run: |
curl http://nightlies.puppet.com/downloads/gems/puppet${{ matrix.puppet_version }}-nightly/${{ matrix.gem_file }} --output puppet.gem
gem install puppet.gem -N
- name: Prepare testing environment with bundler
run: |
bundle config set system 'true'
${{ matrix.env_set_cmd }}PUPPET_GEM_VERSION=$(ruby -e 'puts /puppet\s+\((.+)\)/.match(`gem list -eld puppet`)[1]')
bundle update --jobs 4 --retry 3
- name: Run unit tests
run: bundle exec rake parallel_spec
47 changes: 47 additions & 0 deletions .github/workflows/unit_tests_with_released_puppet_gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Unit Tests with released Puppet gem

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unit_tests_with_released_puppet_gem:
name: ${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }}
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5

- os: 'ubuntu-18.04'
os_type: 'Linux'
- os: 'macos-10.15'
os_type: 'macOS'
- os: 'windows-2016'
os_type: 'Windows'

runs-on: ${{ matrix.os }}
continue-on-error: true
env:
PUPPET_GEM_VERSION: ~> ${{ matrix.puppet_version }}.0
steps:
- name: Checkout current PR code
uses: actions/checkout@v2

- name: Install ruby version ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Prepare testing environment with bundler
run: |
bundle update --jobs 4 --retry 3
- name: Run unit tests
run: bundle exec rake parallel_spec
Loading