From c11416f9a2669d4a0ec80f18355b7c20b1fa58a1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 12 Apr 2024 17:09:13 +0100 Subject: [PATCH 1/9] updated pdk version, the test module and the README --- Dockerfile | 10 +- README.md | 2 +- pdk_1_18_1_dependencies/.rubocop.yml | 144 ---- pdk_1_18_1_dependencies/Gemfile | 72 -- testmod/.fixtures.yml | 6 + testmod/.gitattributes | 5 + testmod/.gitignore | 28 + testmod/.pdkignore | 44 ++ testmod/.puppet-lint.rc | 1 + testmod/.rspec | 2 + testmod/.rubocop.yml | 723 ++++++++++++++++++ testmod/.sync.yml | 8 + testmod/.vscode/extensions.json | 6 + testmod/.yardopts | 1 + testmod/CHANGELOG.md | 11 + testmod/Gemfile | 78 ++ testmod/README.md | 117 +++ testmod/Rakefile | 88 +++ testmod/data/common.yaml | 1 + testmod/hiera.yaml | 21 + testmod/manifests/init.pp | 8 + .../metadata.json | 12 +- testmod/pdk.yaml | 2 + testmod/spec/classes/testmod_spec.rb | 13 + testmod/spec/default_facts.yml | 9 + testmod/spec/spec_helper.rb | 74 ++ 26 files changed, 1258 insertions(+), 228 deletions(-) delete mode 100644 pdk_1_18_1_dependencies/.rubocop.yml delete mode 100644 pdk_1_18_1_dependencies/Gemfile create mode 100644 testmod/.fixtures.yml create mode 100644 testmod/.gitattributes create mode 100644 testmod/.gitignore create mode 100644 testmod/.pdkignore create mode 100644 testmod/.puppet-lint.rc create mode 100644 testmod/.rspec create mode 100644 testmod/.rubocop.yml create mode 100644 testmod/.sync.yml create mode 100644 testmod/.vscode/extensions.json create mode 100644 testmod/.yardopts create mode 100644 testmod/CHANGELOG.md create mode 100644 testmod/Gemfile create mode 100644 testmod/README.md create mode 100644 testmod/Rakefile create mode 100644 testmod/data/common.yaml create mode 100644 testmod/hiera.yaml create mode 100644 testmod/manifests/init.pp rename {pdk_1_18_1_dependencies => testmod}/metadata.json (82%) create mode 100644 testmod/pdk.yaml create mode 100644 testmod/spec/classes/testmod_spec.rb create mode 100644 testmod/spec/default_facts.yml create mode 100644 testmod/spec/spec_helper.rb diff --git a/Dockerfile b/Dockerfile index 55ba018..863c83b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # specifying the platform here allows builds to work # correctly on Apple Silicon machines -FROM --platform=amd64 ruby:2.7.4-slim-buster as base +FROM --platform=amd64 ruby:3.0.6-slim-buster as base ARG VCS_REF ARG GH_USER=puppetlabs @@ -26,7 +26,7 @@ RUN apt-get install -y apt-utils \ && wget https://apt.puppet.com/puppet-tools-release-buster.deb \ && dpkg -i puppet-tools-release-buster.deb \ && apt-get update -qq \ - && apt-get install -y --no-install-recommends pdk=2.7.1.0-1buster \ + && apt-get install -y --no-install-recommends pdk=3.0.1.3-1buster \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/httpclient-2.8.3/sample/ssl/* \ @@ -41,11 +41,11 @@ RUN ln -s /bin/mkdir /usr/bin/mkdir # # Simply running "bundle install" against the module is not enough, # as PDK has further dependencies to pull in. -COPY pdk_1_18_1_dependencies /test_module -RUN cd test_module \ +COPY testmod /testmod +RUN cd testmod \ && pdk validate \ && cd .. \ - && rm -rf test_module + && rm -rf testmod RUN groupadd --gid 1001 puppetdev \ && useradd --uid 1001 --gid puppetdev --create-home puppetdev diff --git a/README.md b/README.md index 33b75e5..ac5848e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Docker Tags -- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `4.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. The latest version of the PDK is also pulled in at build time. +- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `4.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. - `----rootless`: This is just like the tag above but the container runs as a user namecd `puppetdev`. - `4.x`: This the tag that is used in the 4.x versions of CD4PE. This tag is updated manually from time to time. - `latest`: This is a legacy tag and not not actually the current build of puppet-dev-tools. It is the build used in older versions of CD4PE (prior to 4.0). These builds are manually created by the CD4PE team. diff --git a/pdk_1_18_1_dependencies/.rubocop.yml b/pdk_1_18_1_dependencies/.rubocop.yml deleted file mode 100644 index c873370..0000000 --- a/pdk_1_18_1_dependencies/.rubocop.yml +++ /dev/null @@ -1,144 +0,0 @@ ---- -require: - - rubocop-rspec - - rubocop-i18n -AllCops: - DisplayCopNames: true - TargetRubyVersion: "2.1" - Include: - - "./**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Metrics/LineLength: - Description: People have wide screens, use them. - Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false -RSpec/BeforeAfterAll: - Description: - Beware of using after(:all) as it may cause state to leak between tests. - A necessary evil in acceptance testing. - Exclude: - - spec/acceptance/**/*.rb -RSpec/HookArgument: - Description: Prefer explicit :each argument, matching existing module's style - EnforcedStyle: each -Style/BlockDelimiters: - Description: - Prefer braces for chaining. Mostly an aesthetical choice. Better to - be consistent then. - EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: - Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: true -Style/ClassAndModuleChildren: - Description: Compact style reduces the required amount of indentation. - EnforcedStyle: compact -Style/EmptyElse: - Description: Enforce against empty else clauses, but allow `nil` for clarity. - EnforcedStyle: empty -Style/FormatString: - Description: Following the main puppet project's style, prefer the % format format. - EnforcedStyle: percent -Style/FormatStringToken: - Description: - Following the main puppet project's style, prefer the simpler template - tokens over annotated ones. - EnforcedStyle: template -Style/Lambda: - Description: Prefer the keyword for easier discoverability. - EnforcedStyle: literal -Style/RegexpLiteral: - Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 - EnforcedStyle: percent_r -Style/TernaryParentheses: - Description: - Checks for use of parentheses around ternary conditions. Enforce parentheses - on complex expressions for better readability, but seriously consider breaking - it up. - EnforcedStyle: require_parentheses_when_complex -Style/TrailingCommaInArguments: - Description: - Prefer always trailing comma on multiline argument lists. This makes - diffs, and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: - Description: - Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/SymbolArray: - Description: Using percent style obscures symbolic intent of array's contents. - EnforcedStyle: brackets -RSpec/MessageSpies: - EnforcedStyle: receive -Style/Documentation: - Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* -Style/WordArray: - EnforcedStyle: brackets -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -GetText/DecorateFunctionMessage: - Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: - Enabled: false -GetText/DecorateStringFormattingUsingPercent: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/IndentHeredoc: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/MessageExpectation: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/NestedGroups: - Enabled: false -Style/AsciiComments: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/SymbolProc: - Enabled: false diff --git a/pdk_1_18_1_dependencies/Gemfile b/pdk_1_18_1_dependencies/Gemfile deleted file mode 100644 index 8007ad0..0000000 --- a/pdk_1_18_1_dependencies/Gemfile +++ /dev/null @@ -1,72 +0,0 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' - -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} - - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] - else - [place_or_version, { require: false }] - end -end - -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - -group :development do - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') - 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 "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] -end - -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - -gems = {} - -gems['puppet'] = location_for(puppet_version) - -# If facter or hiera versions have been specified via the environment -# variables - -gems['facter'] = location_for(facter_version) if facter_version -gems['hiera'] = location_for(hiera_version) if hiera_version - -if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} - # If we're using a Puppet gem on Windows which handles its own win32-xxx gem - # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). - gems['win32-dir'] = ['<= 0.4.9', require: false] - gems['win32-eventlog'] = ['<= 0.6.5', require: false] - gems['win32-process'] = ['<= 0.7.5', require: false] - gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['0.8.8', require: false] -end - -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params -end - -# Evaluate Gemfile.local and ~/.gemfile if they exist -extra_gemfiles = [ - "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), -] - -extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end -end -# vim: syntax=ruby diff --git a/testmod/.fixtures.yml b/testmod/.fixtures.yml new file mode 100644 index 0000000..2296adb --- /dev/null +++ b/testmod/.fixtures.yml @@ -0,0 +1,6 @@ +# This file can be used to install module dependencies for unit testing +# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details +--- +fixtures: + forge_modules: +# stdlib: "puppetlabs/stdlib" diff --git a/testmod/.gitattributes b/testmod/.gitattributes new file mode 100644 index 0000000..9032a01 --- /dev/null +++ b/testmod/.gitattributes @@ -0,0 +1,5 @@ +*.rb eol=lf +*.erb eol=lf +*.pp eol=lf +*.sh eol=lf +*.epp eol=lf diff --git a/testmod/.gitignore b/testmod/.gitignore new file mode 100644 index 0000000..3f15512 --- /dev/null +++ b/testmod/.gitignore @@ -0,0 +1,28 @@ +.git/ +.*.sw[op] +.metadata +.yardoc +.yardwarns +*.iml +/.bundle/ +/.idea/ +/.vagrant/ +/coverage/ +/bin/ +/doc/ +/Gemfile.local +/Gemfile.lock +/junit/ +/log/ +/pkg/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/* +/tmp/ +/vendor/ +/convert_report.txt +/update_report.txt +.DS_Store +.project +.envrc +/inventory.yaml +/spec/fixtures/litmus_inventory.yaml diff --git a/testmod/.pdkignore b/testmod/.pdkignore new file mode 100644 index 0000000..862847a --- /dev/null +++ b/testmod/.pdkignore @@ -0,0 +1,44 @@ +.git/ +.*.sw[op] +.metadata +.yardoc +.yardwarns +*.iml +/.bundle/ +/.idea/ +/.vagrant/ +/coverage/ +/bin/ +/doc/ +/Gemfile.local +/Gemfile.lock +/junit/ +/log/ +/pkg/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/* +/tmp/ +/vendor/ +/convert_report.txt +/update_report.txt +.DS_Store +.project +.envrc +/inventory.yaml +/spec/fixtures/litmus_inventory.yaml +/.fixtures.yml +/Gemfile +/.gitattributes +/.github/ +/.gitignore +/.pdkignore +/.puppet-lint.rc +/Rakefile +/rakelib/ +/.rspec +/..yml +/.yardopts +/spec/ +/.vscode/ +/.sync.yml +/.devcontainer/ diff --git a/testmod/.puppet-lint.rc b/testmod/.puppet-lint.rc new file mode 100644 index 0000000..cc96ece --- /dev/null +++ b/testmod/.puppet-lint.rc @@ -0,0 +1 @@ +--relative diff --git a/testmod/.rspec b/testmod/.rspec new file mode 100644 index 0000000..16f9cdb --- /dev/null +++ b/testmod/.rspec @@ -0,0 +1,2 @@ +--color +--format documentation diff --git a/testmod/.rubocop.yml b/testmod/.rubocop.yml new file mode 100644 index 0000000..5be1f9f --- /dev/null +++ b/testmod/.rubocop.yml @@ -0,0 +1,723 @@ +--- +require: +- rubocop-performance +- rubocop-rspec +AllCops: + DisplayCopNames: true + TargetRubyVersion: '2.6' + Include: + - "**/*.rb" + Exclude: + - bin/* + - ".vendor/**/*" + - "**/Gemfile" + - "**/Rakefile" + - pkg/**/* + - spec/fixtures/**/* + - vendor/**/* + - "**/Puppetfile" + - "**/Vagrantfile" + - "**/Guardfile" +Layout/LineLength: + Description: People have wide screens, use them. + Max: 200 +RSpec/BeforeAfterAll: + Description: Beware of using after(:all) as it may cause state to leak between tests. + A necessary evil in acceptance testing. + Exclude: + - spec/acceptance/**/*.rb +RSpec/HookArgument: + Description: Prefer explicit :each argument, matching existing module's style + EnforcedStyle: each +RSpec/DescribeSymbol: + Exclude: + - spec/unit/facter/**/*.rb +Style/BlockDelimiters: + Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to + be consistent then. + EnforcedStyle: braces_for_chaining +Style/ClassAndModuleChildren: + Description: Compact style reduces the required amount of indentation. + EnforcedStyle: compact +Style/EmptyElse: + Description: Enforce against empty else clauses, but allow `nil` for clarity. + EnforcedStyle: empty +Style/FormatString: + Description: Following the main puppet project's style, prefer the % format format. + EnforcedStyle: percent +Style/FormatStringToken: + Description: Following the main puppet project's style, prefer the simpler template + tokens over annotated ones. + EnforcedStyle: template +Style/Lambda: + Description: Prefer the keyword for easier discoverability. + EnforcedStyle: literal +Style/RegexpLiteral: + Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 + EnforcedStyle: percent_r +Style/TernaryParentheses: + Description: Checks for use of parentheses around ternary conditions. Enforce parentheses + on complex expressions for better readability, but seriously consider breaking + it up. + EnforcedStyle: require_parentheses_when_complex +Style/TrailingCommaInArguments: + Description: Prefer always trailing comma on multiline argument lists. This makes + diffs, and re-ordering nicer. + EnforcedStyleForMultiline: comma +Style/TrailingCommaInArrayLiteral: + Description: Prefer always trailing comma on multiline literals. This makes diffs, + and re-ordering nicer. + EnforcedStyleForMultiline: comma +Style/SymbolArray: + Description: Using percent style obscures symbolic intent of array's contents. + EnforcedStyle: brackets +RSpec/MessageSpies: + EnforcedStyle: receive +Style/Documentation: + Exclude: + - lib/puppet/parser/functions/**/* + - spec/**/* +Style/WordArray: + EnforcedStyle: brackets +Performance/AncestorsInclude: + Enabled: true +Performance/BigDecimalWithNumericArgument: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/CaseWhenSplat: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/Sum: + Enabled: true +Style/CollectionMethods: + Enabled: true +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: + Enabled: false +Gemspec/RequiredRubyVersion: + Enabled: false +Gemspec/RubyVersionGlobalsUsage: + Enabled: false +Layout/ArgumentAlignment: + Enabled: false +Layout/BeginEndAlignment: + Enabled: false +Layout/ClosingHeredocIndentation: + Enabled: false +Layout/EmptyComment: + Enabled: false +Layout/EmptyLineAfterGuardClause: + Enabled: false +Layout/EmptyLinesAroundArguments: + Enabled: false +Layout/EmptyLinesAroundAttributeAccessor: + Enabled: false +Layout/EndOfLine: + Enabled: false +Layout/FirstArgumentIndentation: + Enabled: false +Layout/HashAlignment: + Enabled: false +Layout/HeredocIndentation: + Enabled: false +Layout/LeadingEmptyLines: + Enabled: false +Layout/SpaceAroundMethodCallOperator: + Enabled: false +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: false +Layout/SpaceInsideReferenceBrackets: + Enabled: false +Lint/BigDecimalNew: + Enabled: false +Lint/BooleanSymbol: + Enabled: false +Lint/ConstantDefinitionInBlock: + Enabled: false +Lint/DeprecatedOpenSSLConstant: + Enabled: false +Lint/DisjunctiveAssignmentInConstructor: + Enabled: false +Lint/DuplicateElsifCondition: + Enabled: false +Lint/DuplicateRequire: + Enabled: false +Lint/DuplicateRescueException: + Enabled: false +Lint/EmptyConditionalBody: + Enabled: false +Lint/EmptyFile: + Enabled: false +Lint/ErbNewArguments: + Enabled: false +Lint/FloatComparison: + Enabled: false +Lint/HashCompareByIdentity: + Enabled: false +Lint/IdentityComparison: + Enabled: false +Lint/InterpolationCheck: + Enabled: false +Lint/MissingCopEnableDirective: + Enabled: false +Lint/MixedRegexpCaptureTypes: + Enabled: false +Lint/NestedPercentLiteral: + Enabled: false +Lint/NonDeterministicRequireOrder: + Enabled: false +Lint/OrderedMagicComments: + Enabled: false +Lint/OutOfRangeRegexpRef: + Enabled: false +Lint/RaiseException: + Enabled: false +Lint/RedundantCopEnableDirective: + Enabled: false +Lint/RedundantRequireStatement: + Enabled: false +Lint/RedundantSafeNavigation: + Enabled: false +Lint/RedundantWithIndex: + Enabled: false +Lint/RedundantWithObject: + Enabled: false +Lint/RegexpAsCondition: + Enabled: false +Lint/ReturnInVoidContext: + Enabled: false +Lint/SafeNavigationConsistency: + Enabled: false +Lint/SafeNavigationWithEmpty: + Enabled: false +Lint/SelfAssignment: + Enabled: false +Lint/SendWithMixinArgument: + Enabled: false +Lint/ShadowedArgument: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Lint/ToJSON: + Enabled: false +Lint/TopLevelReturnWithArgument: + Enabled: false +Lint/TrailingCommaInAttributeDeclaration: + Enabled: false +Lint/UnreachableLoop: + Enabled: false +Lint/UriEscapeUnescape: + Enabled: false +Lint/UriRegexp: + Enabled: false +Lint/UselessMethodDefinition: + Enabled: false +Lint/UselessTimes: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/BlockLength: + Enabled: false +Metrics/BlockNesting: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/ParameterLists: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Migration/DepartmentName: + Enabled: false +Naming/AccessorMethodName: + Enabled: false +Naming/BlockParameterName: + Enabled: false +Naming/HeredocDelimiterCase: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false +Naming/MemoizedInstanceVariableName: + Enabled: false +Naming/MethodParameterName: + Enabled: false +Naming/RescuedExceptionsVariableName: + Enabled: false +Naming/VariableNumber: + Enabled: false +Performance/BindCall: + Enabled: false +Performance/DeletePrefix: + Enabled: false +Performance/DeleteSuffix: + Enabled: false +Performance/InefficientHashSearch: + Enabled: false +Performance/UnfreezeString: + Enabled: false +Performance/UriDefaultParser: + Enabled: false +RSpec/Be: + Enabled: false +RSpec/Capybara/FeatureMethods: + Enabled: false +RSpec/ContainExactly: + Enabled: false +RSpec/ContextMethod: + Enabled: false +RSpec/ContextWording: + Enabled: false +RSpec/DescribeClass: + Enabled: false +RSpec/EmptyHook: + Enabled: false +RSpec/EmptyLineAfterExample: + Enabled: false +RSpec/EmptyLineAfterExampleGroup: + Enabled: false +RSpec/EmptyLineAfterHook: + Enabled: false +RSpec/ExampleLength: + Enabled: false +RSpec/ExampleWithoutDescription: + Enabled: false +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: + Enabled: false +RSpec/ImplicitSubject: + Enabled: false +RSpec/LeakyConstantDeclaration: + Enabled: false +RSpec/LetBeforeExamples: + Enabled: false +RSpec/MatchArray: + Enabled: false +RSpec/MissingExampleGroupArgument: + Enabled: false +RSpec/MultipleExpectations: + Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false +RSpec/MultipleSubjects: + Enabled: false +RSpec/NestedGroups: + Enabled: false +RSpec/PredicateMatcher: + Enabled: false +RSpec/ReceiveCounts: + Enabled: false +RSpec/ReceiveNever: + Enabled: false +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/RepeatedExampleGroupDescription: + Enabled: false +RSpec/RepeatedIncludeExample: + Enabled: false +RSpec/ReturnFromStub: + Enabled: false +RSpec/SharedExamples: + Enabled: false +RSpec/StubbedMock: + Enabled: false +RSpec/UnspecifiedException: + Enabled: false +RSpec/VariableDefinition: + Enabled: false +RSpec/VoidExpect: + Enabled: false +RSpec/Yield: + Enabled: false +Security/Open: + Enabled: false +Style/AccessModifierDeclarations: + Enabled: false +Style/AccessorGrouping: + Enabled: false +Style/BisectedAttrAccessor: + Enabled: false +Style/CaseLikeIf: + Enabled: false +Style/ClassEqualityComparison: + Enabled: false +Style/ColonMethodDefinition: + Enabled: false +Style/CombinableLoops: + Enabled: false +Style/CommentedKeyword: + Enabled: false +Style/Dir: + Enabled: false +Style/DoubleCopDisableDirective: + Enabled: false +Style/EmptyBlockParameter: + Enabled: false +Style/EmptyLambdaParameter: + Enabled: false +Style/Encoding: + Enabled: false +Style/EvalWithLocation: + Enabled: false +Style/ExpandPathArguments: + Enabled: false +Style/ExplicitBlockArgument: + Enabled: false +Style/ExponentialNotation: + Enabled: false +Style/FloatDivision: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/GlobalStdStream: + Enabled: false +Style/HashAsLastArrayItem: + Enabled: false +Style/HashLikeCase: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false +Style/IfUnlessModifier: + Enabled: false +Style/KeywordParametersOrder: + Enabled: false +Style/MinMax: + Enabled: false +Style/MixinUsage: + Enabled: false +Style/MultilineWhenThen: + Enabled: false +Style/NegatedUnless: + Enabled: false +Style/NumericPredicate: + Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/OrAssignment: + Enabled: false +Style/RandomWithOffset: + Enabled: false +Style/RedundantAssignment: + Enabled: false +Style/RedundantCondition: + Enabled: false +Style/RedundantConditional: + Enabled: false +Style/RedundantFetchBlock: + Enabled: false +Style/RedundantFileExtensionInRequire: + Enabled: false +Style/RedundantRegexpCharacterClass: + Enabled: false +Style/RedundantRegexpEscape: + Enabled: false +Style/RedundantSelfAssignment: + Enabled: false +Style/RedundantSort: + Enabled: false +Style/RescueStandardError: + Enabled: false +Style/SingleArgumentDig: + Enabled: false +Style/SlicingWithRange: + Enabled: false +Style/SoleNestedConditional: + Enabled: false +Style/StderrPuts: + Enabled: false +Style/StringConcatenation: + Enabled: false +Style/Strip: + Enabled: false +Style/SymbolProc: + Enabled: false +Style/TrailingBodyOnClass: + Enabled: false +Style/TrailingBodyOnMethodDefinition: + Enabled: false +Style/TrailingBodyOnModule: + Enabled: false +Style/TrailingCommaInHashLiteral: + Enabled: false +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/testmod/.sync.yml b/testmod/.sync.yml new file mode 100644 index 0000000..8c2c98e --- /dev/null +++ b/testmod/.sync.yml @@ -0,0 +1,8 @@ +# This file can be used to customize the files managed by PDK. +# +# See https://github.com/puppetlabs/pdk-templates/blob/main/README.md +# for more information. +# +# See https://github.com/puppetlabs/pdk-templates/blob/main/config_defaults.yml +# for the default values. +--- {} diff --git a/testmod/.vscode/extensions.json b/testmod/.vscode/extensions.json new file mode 100644 index 0000000..2f1e4f7 --- /dev/null +++ b/testmod/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ] +} diff --git a/testmod/.yardopts b/testmod/.yardopts new file mode 100644 index 0000000..29c933b --- /dev/null +++ b/testmod/.yardopts @@ -0,0 +1 @@ +--markup markdown diff --git a/testmod/CHANGELOG.md b/testmod/CHANGELOG.md new file mode 100644 index 0000000..4c954cd --- /dev/null +++ b/testmod/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## Release 0.1.0 + +**Features** + +**Bugfixes** + +**Known Issues** diff --git a/testmod/Gemfile b/testmod/Gemfile new file mode 100644 index 0000000..ca0e773 --- /dev/null +++ b/testmod/Gemfile @@ -0,0 +1,78 @@ +source ENV['GEM_SOURCE'] || 'https://rubygems.org' + +def location_for(place_or_version, fake_version = nil) + git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} + file_url_regex = %r{\Afile:\/\/(?.*)} + + if place_or_version && (git_url = place_or_version.match(git_url_regex)) + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) + ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] + else + [place_or_version, { require: false }] + end +end + +group :development do + 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 "puppet-strings", '~> 4.0', require: false + gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] +end +group :system_tests do + gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] + gem "serverspec", '~> 2.41', require: false +end +group :release_prep do + gem "puppet-strings", '~> 4.0', require: false + gem "puppetlabs_spec_helper", '~> 6.0', require: false +end + +puppet_version = ENV['PUPPET_GEM_VERSION'] +facter_version = ENV['FACTER_GEM_VERSION'] +hiera_version = ENV['HIERA_GEM_VERSION'] + +gems = {} + +gems['puppet'] = location_for(puppet_version) + +# If facter or hiera versions have been specified via the environment +# variables + +gems['facter'] = location_for(facter_version) if facter_version +gems['hiera'] = location_for(hiera_version) if hiera_version + +gems.each do |gem_name, gem_params| + gem gem_name, *gem_params +end + +# Evaluate Gemfile.local and ~/.gemfile if they exist +extra_gemfiles = [ + "#{__FILE__}.local", + File.join(Dir.home, '.gemfile'), +] + +extra_gemfiles.each do |gemfile| + if File.file?(gemfile) && File.readable?(gemfile) + eval(File.read(gemfile), binding) + end +end +# vim: syntax=ruby diff --git a/testmod/README.md b/testmod/README.md new file mode 100644 index 0000000..4f55ffb --- /dev/null +++ b/testmod/README.md @@ -0,0 +1,117 @@ +# testmod + +Welcome to your new module. A short overview of the generated parts can be found +in the [PDK documentation][1]. + +The README template below provides a starting point with details about what +information to include in your README. + +## Table of Contents + +1. [Description](#description) +1. [Setup - The basics of getting started with testmod](#setup) + * [What testmod affects](#what-testmod-affects) + * [Setup requirements](#setup-requirements) + * [Beginning with testmod](#beginning-with-testmod) +1. [Usage - Configuration options and additional functionality](#usage) +1. [Limitations - OS compatibility, etc.](#limitations) +1. [Development - Guide for contributing to the module](#development) + +## Description + +Briefly tell users why they might want to use your module. Explain what your +module does and what kind of problems users can solve with it. + +This should be a fairly short description helps the user decide if your module +is what they want. + +## Setup + +### What testmod affects **OPTIONAL** + +If it's obvious what your module touches, you can skip this section. For +example, folks can probably figure out that your mysql_instance module affects +their MySQL instances. + +If there's more that they should know about, though, this is the place to +mention: + +* Files, packages, services, or operations that the module will alter, impact, + or execute. +* Dependencies that your module automatically installs. +* Warnings or other important notices. + +### Setup Requirements **OPTIONAL** + +If your module requires anything extra before setting up (pluginsync enabled, +another module, etc.), mention it here. + +If your most recent release breaks compatibility or requires particular steps +for upgrading, you might want to include an additional "Upgrading" section here. + +### Beginning with testmod + +The very basic steps needed for a user to get the module up and running. This +can include setup steps, if necessary, or it can be an example of the most basic +use of the module. + +## Usage + +Include usage examples for common use cases in the **Usage** section. Show your +users how to use your module to solve problems, and be sure to include code +examples. Include three to five examples of the most important or common tasks a +user can accomplish with your module. Show users how to accomplish more complex +tasks that involve different types, classes, and functions working in tandem. + +## Reference + +This section is deprecated. Instead, add reference information to your code as +Puppet Strings comments, and then use Strings to generate a REFERENCE.md in your +module. For details on how to add code comments and generate documentation with +Strings, see the [Puppet Strings documentation][2] and [style guide][3]. + +If you aren't ready to use Strings yet, manually create a REFERENCE.md in the +root of your module directory and list out each of your module's classes, +defined types, facts, functions, Puppet tasks, task plans, and resource types +and providers, along with the parameters for each. + +For each element (class, defined type, function, and so on), list: + +* The data type, if applicable. +* A description of what the element does. +* Valid values, if the data type doesn't make it obvious. +* Default value, if any. + +For example: + +``` +### `pet::cat` + +#### Parameters + +##### `meow` + +Enables vocalization in your cat. Valid options: 'string'. + +Default: 'medium-loud'. +``` + +## Limitations + +In the Limitations section, list any incompatibilities, known issues, or other +warnings. + +## Development + +In the Development section, tell other users the ground rules for contributing +to your project and how they should submit their work. + +## Release Notes/Contributors/Etc. **Optional** + +If you aren't using changelog, put your release notes here (though you should +consider using changelog). You can also add any additional sections you feel are +necessary or important to include here. Please use the `##` header. + +[1]: https://puppet.com/docs/pdk/latest/pdk_generating_modules.html +[2]: https://puppet.com/docs/puppet/latest/puppet_strings.html +[3]: https://puppet.com/docs/puppet/latest/puppet_strings_style.html diff --git a/testmod/Rakefile b/testmod/Rakefile new file mode 100644 index 0000000..74415a9 --- /dev/null +++ b/testmod/Rakefile @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require 'bundler' +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 '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" + returnVal = nil || JSON.load(File.read('metadata.json'))['author'] + raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator user:#{returnVal}" + returnVal +end + +def changelog_project + return unless Rake.application.top_level_tasks.include? "changelog" + + returnVal = nil + returnVal ||= begin + metadata_source = JSON.load(File.read('metadata.json'))['source'] + metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) + + metadata_source_match && metadata_source_match[1] + end + + raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? + + puts "GitHubChangelogGenerator project:#{returnVal}" + returnVal +end + +def changelog_future_release + return unless Rake.application.top_level_tasks.include? "changelog" + returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] + raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator future_release:#{returnVal}" + returnVal +end + +PuppetLint.configuration.send('disable_relative') + + +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}" + config.project = "#{changelog_project}" + config.future_release = "#{changelog_future_release}" + config.exclude_labels = ['maintenance'] + config.header = "# Change log\n\nAll 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)." + config.add_pr_wo_labels = true + config.issues = false + config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" + config.configure_sections = { + "Changed" => { + "prefix" => "### Changed", + "labels" => ["backwards-incompatible"], + }, + "Added" => { + "prefix" => "### Added", + "labels" => ["enhancement", "feature"], + }, + "Fixed" => { + "prefix" => "### Fixed", + "labels" => ["bug", "documentation", "bugfix"], + }, + } + end +else + desc 'Generate a Changelog from GitHub' + task :changelog do + raise < 1.15' + condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" +EOM + end +end + diff --git a/testmod/data/common.yaml b/testmod/data/common.yaml new file mode 100644 index 0000000..2fbf0ff --- /dev/null +++ b/testmod/data/common.yaml @@ -0,0 +1 @@ +--- {} diff --git a/testmod/hiera.yaml b/testmod/hiera.yaml new file mode 100644 index 0000000..545fff3 --- /dev/null +++ b/testmod/hiera.yaml @@ -0,0 +1,21 @@ +--- +version: 5 + +defaults: # Used for any hierarchy level that omits these keys. + datadir: data # This path is relative to hiera.yaml's directory. + data_hash: yaml_data # Use the built-in YAML backend. + +hierarchy: + - name: "osfamily/major release" + paths: + # Used to distinguish between Debian and Ubuntu + - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" + - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" + # Used for Solaris + - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" + - name: "osfamily" + paths: + - "os/%{facts.os.name}.yaml" + - "os/%{facts.os.family}.yaml" + - name: 'common' + path: 'common.yaml' diff --git a/testmod/manifests/init.pp b/testmod/manifests/init.pp new file mode 100644 index 0000000..bc45700 --- /dev/null +++ b/testmod/manifests/init.pp @@ -0,0 +1,8 @@ +# @summary A short summary of the purpose of this class +# +# A description of what this class does +# +# @example +# include testmod +class testmod { +} diff --git a/pdk_1_18_1_dependencies/metadata.json b/testmod/metadata.json similarity index 82% rename from pdk_1_18_1_dependencies/metadata.json rename to testmod/metadata.json index 9e2e79f..bd4a802 100644 --- a/pdk_1_18_1_dependencies/metadata.json +++ b/testmod/metadata.json @@ -1,5 +1,5 @@ { - "name": "testuser-test_module", + "name": "testuser-testmod", "version": "0.1.0", "author": "testuser", "summary": "", @@ -36,7 +36,7 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "9" + "10" ] }, { @@ -56,10 +56,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 7.24 < 9.0.0" } ], - "pdk-version": "1.18.1", - "template-url": "pdk-default#1.18.1", - "template-ref": "tags/1.18.1-0-g3d2e75c" + "pdk-version": "3.0.1", + "template-url": "pdk-default#3.0.1", + "template-ref": "tags/3.0.1-0-gd13288a" } diff --git a/testmod/pdk.yaml b/testmod/pdk.yaml new file mode 100644 index 0000000..4bef4bd --- /dev/null +++ b/testmod/pdk.yaml @@ -0,0 +1,2 @@ +--- +ignore: [] diff --git a/testmod/spec/classes/testmod_spec.rb b/testmod/spec/classes/testmod_spec.rb new file mode 100644 index 0000000..af1f810 --- /dev/null +++ b/testmod/spec/classes/testmod_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'testmod' do + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let(:facts) { os_facts } + + it { is_expected.to compile.with_all_deps } + end + end +end diff --git a/testmod/spec/default_facts.yml b/testmod/spec/default_facts.yml new file mode 100644 index 0000000..3346c39 --- /dev/null +++ b/testmod/spec/default_facts.yml @@ -0,0 +1,9 @@ +# Use default_module_facts.yml for module specific facts. +# +# Facts specified here will override the values provided by rspec-puppet-facts. +--- +networking: + ip: "172.16.254.254" + ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" + mac: "AA:AA:AA:AA:AA:AA" +is_pe: false diff --git a/testmod/spec/spec_helper.rb b/testmod/spec/spec_helper.rb new file mode 100644 index 0000000..6820ceb --- /dev/null +++ b/testmod/spec/spec_helper.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +RSpec.configure do |c| + c.mock_with :rspec +end + +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' + +require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) + +include RspecPuppetFacts + +default_facts = { + puppetversion: Puppet.version, + facterversion: Facter.version, +} + +default_fact_files = [ + File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), + File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), +] + +default_fact_files.each do |f| + next unless File.exist?(f) && File.readable?(f) && File.size?(f) + + begin + 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 + +# read default_facts and merge them over what is provided by facterdb +default_facts.each do |fact, value| + add_custom_fact fact, value +end + +RSpec.configure do |c| + c.default_facts = default_facts + c.before :each do + # set to strictest setting for testing + # by default Puppet runs at warning level + Puppet.settings[:strict] = :warning + Puppet.settings[:strict_variables] = true + end + c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] + c.after(:suite) do + RSpec::Puppet::Coverage.report!(0) + end + + # Filter backtrace noise + backtrace_exclusion_patterns = [ + %r{spec_helper}, + %r{gems}, + ] + + if c.respond_to?(:backtrace_exclusion_patterns) + c.backtrace_exclusion_patterns = backtrace_exclusion_patterns + elsif c.respond_to?(:backtrace_clean_patterns) + c.backtrace_clean_patterns = backtrace_exclusion_patterns + end +end + +# Ensures that a module is defined +# @param module_name Name of the module +def ensure_module_defined(module_name) + module_name.split('::').reduce(Object) do |last_module, next_module| + last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) + last_module.const_get(next_module, false) + end +end + +# 'spec_overrides' from sync.yml will appear below this line From 361bc8df64166152a25f66491bc654fb46d04a52 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 23 Apr 2024 18:00:54 +0100 Subject: [PATCH 2/9] added a file to the skipfile in the tests --- .github/workflows/build-test-push.yml | 2 +- .github/workflows/build-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-push.yml b/.github/workflows/build-test-push.yml index 3fbf343..67e30f2 100644 --- a/.github/workflows/build-test-push.yml +++ b/.github/workflows/build-test-push.yml @@ -28,7 +28,7 @@ jobs: severity: 'CRITICAL,HIGH,MEDIUM' vuln-type: os timeout: 10m0s - skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" + skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb,/opt/puppetlabs/pdk/share/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" - name: Run tests run: cd tests; ./run_tests.sh - name: Tag Docker images diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 9233c84..b174f23 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -27,7 +27,7 @@ jobs: severity: 'CRITICAL,HIGH,MEDIUM' vuln-type: os timeout: 10m0s - skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" + skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb,/opt/puppetlabs/pdk/share/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" - name: Run tests working-directory: ${{ github.workspace }}/tests run: ./run_tests.sh From 8107a2a2636e3e825d7a84367c056acfe04e1d01 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 25 Apr 2024 14:59:06 +0100 Subject: [PATCH 3/9] updated the refrences to 5.x from 4.c --- .github/workflows/publish-4x-image.yml | 18 +++++++++--------- README.md | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-4x-image.yml b/.github/workflows/publish-4x-image.yml index 4e2b077..5e910da 100644 --- a/.github/workflows/publish-4x-image.yml +++ b/.github/workflows/publish-4x-image.yml @@ -1,13 +1,13 @@ -name: "Publish images to 4.x and 4.x-rootless tags" +name: "Publish images to 5.x and 5.x-rootless tags" on: workflow_dispatch: inputs: image_tag: - description: Image tag on dockerhub to promote to the puppet-dev-tools 4.x image tag (ie. 2021-06-29-da6666a) + description: Image tag on dockerhub to promote to the puppet-dev-tools 5.x image tag (ie. 2021-06-29-da6666a) required: true image_tag_rootless: - description: Image tag on dockerhub to promote to the puppet-dev-tools 4.x-rootless image tag (ie. 2021-06-29-da6666a-rootless) + description: Image tag on dockerhub to promote to the puppet-dev-tools 5.x-rootless image tag (ie. 2021-06-29-da6666a-rootless) required: true jobs: @@ -33,16 +33,16 @@ jobs: vuln-type: os timeout: 10m0s skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" - - name: Publish standard image to 4.x + - name: Publish standard image to 5.x env: IMAGE_TAG: ${{ github.event.inputs.image_tag }} run: | - docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:4.x - docker push ${IMAGE_BASE}:4.x - - name: Publish rootless image to 4.x-rootless + docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:5.x + docker push ${IMAGE_BASE}:5.x + - name: Publish rootless image to 5.x-rootless env: IMAGE_TAG: ${{ github.event.inputs.image_tag_rootless }} run: | docker pull ${IMAGE_BASE}:${IMAGE_TAG} - docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:4.x-rootless - docker push ${IMAGE_BASE}:4.x-rootless + docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:5.x-rootless + docker push ${IMAGE_BASE}:5.x-rootless diff --git a/README.md b/README.md index ac5848e..23a4db9 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ ## Docker Tags -- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `4.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. +- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `5.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. - `----rootless`: This is just like the tag above but the container runs as a user namecd `puppetdev`. -- `4.x`: This the tag that is used in the 4.x versions of CD4PE. This tag is updated manually from time to time. +- `5.x`: This the tag that is used in the 5.x versions of CD4PE. This tag is updated manually from time to time. - `latest`: This is a legacy tag and not not actually the current build of puppet-dev-tools. It is the build used in older versions of CD4PE (prior to 4.0). These builds are manually created by the CD4PE team. ## Running @@ -19,14 +19,14 @@ You can use this container by running `docker run --rm -v $(pwd):/repo puppet/pu ## Supported Commands 1. PDK - `pdk` - - run `docker run --rm puppet/puppet-dev-tools:4.x pdk --help` to see builtin help + - run `docker run --rm puppet/puppet-dev-tools:5.x pdk --help` to see builtin help - see the [PDK command reference](https://puppet.com/docs/pdk/1.x/pdk_reference.html) for details 2. Onceover - `onceover` - - run `docker run --rm puppet/puppet-dev-tools:4.x onceover --help` to see builtin help + - run `docker run --rm puppet/puppet-dev-tools:5.x onceover --help` to see builtin help - see [Onceover's readme](https://github.com/dylanratcliffe/onceover/blob/master/README.md) for details 3. Rake tasks from the installed gems (see below) - - run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:4.x rake -f /Rakefile lint` - - run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:4.x rake -f /Rakefile lint syntax yamllint` + - run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:5.x rake -f /Rakefile lint` + - run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:5.x rake -f /Rakefile lint syntax yamllint` ### A note on Onceover usage From 20924941d318d334464000dcee005c191f62c085 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 25 Apr 2024 17:41:32 +0100 Subject: [PATCH 4/9] Renamed the workflow file to 5x from 4x --- .../workflows/{publish-4x-image.yml => publish-5x-image.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{publish-4x-image.yml => publish-5x-image.yml} (98%) diff --git a/.github/workflows/publish-4x-image.yml b/.github/workflows/publish-5x-image.yml similarity index 98% rename from .github/workflows/publish-4x-image.yml rename to .github/workflows/publish-5x-image.yml index 5e910da..7073ff8 100644 --- a/.github/workflows/publish-4x-image.yml +++ b/.github/workflows/publish-5x-image.yml @@ -11,7 +11,7 @@ on: required: true jobs: - publish-4x-image: + publish-5x-image: runs-on: ubuntu-latest env: IMAGE_BASE: "${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools" From 0e0d2c7d4782eb1e8fb41202689c9409dfcd5d52 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Apr 2024 16:03:17 +0100 Subject: [PATCH 5/9] Renamed and retitled the publish workflow --- .../workflows/{publish-5x-image.yml => publish-4x-image.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{publish-5x-image.yml => publish-4x-image.yml} (97%) diff --git a/.github/workflows/publish-5x-image.yml b/.github/workflows/publish-4x-image.yml similarity index 97% rename from .github/workflows/publish-5x-image.yml rename to .github/workflows/publish-4x-image.yml index 7073ff8..5dff83c 100644 --- a/.github/workflows/publish-5x-image.yml +++ b/.github/workflows/publish-4x-image.yml @@ -1,4 +1,4 @@ -name: "Publish images to 5.x and 5.x-rootless tags" +name: "Publish images to 4.x and 4.x-rootless tags" on: workflow_dispatch: From d58cdcfed035dde06575b895de19ddc4bdd22f1a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Apr 2024 17:10:04 +0100 Subject: [PATCH 6/9] changed the tags from 5.x to pdk3 --- .github/workflows/publish-4x-image.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-4x-image.yml b/.github/workflows/publish-4x-image.yml index 5dff83c..1959812 100644 --- a/.github/workflows/publish-4x-image.yml +++ b/.github/workflows/publish-4x-image.yml @@ -4,10 +4,10 @@ on: workflow_dispatch: inputs: image_tag: - description: Image tag on dockerhub to promote to the puppet-dev-tools 5.x image tag (ie. 2021-06-29-da6666a) + description: Image tag on dockerhub to promote to the puppet-dev-tools pdk3 image tag (ie. 2021-06-29-da6666a) required: true image_tag_rootless: - description: Image tag on dockerhub to promote to the puppet-dev-tools 5.x-rootless image tag (ie. 2021-06-29-da6666a-rootless) + description: Image tag on dockerhub to promote to the puppet-dev-tools pdk3-rootless image tag (ie. 2021-06-29-da6666a-rootless) required: true jobs: @@ -33,16 +33,16 @@ jobs: vuln-type: os timeout: 10m0s skip-files: "/root/.pdk/cache/ruby/*/gems/aws-sdk-core-*/lib/aws-sdk-ssooidc/client.rb" - - name: Publish standard image to 5.x + - name: Publish standard image to pdk3 env: IMAGE_TAG: ${{ github.event.inputs.image_tag }} run: | - docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:5.x - docker push ${IMAGE_BASE}:5.x - - name: Publish rootless image to 5.x-rootless + docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:pdk3 + docker push ${IMAGE_BASE}:pdk3 + - name: Publish rootless image to pdk3-rootless env: IMAGE_TAG: ${{ github.event.inputs.image_tag_rootless }} run: | docker pull ${IMAGE_BASE}:${IMAGE_TAG} - docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:5.x-rootless - docker push ${IMAGE_BASE}:5.x-rootless + docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:pdk3-rootless + docker push ${IMAGE_BASE}:pdk3-rootless From d4edcda5c2ec8828e94f5de533f1d988df9484e2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 9 May 2024 15:24:54 +0100 Subject: [PATCH 7/9] updated Onceover and the puppet gem to puppet 8 --- Dockerfile | 2 +- Gemfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 863c83b..89d94b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # specifying the platform here allows builds to work # correctly on Apple Silicon machines -FROM --platform=amd64 ruby:3.0.6-slim-buster as base +FROM --platform=amd64 ruby:3.1.0-slim-buster as base ARG VCS_REF ARG GH_USER=puppetlabs diff --git a/Gemfile b/Gemfile index 37e3d77..5827215 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,11 @@ source 'https://rubygems.org' +gem 'puppet', '~> 8.4' +gem 'onceover', '~> 3.22' gem 'ffi', '~> 1.12', '>= 1.12.2' gem 'hiera-eyaml', '~> 3.2', '>= 3.2.1' gem 'json', '~> 2.3' gem 'nokogiri', '~> 1.10', '>= 1.10.9' -gem 'onceover', '~> 3.20', '>= 3.20.0' gem 'onceover-codequality', '~> 0.8', '>= 0.8.0' gem 'onceover-octocatalog-diff', '~> 0.1', '>= 0.1.8' gem 'onceover-lookup', '~> 0.1', '>= 0.1.1' @@ -20,7 +21,6 @@ gem 'puppet-lint-version_comparison-check', '~> 1.0' gem 'puppet-lint', '~> 2.4' gem 'puppet-strings', '~> 2.6' gem 'puppet-syntax', '~> 3.2.0' -gem 'puppet', '~> 7.5' gem 'puppetlabs_spec_helper', '~> 5.0' gem 'r10k', '~> 3.8' gem 'ra10ke', '~> 1.0' From 2f94743cb4506273b659efc5539df9c1fd47050e Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Thu, 9 May 2024 10:33:59 -0700 Subject: [PATCH 8/9] Update Build-Test-Push job to publish `puppet8` images Previously this job would publish "latest" and timestamped images, but when producing images with Puppet 8 tooling, we don't want these images, as they are easily confused with the versions produced from `main`. Instead, this job should be used to release a new `puppet8` image, by triggering it from the `puppet8` branch of the repo. --- .github/workflows/build-test-push.yml | 27 +++++---------------------- README.md | 7 ++++--- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-test-push.yml b/.github/workflows/build-test-push.yml index 67e30f2..01f48c9 100644 --- a/.github/workflows/build-test-push.yml +++ b/.github/workflows/build-test-push.yml @@ -2,13 +2,6 @@ name: Build-Test-Push on: workflow_dispatch: - inputs: - tag: - description: Optional tag to create in addition to the `latest` and `-` image tags. - required: false - push: - branches: - - main jobs: Build-Test-Push: @@ -33,26 +26,16 @@ jobs: run: cd tests; ./run_tests.sh - name: Tag Docker images run: | - docker tag puppet-dev-tools:latest-rootless ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)-rootless - docker tag puppet-dev-tools:latest ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD) - - name: Additional Tag - if: inputs.tag - run: | - docker tag puppet-dev-tools:latest-rootless ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}-rootless - docker tag puppet-dev-tools:latest ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }} + docker tag puppet-dev-tools:latest-rootless ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:puppet8-rootless + docker tag puppet-dev-tools:latest ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:puppet8 - name: List Docker images run: docker images --filter "reference=puppet-dev-tools*" --filter "reference=*/puppet-dev-tools*" - name: Show Docker image labels run: | - docker inspect --format='{{json .Config.Labels}}' ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD) + docker inspect --format='{{json .Config.Labels}}' ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:puppet8 - name: Login to Docker Hub run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} --password-stdin - name: Push Docker images run: | - docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)-rootless - docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD) - - name: Push Additional Tag - if: inputs.tag - run: | - docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }}-rootless - docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:${{ inputs.tag }} + docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:puppet8-rootless + docker push ${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools:puppet8 diff --git a/README.md b/README.md index 23a4db9..3f7cdb9 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,11 @@ ## Docker Tags -- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `5.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. -- `----rootless`: This is just like the tag above but the container runs as a user namecd `puppetdev`. -- `5.x`: This the tag that is used in the 5.x versions of CD4PE. This tag is updated manually from time to time. +- `---`: Each merge to master generates an image tagged with the date of its build followed by a short git SHA. These images are suitable for pinning to if you do not wish to live on the edge with `4.x`. Changes from one image to the next will include things shown in the [commit history](https://github.com/puppetlabs/puppet-dev-tools/commits/master) on GitHub and updated operating system packages pulled in at build time. +- `----rootless`: This is just like the tag above but the container runs as a user named `puppetdev`. +- `4.x`: This the tag that is shipped by default in CD4PE. This tag is updated manually from time to time. - `latest`: This is a legacy tag and not not actually the current build of puppet-dev-tools. It is the build used in older versions of CD4PE (prior to 4.0). These builds are manually created by the CD4PE team. +- `puppet8`: This tag contains tooling updates to support Puppet 8. Use this image if you want to test code that has been updated for Puppet 8. This tag is updated manually from time to time. ## Running From 5e88906ec6b5d774c34785ba6aee0781ae4e1e85 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Thu, 9 May 2024 10:57:44 -0700 Subject: [PATCH 9/9] Use puppet8 tag in readme updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3f7cdb9..87638bd 100644 --- a/README.md +++ b/README.md @@ -20,21 +20,21 @@ You can use this container by running `docker run --rm -v $(pwd):/repo puppet/pu ## Supported Commands 1. PDK - `pdk` - - run `docker run --rm puppet/puppet-dev-tools:5.x pdk --help` to see builtin help - - see the [PDK command reference](https://puppet.com/docs/pdk/1.x/pdk_reference.html) for details + - run `docker run --rm puppet/puppet-dev-tools:puppet8 pdk --help` to see builtin help + - see the [PDK command reference](https://www.puppet.com/docs/pdk/3.x/pdk_reference.html) for details 2. Onceover - `onceover` - - run `docker run --rm puppet/puppet-dev-tools:5.x onceover --help` to see builtin help + - run `docker run --rm puppet/puppet-dev-tools:puppet8 onceover --help` to see builtin help - see [Onceover's readme](https://github.com/dylanratcliffe/onceover/blob/master/README.md) for details 3. Rake tasks from the installed gems (see below) - - run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:5.x rake -f /Rakefile lint` - - run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:5.x rake -f /Rakefile lint syntax yamllint` + - run a single rake task like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 rake -f /Rakefile lint` + - run multiple rake tasks sequentially like so: `docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 rake -f /Rakefile lint syntax yamllint` ### A note on Onceover usage If your control repository contains a Gemfile you will likely want to modify the commands listed above to something like this: ```bash -docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:latest \ +docker run --rm -v $(pwd):/repo puppet/puppet-dev-tools:puppet8 \ /bin/bash -c "bundle install && bundle exec onceover run spec --force --trace --parallel" ```