diff --git a/.fixtures.yml b/.fixtures.yml index 76f7f00d5..df8b86660 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,5 +1,9 @@ --- -# Workaround SIMP-5498 (BEAKER_fips=yes requires a .fixtures.yaml) +# Workaround SIMP-5498 (BEAKER_fips=yes requires a .fixtures.yml) +# +# puppet_fixtures (via voxpupuli-test) does not interpolate the old +# "#{source_dir}" tokens. Targets are written relative to the link location +# (spec/fixtures/modules/). fixtures: symlinks: - garbage: "#{source_dir}/spec/fixtures/empty" + garbage: "../empty" diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index dabc38d07..546f60a79 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -7,7 +7,7 @@ on: env: # Required to prevent all rake tasks from exploding - SIMP_RPM_dist: .el7 + SIMP_RPM_dist: .el8 jobs: validate-yaml: @@ -17,10 +17,11 @@ jobs: - uses: actions/checkout@v7 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.4.9 bundler-cache: true - - run: 'command -v rpm || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||:' + - run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:' - run: bundle exec rake check:syntax:yaml + - run: bundle exec rake check:pkglist_lint rpm_checks: name: RPM checks @@ -29,11 +30,10 @@ jobs: - uses: actions/checkout@v7 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.4.9 bundler-cache: true - - run: 'command -v rpm || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||:' + - run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:' - run: | - command -v rpm || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||: bundle exec rake check:dot_underscore bundle exec rake check:test_file @@ -44,9 +44,39 @@ jobs: - uses: actions/checkout@v7 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.4.9 bundler-cache: true - - run: 'command -v rpm || if command -v apt-get; then apt-get update; apt-get install -y rpm; fi ||:' - - run: | - bundle exec rake metadata_lint - bundle exec pdk build --force --target-dir=dist + - run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:' + - run: bundle exec rake metadata_lint + - name: 'Test-build the Puppet module' + run: bundle exec rake pupmod:build + + spec-tests: + name: Puppetfile checks + runs-on: ubuntu-24.04 + strategy: + matrix: + puppet: + - label: 'OpenVox 8.x (Ruby 3.2)' + puppet_version: '~> 8.0' + ruby_version: '3.2' + - label: 'OpenVox 8.x (Ruby 3.4)' + puppet_version: '~> 8.0' + ruby_version: '3.4' + # OpenVox 9 is unreleased; preview the future Ruby 4.0 / OpenVox 9 + # combo by running the OpenVox 8 gem on Ruby 4.0. + - label: 'OpenVox 9.x preview (Ruby 4.0, OpenVox 8 gem)' + puppet_version: '~> 8.0' + ruby_version: '4.0' + fail-fast: false + env: + PUPPET_VERSION: ${{matrix.puppet.puppet_version}} + steps: + - uses: actions/checkout@v7 + - name: 'Install Ruby ${{matrix.puppet.ruby_version}}' + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{matrix.puppet.ruby_version}} + bundler-cache: true + - run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:' + - run: bundle exec rake spec diff --git a/.rubocop.yml b/.rubocop.yml index 0747c7cea..65c8c0ab0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,112 +1,79 @@ --- require: -- rubocop-rspec -- rubocop-i18n + - rubocop-performance + - rubocop-rake + - rubocop-rspec AllCops: + NewCops: enable DisplayCopNames: true - TargetRubyVersion: '2.6' + TargetRubyVersion: "2.7" Include: - - "**/*.rb" + - "**/*.rb" Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: true + - bin/* + - ".vendor/**/*" + - pkg/**/* + - spec/fixtures/**/* + - vendor/**/* + - "**/Puppetfile" + - "**/Vagrantfile" + - "**/Guardfile" Layout/LineLength: Description: People have wide screens, use them. Max: 200 -Layout/SpaceAroundMethodCallOperator: - Enabled: true -Lint/RaiseException: - Enabled: true -Lint/StructNewOverride: - Enabled: false -I18n/GetText: - Enabled: false -I18n/GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false -Naming/AccessorMethodName: - Exclude: - - spec/**/* RSpec/BeforeAfterAll: - Description: Beware of using after(:all) as it may cause state to leak between tests. + 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/ExpectInHook: - Exclude: - - spec/unit/**/*.rb + - spec/acceptance/**/*.rb RSpec/HookArgument: Description: Prefer explicit :each argument, matching existing module's style EnforcedStyle: each -RSpec/NamedSubject: +RSpec/DescribeSymbol: Exclude: - - spec/classes/**/* - - spec/defines/**/* + - spec/unit/facter/**/*.rb Style/BlockDelimiters: - Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to + Description: + Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining Style/ClassAndModuleChildren: - Description: Nested style is safest for all implementations - EnforcedStyle: nested + 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/ExponentialNotation: - Enabled: true 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 + Description: + Following the main puppet project's style, prefer the simpler template tokens over annotated ones. EnforcedStyle: template -Style/HashEachMethods: - Enabled: true -Style/HashSyntax: - Enabled: false -Style/HashTransformKeys: - Enabled: false -Style/HashTransformValues: - Enabled: true Style/Lambda: Description: Prefer the keyword for easier discoverability. EnforcedStyle: literal -Style/MixinUsage: - Exclude: - - spec/**/* -Style/RedundantBegin: - Enabled: false 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 + 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 + 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, + Description: + Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma -Style/SlicingWithRange: - Enabled: true Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets @@ -114,30 +81,176 @@ RSpec/MessageSpies: EnforcedStyle: receive Style/Documentation: Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* + - 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 -I18n/GetText/DecorateFunctionMessage: +Bundler/GemFilename: + Enabled: false +Bundler/InsecureProtocolSource: + 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 -I18n/GetText/DecorateStringFormattingUsingInterpolation: +Layout/EmptyLineAfterGuardClause: Enabled: false -I18n/GetText/DecorateStringFormattingUsingPercent: +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: @@ -150,21 +263,437 @@ 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/Dialect: + 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/MessageExpectation: +RSpec/ExampleWithoutDescription: + Enabled: false +RSpec/ExpectChange: + Enabled: false +RSpec/ExpectInHook: + 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 -Style/AsciiComments: +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 +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/DuplicateMatchPattern: + 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/IdenticalEqualityAssertion: + Enabled: false +RSpec/NoExpectationExample: + Enabled: false +RSpec/PendingWithoutReason: + 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/DataInheritance: + 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/RedundantLineContinuation: + 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/AGENTS.md b/AGENTS.md index fad7cbcc5..a684a3973 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -61,19 +61,18 @@ The Rakefile also loads `simp-rake-helpers` (`Simp::Rake::Build::Helpers`) which - `yum_data/` — repo configs and `packages.yaml` (external package manifest) - `release_mappings.yaml` — official SIMP releases for that distro - Output dirs created at build time: `SIMP/`, `SIMP_ISO/`, `SIMP_ISO_STAGING/` -- `build/Dockerfiles/` — Docker images for isolated build (`SIMP_EL7_Build`, `SIMP_EL8_Build`) and acceptance testing (`SIMP_EL7_Beaker`, `SIMP_EL8_Beaker`) +- `build/Dockerfiles/` — Docker images for isolated build (`SIMP_EL{8,9,10}_Build`) and acceptance testing (`SIMP_EL{8,9,10}_Beaker`) - `build/metadata.yaml` — controls which distros are enabled for builds; override with `SIMP_BUILD_distro=CentOS,7,x86_64` ### CI (`.github/workflows/`) -- **`pr_checks.yml`** — runs on PRs: YAML lint, RPM file checks (`rake check:dot_underscore`, `rake check:test_file`), metadata lint, and `pdk build`; sets `SIMP_RPM_dist=.el7` +- **`pr_checks.yml`** — runs on PRs: YAML lint, package list lint, RPM file checks (`rake check:dot_underscore`, `rake check:test_file`), metadata lint, a module test-build (`rake pupmod:build`), and the spec suite (Puppetfile validation) on Ruby 3.2/3.4/4.0 with the OpenVox 8 gem; sets `SIMP_RPM_dist=.el8` - **`containers.yml`** — builds all `build/Dockerfiles/` images. On PRs touching the Dockerfiles it builds every image without pushing (pre-merge validation); on push to master (path-filtered), a weekly schedule, and manual dispatch it builds and pushes to `ghcr.io` tagged `latest` + `YYYYMMDD` - **`build_container.yml`** — reusable (`workflow_call`) workflow that builds/pushes a single image; called by `containers.yml` and `build_containers.yml` - **`build_containers.yml`** — manual (`workflow_dispatch`) single-image build + publish for ad-hoc rebuilds (specific Ruby version, git ref, or extra tag) ### Gemfile Notes -- `PUPPET_VERSION` env var pins Puppet gem (default: `>= 7, < 9`) +- `PUPPET_VERSION` env var pins the Puppet/OpenVox gem version (default: `>= 8, < 9`); `OPENVOX_VERSION` overrides it for the `openvox` gem specifically - `GEM_SERVERS` env var overrides gem sources - Optional extra Gemfiles: `Gemfile.project`, `Gemfile.local`, `~/.gemfile` -- `PDK_DISABLE_ANALYTICS=true` is set automatically diff --git a/Gemfile b/Gemfile index 578851427..5f9aa5172 100644 --- a/Gemfile +++ b/Gemfile @@ -1,32 +1,39 @@ gem_sources = ENV.fetch('GEM_SERVERS', 'https://rubygems.org').split(%r{[, ]+}) -ENV['PDK_DISABLE_ANALYTICS'] ||= 'true' - gem_sources.each { |gem_source| source gem_source } +group :syntax do + gem 'metadata-json-lint' + gem 'puppet-lint-trailing_comma-check', require: false + # rubocop, rubocop-rake, and rubocop-rspec are pulled in and version-pinned by + # voxpupuli-test (via simp-rake-helpers); pinning them here conflicts with its + # constraints. rubocop-performance is not a voxpupuli-test dependency, so it + # stays explicit. + gem 'rubocop-performance', '~> 1.26.0' +end + group :test do - puppet_version = ENV.fetch('PUPPET_VERSION', ['>= 7', '< 9']) - major_puppet_version = Array(puppet_version).first.scan(%r{(\d+)(?:\.|\Z)}).flatten.first.to_i + puppet_version = ENV.fetch('PUPPET_VERSION', ['>= 8', '< 9']) + openvox_version = ENV.fetch('OPENVOX_VERSION', puppet_version) gem 'hiera-puppet-helper' - gem 'metadata-json-lint' + # highline and nokogiri are required directly by the puppetfile:check tasks + # in the Rakefile + gem 'highline' gem 'naturally' - gem 'pathspec', '~> 0.2' if Gem::Requirement.create('< 2.6').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - # renovate: datasource=rubygems versioning=ruby - gem('pdk', ENV.fetch('PDK_VERSION', ['>= 2.0', '< 4.0']), require: false) if major_puppet_version > 5 - gem 'puppet', puppet_version - gem 'puppet-lint-trailing_comma-check', :require => false - gem 'puppet-strings' - gem 'puppetlabs_spec_helper', '~> 8.0.0' + gem 'nokogiri' + gem 'openvox', openvox_version gem 'rake' gem 'rspec' gem 'rspec-puppet' # renovate: datasource=rubygems versioning=ruby gem 'simp-build-helpers', ENV.fetch('SIMP_BUILD_HELPERS_VERSION', ['> 0.1', '< 2.0']) # renovate: datasource=rubygems versioning=ruby - gem 'simp-rake-helpers', ENV.fetch('SIMP_RAKE_HELPERS_VERSION', '~> 5.24.0') + gem 'simp-rake-helpers', ENV.fetch('SIMP_RAKE_HELPERS_VERSION', '~> 6.0') # renovate: datasource=rubygems versioning=ruby gem 'simp-rspec-puppet-facts', ENV.fetch('SIMP_RSPEC_PUPPET_FACTS_VERSION', '~> 4.0.0') gem 'terminal-table' + gem 'syslog', require: false + gem 'observer', require: false end group :development do @@ -40,7 +47,7 @@ group :system_tests do gem 'beaker' gem 'beaker-rspec' # renovate: datasource=rubygems versioning=ruby - gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', '~> 2.0.0') + gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', '~> 3.1') end # Evaluate extra gemfiles if they exist diff --git a/Rakefile b/Rakefile index 18b2c9407..66aa02137 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,7 @@ require 'naturally' require 'simp/rake/pupmod/helpers' +require 'simp/rake/pupmod/module_build' require 'simp/rake/build/deps' Simp::Rake::Beaker.new(File.dirname(__FILE__)) diff --git a/metadata.json b/metadata.json index 06b2ab6d2..a8dee18b8 100644 --- a/metadata.json +++ b/metadata.json @@ -293,43 +293,48 @@ ], "requirements": [ { - "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "name": "openvox", + "version_requirement": ">= 8.0.0 < 9.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "9" + "9", + "10" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "Rocky", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] } ] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1b21aa4d4..e872e8a61 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # ------------------------------------------------------------------------------ # NOTICE: **This file is maintained with puppetsync** @@ -7,7 +8,7 @@ # The next baseline sync will overwrite any local changes made to this file. # ------------------------------------------------------------------------------ -require 'puppetlabs_spec_helper/module_spec_helper' +require 'voxpupuli/test/spec_helper' require 'rspec-puppet' require 'simp/rspec-puppet-facts' include Simp::RspecPuppetFacts @@ -27,10 +28,6 @@ --- version: 5 hierarchy: - - name: SIMP Compliance Engine - lookup_key: compliance_markup::enforcement - options: - enabled_sce_versions: [2] - name: Custom Test Hiera path: "%{custom_hiera}.yaml" - name: "%{module_name}" @@ -90,7 +87,7 @@ def set_hieradata(hieradata) # If nothing else... c.default_facts = { production: { - #:fqdn => 'production.rspec.test.localdomain', + # :fqdn => 'production.rspec.test.localdomain', path: '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin', concat_basedir: '/tmp' } @@ -100,7 +97,6 @@ def set_hieradata(hieradata) c.mock_with :rspec c.module_path = File.join(fixture_path, 'modules') - c.manifest_dir = File.join(fixture_path, 'manifests') if c.respond_to?(:manifest_dir) c.hiera_config = File.join(fixture_path, 'hieradata', 'hiera.yaml') @@ -151,9 +147,9 @@ def set_hieradata(hieradata) # sanitize hieradata if defined?(hieradata) - set_hieradata(hieradata.gsub(':', '_')) + set_hieradata(hieradata.tr(':', '_')) elsif defined?(class_name) - set_hieradata(class_name.gsub(':', '_')) + set_hieradata(class_name.tr(':', '_')) end end @@ -165,9 +161,7 @@ def set_hieradata(hieradata) end Dir.glob("#{RSpec.configuration.module_path}/*").each do |dir| - begin - Pathname.new(dir).realpath - rescue StandardError - raise "ERROR: The module '#{dir}' is not installed. Tests cannot continue." - end + Pathname.new(dir).realpath +rescue StandardError + raise "ERROR: The module '#{dir}' is not installed. Tests cannot continue." end diff --git a/spec/unit/00_puppetfile_validation_spec.rb b/spec/unit/00_puppetfile_validation_spec.rb index ca9b25ac6..ef1b1001e 100644 --- a/spec/unit/00_puppetfile_validation_spec.rb +++ b/spec/unit/00_puppetfile_validation_spec.rb @@ -2,8 +2,7 @@ require 'spec_helper' describe 'Puppetfile Validation' do - top_dir = File.absolute_path(fixtures).split('/') - top_dir = top_dir[0..-(fixtures.split('/').count + 1)].join('/') + top_dir = File.absolute_path(File.join(__dir__, '..', '..')) before(:each) do @tmpdir = Dir.mktmpdir @@ -46,7 +45,7 @@ (duplicate_refs[k] = git_refs[k]) if (v.size > 1) end - expect(JSON.pretty_generate(duplicate_refs)).to eq("{\n}") + expect(duplicate_refs).to be_empty, "Duplicate :git sources found:\n#{JSON.pretty_generate(duplicate_refs)}" end end end