From af57db4dc0c61d28555177d23cef553ae1abd7ea Mon Sep 17 00:00:00 2001 From: Nicolai Mollerup Date: Wed, 6 Sep 2023 16:06:32 +0200 Subject: [PATCH] Updated with pdk 3.0.0, updated to support newer puppet versions and fixed pdk validation warnings --- .gitignore | 2 +- .pdkignore | 8 +- .rubocop.yml | 216 ++++++++++++++++++++++++++++++++++++++++-- Gemfile | 35 ++++--- Rakefile | 10 +- manifests/init.pp | 40 ++++---- manifests/instance.pp | 117 ++++++++++++----------- metadata.json | 20 ++-- pdk.yaml | 2 + spec/spec_helper.rb | 5 +- 10 files changed, 337 insertions(+), 118 deletions(-) create mode 100644 pdk.yaml diff --git a/.gitignore b/.gitignore index 988dcbb..3f15512 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ /log/ /pkg/ /spec/fixtures/manifests/ -/spec/fixtures/modules/ +/spec/fixtures/modules/* /tmp/ /vendor/ /convert_report.txt diff --git a/.pdkignore b/.pdkignore index c538bea..584438f 100644 --- a/.pdkignore +++ b/.pdkignore @@ -16,7 +16,7 @@ /log/ /pkg/ /spec/fixtures/manifests/ -/spec/fixtures/modules/ +/spec/fixtures/modules/* /tmp/ /vendor/ /convert_report.txt @@ -26,20 +26,16 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml -/appveyor.yml -/.editorconfig /.fixtures.yml /Gemfile /.gitattributes /.gitignore -/.gitlab-ci.yml /.pdkignore /.puppet-lint.rc /Rakefile /rakelib/ /.rspec -/.rubocop.yml -/.travis.yml +/..yml /.yardopts /spec/ /.vscode/ diff --git a/.rubocop.yml b/.rubocop.yml index 8f782e7..5be1f9f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ require: - rubocop-rspec AllCops: DisplayCopNames: true - TargetRubyVersion: '2.4' + TargetRubyVersion: '2.6' Include: - "**/*.rb" Exclude: @@ -111,8 +111,14 @@ Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true +Bundler/GemFilename: + Enabled: false Bundler/InsecureProtocolSource: Enabled: false +Capybara/CurrentPathExpectation: + Enabled: false +Capybara/VisibilityMatcher: + Enabled: false Gemspec/DuplicatedAssignment: Enabled: false Gemspec/OrderedDependencies: @@ -287,11 +293,9 @@ Performance/UriDefaultParser: Enabled: false RSpec/Be: Enabled: false -RSpec/Capybara/CurrentPathExpectation: - Enabled: false RSpec/Capybara/FeatureMethods: Enabled: false -RSpec/Capybara/VisibilityMatcher: +RSpec/ContainExactly: Enabled: false RSpec/ContextMethod: Enabled: false @@ -331,6 +335,8 @@ RSpec/LeakyConstantDeclaration: Enabled: false RSpec/LetBeforeExamples: Enabled: false +RSpec/MatchArray: + Enabled: false RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: @@ -373,8 +379,6 @@ Style/AccessModifierDeclarations: Enabled: false Style/AccessorGrouping: Enabled: false -Style/AsciiComments: - Enabled: false Style/BisectedAttrAccessor: Enabled: false Style/CaseLikeIf: @@ -485,35 +489,235 @@ Style/TrailingMethodEndStatement: Enabled: false Style/UnpackFirst: Enabled: false +Capybara/MatchStyle: + Enabled: false +Capybara/NegationMatcher: + Enabled: false +Capybara/SpecificActions: + Enabled: false +Capybara/SpecificFinders: + Enabled: false +Capybara/SpecificMatcher: + Enabled: false +Gemspec/DeprecatedAttributeAssignment: + Enabled: false +Gemspec/DevelopmentDependencies: + Enabled: false +Gemspec/RequireMFA: + Enabled: false +Layout/LineContinuationLeadingSpace: + Enabled: false +Layout/LineContinuationSpacing: + Enabled: false +Layout/LineEndStringConcatenationIndentation: + Enabled: false +Layout/SpaceBeforeBrackets: + Enabled: false +Lint/AmbiguousAssignment: + Enabled: false +Lint/AmbiguousOperatorPrecedence: + Enabled: false +Lint/AmbiguousRange: + Enabled: false +Lint/ConstantOverwrittenInRescue: + Enabled: false +Lint/DeprecatedConstants: + Enabled: false Lint/DuplicateBranch: Enabled: false +Lint/DuplicateMagicComment: + Enabled: false Lint/DuplicateRegexpCharacterClassElement: Enabled: false Lint/EmptyBlock: Enabled: false Lint/EmptyClass: Enabled: false +Lint/EmptyInPattern: + Enabled: false +Lint/IncompatibleIoSelectWithFiberScheduler: + Enabled: false +Lint/LambdaWithoutLiteralBlock: + Enabled: false Lint/NoReturnInBeginEndBlocks: Enabled: false +Lint/NonAtomicFileOperation: + Enabled: false +Lint/NumberedParameterAssignment: + Enabled: false +Lint/OrAssignmentToConstant: + Enabled: false +Lint/RedundantDirGlobSort: + Enabled: false +Lint/RefinementImportMethods: + Enabled: false +Lint/RequireRangeParentheses: + Enabled: false +Lint/RequireRelativeSelfPath: + Enabled: false +Lint/SymbolConversion: + Enabled: false Lint/ToEnumArguments: Enabled: false +Lint/TripleQuotes: + Enabled: false Lint/UnexpectedBlockArity: Enabled: false Lint/UnmodifiedReduceAccumulator: Enabled: false +Lint/UselessRescue: + Enabled: false +Lint/UselessRuby2Keywords: + Enabled: false +Metrics/CollectionLiteralLength: + Enabled: false +Naming/BlockForwarding: + Enabled: false Performance/CollectionLiteralInLoop: Enabled: false +Performance/ConcurrentMonotonicTime: + Enabled: false +Performance/MapCompact: + Enabled: false +Performance/RedundantEqualityComparisonBlock: + Enabled: false +Performance/RedundantSplitRegexpArgument: + Enabled: false +Performance/StringIdentifierArgument: + Enabled: false +RSpec/BeEq: + Enabled: false +RSpec/BeNil: + Enabled: false +RSpec/ChangeByZero: + Enabled: false +RSpec/ClassCheck: + Enabled: false +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: + Enabled: false +RSpec/SortMetadata: + Enabled: false +RSpec/SubjectDeclaration: + Enabled: false +RSpec/VerifiedDoubleReference: + Enabled: false +Security/CompoundHash: + Enabled: false +Security/IoMethods: + Enabled: false Style/ArgumentsForwarding: Enabled: false +Style/ArrayIntersect: + Enabled: false Style/CollectionCompact: Enabled: false +Style/ComparableClamp: + Enabled: false +Style/ConcatArrayLiterals: + Enabled: false +Style/DirEmpty: + Enabled: false Style/DocumentDynamicEvalDefinition: Enabled: false +Style/EmptyHeredoc: + Enabled: false +Style/EndlessMethod: + Enabled: false +Style/EnvHome: + Enabled: false +Style/FetchEnvVar: + Enabled: false +Style/FileEmpty: + Enabled: false +Style/FileRead: + Enabled: false +Style/FileWrite: + Enabled: false +Style/HashConversion: + Enabled: false +Style/HashExcept: + Enabled: false +Style/IfWithBooleanLiteralBranches: + Enabled: false +Style/InPatternThen: + Enabled: false +Style/MagicCommentFormat: + Enabled: false +Style/MapCompactWithConditionalBlock: + Enabled: false +Style/MapToHash: + Enabled: false +Style/MapToSet: + Enabled: false +Style/MinMaxComparison: + Enabled: false +Style/MultilineInPatternThen: + Enabled: false Style/NegatedIfElseCondition: Enabled: false +Style/NestedFileDirname: + Enabled: false Style/NilLambda: Enabled: false +Style/NumberedParameters: + Enabled: false +Style/NumberedParametersLimit: + Enabled: false +Style/ObjectThen: + Enabled: false +Style/OpenStructUse: + Enabled: false +Style/OperatorMethodCall: + Enabled: false +Style/QuotedSymbols: + Enabled: false Style/RedundantArgument: Enabled: false +Style/RedundantConstantBase: + Enabled: false +Style/RedundantDoubleSplatHashBraces: + Enabled: false +Style/RedundantEach: + Enabled: false +Style/RedundantHeredocDelimiterQuotes: + Enabled: false +Style/RedundantInitialize: + Enabled: false +Style/RedundantSelfAssignmentBranch: + Enabled: false +Style/RedundantStringEscape: + Enabled: false +Style/SelectByRegexp: + Enabled: false +Style/StringChars: + Enabled: false Style/SwapValues: Enabled: false diff --git a/Gemfile b/Gemfile index a167b88..add1873 100644 --- a/Gemfile +++ b/Gemfile @@ -13,21 +13,32 @@ def location_for(place_or_version, fake_version = nil) end end -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - group :development do - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - 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', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + 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 "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 "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 "puppet-debugger", '~> 1.0', require: false + gem "rubocop", '= 1.48.1', 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] end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] + gem "serverspec", '~> 2.41', require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 2906c15..74415a9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,11 @@ # frozen_string_literal: true require 'bundler' -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? +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 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? -require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? -require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? +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" @@ -43,7 +42,8 @@ end PuppetLint.configuration.send('disable_relative') -if Bundler.rubygems.find_name('github_changelog_generator').any? + +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}" diff --git a/manifests/init.pp b/manifests/init.pp index c0ecfd3..54628d0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,62 +7,62 @@ # Parameters # ---------- # -# * ensure +# @param ensure # Enum, Determine if to add or remove the resource. # -# * base_dir_name +# @param base_dir_name # Absolutepath, Location of the base directory for actions runner to be installed. # -# * org_name +# @param org_name # String, actions runner org name. # -# * enterprise_name +# @param enterprise_name # String, enterprise name for global runners # -# * personal_access_token +# @param personal_access_token # String, GitHub PAT with admin permission on the repositories or the origanization. # -# * package_name +# @param package_name # String, GitHub Actions runner offical package name. # -# * package_ensure +# @param package_ensure # String, GitHub Actions runner version to be used. # -# * repository_url +# @param repository_url # String, URL to download GitHub actions runner. # -# * user +# @param user # String, User to be used in Service and directories. # -# * group +# @param group # String, Group to be used in Service and directories. # -# * instances +# @param instances # Hash[String, Hash], Github Runner Instances to be managed. # -# * github_domain +# @param github_domain # String, Base URL for Github Domain. # -# * github_api +# @param github_api # String, Base URL for Github API. # -# * http_proxy +# @param http_proxy # Optional[String], Proxy URL for HTTP traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners. # -# * https_proxy +# @param https_proxy # Optional[String], Proxy URL for HTTPS traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners # -# * no_proxy +# @param no_proxy # Optional[String], Comma separated list of hosts that should not use a proxy. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners # -# * disable_update +# @param disable_update # Optional[Boolean], toggle for disabling automatic runner updates. # -# * path +# @param path # Optional[Array[String]], List of paths to be used as PATH env in the instance runner. # If not defined, file ".path" will be kept as created by the runner scripts. Default value: undef # -# * env +# @param env # Optional[Hash[String, String]], List of variables to be used as env variables in the instance runner. # If not defined, file ".env" will be kept as created # by the runner scripts. (Default: Value set by github_actions_runner Class) @@ -88,7 +88,6 @@ Optional[Array[String]] $path = undef, Optional[Hash[String, String]] $env = undef, ) { - $root_dir = "${github_actions_runner::base_dir_name}-${github_actions_runner::package_ensure}" $ensure_directory = $github_actions_runner::ensure ? { @@ -105,5 +104,4 @@ } create_resources(github_actions_runner::instance, $github_actions_runner::instances) - } diff --git a/manifests/instance.pp b/manifests/instance.pp index 90c8dde..f6d5cd4 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -2,63 +2,70 @@ # # Configure and deploy actions runners instances # -# * ensure +# @param ensure # Enum, Determine if to add or remove the resource. # -# * org_name +# @param org_name # Optional[String], org name for organization level runners. (Default: Value set by github_actions_runner Class) # -# * enterprise_name +# @param enterprise_name # Optional[String], enterprise name for global runners. (Default: Value set by github_actions_runner Class) # -# * personal_access_token +# @param personal_access_token # String, GitHub PAT with admin permission on the repositories or the origanization.(Default: Value set by github_actions_runner Class) # -# * user +# @param user # String, User to be used in Service and directories.(Default: Value set by github_actions_runner Class) # -# * group +# @param group # String, Group to be used in Service and directories.(Default: Value set by github_actions_runner Class) # -# * hostname +# @param hostname # String, actions runner name. # -# * instance_name +# @param instance_name # String, The instance name as part of the instances Hash. # -# * http_proxy +# @param http_proxy # Optional[String], Proxy URL for HTTP traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners. # -# * https_proxy +# @param https_proxy # Optional[String], Proxy URL for HTTPS traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners # -# * no_proxy +# @param no_proxy # Optional[String], Comma separated list of hosts that should not use a proxy. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners # -# * disable_update +# @param disable_update # Optional[Boolean], toggle for disabling automatic runner updates. # -# * repo_name +# @param repo_name # Optional[String], actions runner repository name. # -# * labels +# @param labels # Optional[Array[String]], A list of costum lables to add to a runner. # -# * path +# @param path # Optional[Array[String]], List of paths to be used as PATH env in the instance runner. If not defined, file ".path" will be kept as created # by the runner scripts. (Default: Value set by github_actions_runner Class) # -# * env +# @param env # Optional[Hash[String, String]], List of variables to be used as env variables in the instance runner. # If not defined, file ".env" will be kept as created # by the runner scripts. (Default: Value set by github_actions_runner Class) # +# @param github_domain +# String, Base url for the github installation. +# +# +# @param github_api +# String, api token for github registration +# define github_actions_runner::instance ( Enum['present', 'absent'] $ensure = 'present', String[1] $personal_access_token = $github_actions_runner::personal_access_token, String[1] $user = $github_actions_runner::user, String[1] $group = $github_actions_runner::group, - String[1] $hostname = $::facts['hostname'], + String[1] $hostname = $facts['networking']['hostname'], String[1] $instance_name = $title, String[1] $github_domain = $github_actions_runner::github_domain, String[1] $github_api = $github_actions_runner::github_api, @@ -73,7 +80,6 @@ Optional[Array[String]] $path = $github_actions_runner::path, Optional[Hash[String, String]] $env = $github_actions_runner::env, ) { - if $labels { $flattend_labels_list=join($labels, ',') $assured_labels="--labels ${flattend_labels_list}" @@ -132,28 +138,28 @@ owner => $user, group => $group, content => epp('github_actions_runner/configure_install_runner.sh.epp', { - personal_access_token => $personal_access_token, - token_url => $token_url, - instance_name => $instance_name, - root_dir => $github_actions_runner::root_dir, - url => $url, - hostname => $hostname, - assured_labels => $assured_labels, - disable_update => $disable_update, + personal_access_token => $personal_access_token, + token_url => $token_url, + instance_name => $instance_name, + root_dir => $github_actions_runner::root_dir, + url => $url, + hostname => $hostname, + assured_labels => $assured_labels, + disable_update => $disable_update, }), notify => Exec["${instance_name}-run_configure_install_runner.sh"], require => Archive["${instance_name}-${archive_name}"], } if $ensure == 'present' { - exec { "${instance_name}-check-runner-configured": - user => $user, - cwd => '/srv', - command => 'true', - unless => "test -f ${github_actions_runner::root_dir}/${instance_name}/runsvc.sh", - path => ['/bin', '/usr/bin'], - notify => Exec["${instance_name}-run_configure_install_runner.sh"], - } + exec { "${instance_name}-check-runner-configured": + user => $user, + cwd => '/srv', + command => 'true', + unless => "test -f ${github_actions_runner::root_dir}/${instance_name}/runsvc.sh", + path => ['/bin', '/usr/bin'], + notify => Exec["${instance_name}-run_configure_install_runner.sh"], + } } exec { "${instance_name}-ownership": @@ -163,7 +169,7 @@ refreshonly => true, path => ['/bin', '/usr/bin'], subscribe => Archive["${instance_name}-${archive_name}"], - onlyif => "test -d ${github_actions_runner::root_dir}/${instance_name}" + onlyif => "test -d ${github_actions_runner::root_dir}/${instance_name}", } exec { "${instance_name}-run_configure_install_runner.sh": @@ -172,14 +178,14 @@ command => "${github_actions_runner::root_dir}/${instance_name}/configure_install_runner.sh", refreshonly => true, path => ['/bin', '/usr/bin'], - onlyif => "test -d ${github_actions_runner::root_dir}/${instance_name}" + onlyif => "test -d ${github_actions_runner::root_dir}/${instance_name}", } $content_path = $path ? { - undef => undef, - default => epp('github_actions_runner/path.epp', { + undef => undef, + default => epp('github_actions_runner/path.epp', { paths => $path, - }) + }) } file { "${github_actions_runner::root_dir}/${name}/.path": @@ -189,16 +195,16 @@ group => $group, content => $content_path, require => [Archive["${instance_name}-${archive_name}"], - Exec["${instance_name}-run_configure_install_runner.sh"], + Exec["${instance_name}-run_configure_install_runner.sh"], ], - notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"] + notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"], } $content_env = $env ? { - undef => undef, - default => epp('github_actions_runner/env.epp', { + undef => undef, + default => epp('github_actions_runner/env.epp', { envs => $env, - }) + }) } file { "${github_actions_runner::root_dir}/${name}/.env": @@ -208,9 +214,9 @@ group => $group, content => $content_env, require => [Archive["${instance_name}-${archive_name}"], - Exec["${instance_name}-run_configure_install_runner.sh"], + Exec["${instance_name}-run_configure_install_runner.sh"], ], - notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"] + notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"], } $active_service = $ensure ? { @@ -228,17 +234,16 @@ enable => $enable_service, active => $active_service, content => epp('github_actions_runner/github-actions-runner.service.epp', { - instance_name => $instance_name, - root_dir => $github_actions_runner::root_dir, - user => $user, - group => $group, - http_proxy => $http_proxy, - https_proxy => $https_proxy, - no_proxy => $no_proxy, + instance_name => $instance_name, + root_dir => $github_actions_runner::root_dir, + user => $user, + group => $group, + http_proxy => $http_proxy, + https_proxy => $https_proxy, + no_proxy => $no_proxy, }), require => [File["${github_actions_runner::root_dir}/${instance_name}/configure_install_runner.sh"], - File["${github_actions_runner::root_dir}/${instance_name}/.path"], - Exec["${instance_name}-run_configure_install_runner.sh"]], + File["${github_actions_runner::root_dir}/${instance_name}/.path"], + Exec["${instance_name}-run_configure_install_runner.sh"]], } - } diff --git a/metadata.json b/metadata.json index 2916211..895c252 100644 --- a/metadata.json +++ b/metadata.json @@ -10,11 +10,11 @@ "dependencies": [ { "name": "puppetlabs-stdlib", - "version_requirement": ">= 1.0.0 < 7.0.0" + "version_requirement": ">= 1.0.0 < 10.0.0" }, { - "name": "camptocamp/systemd", - "version_requirement": ">= 2.7.0 < 3.0.0" + "name": "puppet-systemd", + "version_requirement": ">= 2.7.0 <= 5.2.0" }, { "name": "puppet-archive", @@ -33,23 +33,25 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04" + "20.04", + "22.04" ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], - "pdk-version": "2.1.1", - "template-url": "pdk-default#2.1.1", - "template-ref": "tags/2.1.1-0-g03daa92" + "pdk-version": "3.0.0", + "template-url": "pdk-default#3.0.0", + "template-ref": "tags/3.0.0-0-g056e50d" } diff --git a/pdk.yaml b/pdk.yaml new file mode 100644 index 0000000..4bef4bd --- /dev/null +++ b/pdk.yaml @@ -0,0 +1,2 @@ +--- +ignore: [] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9b1fa6f..6820ceb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,8 +25,8 @@ next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e + default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) + rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end end @@ -46,6 +46,7 @@ end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do + RSpec::Puppet::Coverage.report!(0) end # Filter backtrace noise