Skip to content

Commit 8295ac5

Browse files
committed
(CONT-944) PDK update module for release prep
Prior to this commit, the new release prep workflow was failing as it was using old ruby and puppet versions. This commit addresses this by applying a pdk update and updating the puppet version requirement in the metadata and fixing puppet-lint warnings
1 parent 025f937 commit 8295ac5

File tree

11 files changed

+299
-47
lines changed

11 files changed

+299
-47
lines changed

.pdkignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,16 @@
2626
.envrc
2727
/inventory.yaml
2828
/spec/fixtures/litmus_inventory.yaml
29-
/appveyor.yml
3029
/.fixtures.yml
3130
/Gemfile
3231
/.gitattributes
3332
/.gitignore
34-
/.gitlab-ci.yml
3533
/.pdkignore
3634
/.puppet-lint.rc
3735
/Rakefile
3836
/rakelib/
3937
/.rspec
40-
/.rubocop.yml
41-
/.travis.yml
38+
/..yml
4239
/.yardopts
4340
/spec/
4441
/.vscode/

.rubocop.yml

Lines changed: 210 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require:
44
- rubocop-rspec
55
AllCops:
66
DisplayCopNames: true
7-
TargetRubyVersion: '2.4'
7+
TargetRubyVersion: '2.6'
88
Include:
99
- "**/*.rb"
1010
Exclude:
@@ -111,8 +111,14 @@ Style/MethodCalledOnDoEndBlock:
111111
Enabled: true
112112
Style/StringMethods:
113113
Enabled: true
114+
Bundler/GemFilename:
115+
Enabled: false
114116
Bundler/InsecureProtocolSource:
115117
Enabled: false
118+
Capybara/CurrentPathExpectation:
119+
Enabled: false
120+
Capybara/VisibilityMatcher:
121+
Enabled: false
116122
Gemspec/DuplicatedAssignment:
117123
Enabled: false
118124
Gemspec/OrderedDependencies:
@@ -287,11 +293,9 @@ Performance/UriDefaultParser:
287293
Enabled: false
288294
RSpec/Be:
289295
Enabled: false
290-
RSpec/Capybara/CurrentPathExpectation:
291-
Enabled: false
292296
RSpec/Capybara/FeatureMethods:
293297
Enabled: false
294-
RSpec/Capybara/VisibilityMatcher:
298+
RSpec/ContainExactly:
295299
Enabled: false
296300
RSpec/ContextMethod:
297301
Enabled: false
@@ -331,6 +335,8 @@ RSpec/LeakyConstantDeclaration:
331335
Enabled: false
332336
RSpec/LetBeforeExamples:
333337
Enabled: false
338+
RSpec/MatchArray:
339+
Enabled: false
334340
RSpec/MissingExampleGroupArgument:
335341
Enabled: false
336342
RSpec/MultipleExpectations:
@@ -373,8 +379,6 @@ Style/AccessModifierDeclarations:
373379
Enabled: false
374380
Style/AccessorGrouping:
375381
Enabled: false
376-
Style/AsciiComments:
377-
Enabled: false
378382
Style/BisectedAttrAccessor:
379383
Enabled: false
380384
Style/CaseLikeIf:
@@ -485,35 +489,235 @@ Style/TrailingMethodEndStatement:
485489
Enabled: false
486490
Style/UnpackFirst:
487491
Enabled: false
492+
Capybara/MatchStyle:
493+
Enabled: false
494+
Capybara/NegationMatcher:
495+
Enabled: false
496+
Capybara/SpecificActions:
497+
Enabled: false
498+
Capybara/SpecificFinders:
499+
Enabled: false
500+
Capybara/SpecificMatcher:
501+
Enabled: false
502+
Gemspec/DeprecatedAttributeAssignment:
503+
Enabled: false
504+
Gemspec/DevelopmentDependencies:
505+
Enabled: false
506+
Gemspec/RequireMFA:
507+
Enabled: false
508+
Layout/LineContinuationLeadingSpace:
509+
Enabled: false
510+
Layout/LineContinuationSpacing:
511+
Enabled: false
512+
Layout/LineEndStringConcatenationIndentation:
513+
Enabled: false
514+
Layout/SpaceBeforeBrackets:
515+
Enabled: false
516+
Lint/AmbiguousAssignment:
517+
Enabled: false
518+
Lint/AmbiguousOperatorPrecedence:
519+
Enabled: false
520+
Lint/AmbiguousRange:
521+
Enabled: false
522+
Lint/ConstantOverwrittenInRescue:
523+
Enabled: false
524+
Lint/DeprecatedConstants:
525+
Enabled: false
488526
Lint/DuplicateBranch:
489527
Enabled: false
528+
Lint/DuplicateMagicComment:
529+
Enabled: false
490530
Lint/DuplicateRegexpCharacterClassElement:
491531
Enabled: false
492532
Lint/EmptyBlock:
493533
Enabled: false
494534
Lint/EmptyClass:
495535
Enabled: false
536+
Lint/EmptyInPattern:
537+
Enabled: false
538+
Lint/IncompatibleIoSelectWithFiberScheduler:
539+
Enabled: false
540+
Lint/LambdaWithoutLiteralBlock:
541+
Enabled: false
496542
Lint/NoReturnInBeginEndBlocks:
497543
Enabled: false
544+
Lint/NonAtomicFileOperation:
545+
Enabled: false
546+
Lint/NumberedParameterAssignment:
547+
Enabled: false
548+
Lint/OrAssignmentToConstant:
549+
Enabled: false
550+
Lint/RedundantDirGlobSort:
551+
Enabled: false
552+
Lint/RefinementImportMethods:
553+
Enabled: false
554+
Lint/RequireRangeParentheses:
555+
Enabled: false
556+
Lint/RequireRelativeSelfPath:
557+
Enabled: false
558+
Lint/SymbolConversion:
559+
Enabled: false
498560
Lint/ToEnumArguments:
499561
Enabled: false
562+
Lint/TripleQuotes:
563+
Enabled: false
500564
Lint/UnexpectedBlockArity:
501565
Enabled: false
502566
Lint/UnmodifiedReduceAccumulator:
503567
Enabled: false
568+
Lint/UselessRescue:
569+
Enabled: false
570+
Lint/UselessRuby2Keywords:
571+
Enabled: false
572+
Metrics/CollectionLiteralLength:
573+
Enabled: false
574+
Naming/BlockForwarding:
575+
Enabled: false
504576
Performance/CollectionLiteralInLoop:
505577
Enabled: false
578+
Performance/ConcurrentMonotonicTime:
579+
Enabled: false
580+
Performance/MapCompact:
581+
Enabled: false
582+
Performance/RedundantEqualityComparisonBlock:
583+
Enabled: false
584+
Performance/RedundantSplitRegexpArgument:
585+
Enabled: false
586+
Performance/StringIdentifierArgument:
587+
Enabled: false
588+
RSpec/BeEq:
589+
Enabled: false
590+
RSpec/BeNil:
591+
Enabled: false
592+
RSpec/ChangeByZero:
593+
Enabled: false
594+
RSpec/ClassCheck:
595+
Enabled: false
596+
RSpec/DuplicatedMetadata:
597+
Enabled: false
598+
RSpec/ExcessiveDocstringSpacing:
599+
Enabled: false
600+
RSpec/FactoryBot/ConsistentParenthesesStyle:
601+
Enabled: false
602+
RSpec/FactoryBot/FactoryNameStyle:
603+
Enabled: false
604+
RSpec/FactoryBot/SyntaxMethods:
605+
Enabled: false
606+
RSpec/IdenticalEqualityAssertion:
607+
Enabled: false
608+
RSpec/NoExpectationExample:
609+
Enabled: false
610+
RSpec/PendingWithoutReason:
611+
Enabled: false
612+
RSpec/Rails/AvoidSetupHook:
613+
Enabled: false
614+
RSpec/Rails/HaveHttpStatus:
615+
Enabled: false
616+
RSpec/Rails/InferredSpecType:
617+
Enabled: false
618+
RSpec/Rails/MinitestAssertions:
619+
Enabled: false
620+
RSpec/Rails/TravelAround:
621+
Enabled: false
622+
RSpec/RedundantAround:
623+
Enabled: false
624+
RSpec/SkipBlockInsideExample:
625+
Enabled: false
626+
RSpec/SortMetadata:
627+
Enabled: false
628+
RSpec/SubjectDeclaration:
629+
Enabled: false
630+
RSpec/VerifiedDoubleReference:
631+
Enabled: false
632+
Security/CompoundHash:
633+
Enabled: false
634+
Security/IoMethods:
635+
Enabled: false
506636
Style/ArgumentsForwarding:
507637
Enabled: false
638+
Style/ArrayIntersect:
639+
Enabled: false
508640
Style/CollectionCompact:
509641
Enabled: false
642+
Style/ComparableClamp:
643+
Enabled: false
644+
Style/ConcatArrayLiterals:
645+
Enabled: false
646+
Style/DirEmpty:
647+
Enabled: false
510648
Style/DocumentDynamicEvalDefinition:
511649
Enabled: false
650+
Style/EmptyHeredoc:
651+
Enabled: false
652+
Style/EndlessMethod:
653+
Enabled: false
654+
Style/EnvHome:
655+
Enabled: false
656+
Style/FetchEnvVar:
657+
Enabled: false
658+
Style/FileEmpty:
659+
Enabled: false
660+
Style/FileRead:
661+
Enabled: false
662+
Style/FileWrite:
663+
Enabled: false
664+
Style/HashConversion:
665+
Enabled: false
666+
Style/HashExcept:
667+
Enabled: false
668+
Style/IfWithBooleanLiteralBranches:
669+
Enabled: false
670+
Style/InPatternThen:
671+
Enabled: false
672+
Style/MagicCommentFormat:
673+
Enabled: false
674+
Style/MapCompactWithConditionalBlock:
675+
Enabled: false
676+
Style/MapToHash:
677+
Enabled: false
678+
Style/MapToSet:
679+
Enabled: false
680+
Style/MinMaxComparison:
681+
Enabled: false
682+
Style/MultilineInPatternThen:
683+
Enabled: false
512684
Style/NegatedIfElseCondition:
513685
Enabled: false
686+
Style/NestedFileDirname:
687+
Enabled: false
514688
Style/NilLambda:
515689
Enabled: false
690+
Style/NumberedParameters:
691+
Enabled: false
692+
Style/NumberedParametersLimit:
693+
Enabled: false
694+
Style/ObjectThen:
695+
Enabled: false
696+
Style/OpenStructUse:
697+
Enabled: false
698+
Style/OperatorMethodCall:
699+
Enabled: false
700+
Style/QuotedSymbols:
701+
Enabled: false
516702
Style/RedundantArgument:
517703
Enabled: false
704+
Style/RedundantConstantBase:
705+
Enabled: false
706+
Style/RedundantDoubleSplatHashBraces:
707+
Enabled: false
708+
Style/RedundantEach:
709+
Enabled: false
710+
Style/RedundantHeredocDelimiterQuotes:
711+
Enabled: false
712+
Style/RedundantInitialize:
713+
Enabled: false
714+
Style/RedundantSelfAssignmentBranch:
715+
Enabled: false
716+
Style/RedundantStringEscape:
717+
Enabled: false
718+
Style/SelectByRegexp:
719+
Enabled: false
720+
Style/StringChars:
721+
Enabled: false
518722
Style/SwapValues:
519723
Enabled: false

Gemfile

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,63 @@
11
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
22

3-
gem 'bolt'
4-
gem 'puppet_litmus'
3+
def location_for(place_or_version, fake_version = nil)
4+
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5+
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
6+
7+
if place_or_version && (git_url = place_or_version.match(git_url_regex))
8+
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9+
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10+
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
11+
else
12+
[place_or_version, { require: false }]
13+
end
14+
end
515

6-
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
7-
minor_version = ruby_version_segments[0..1].join('.')
816
group :development do
9-
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
10-
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
11-
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: %i[mswin mingw x64_mingw]
12-
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: %i[mswin mingw x64_mingw]
13-
gem 'github_changelog_generator', require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0')
14-
gem 'io-event', '0.4.0' # later versions require Ruby 3
17+
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))
18+
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))
19+
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))
20+
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))
21+
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))
22+
gem 'github_changelog_generator', require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.5.0')
23+
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
24+
gem "facterdb", '~> 1.18', require: false
25+
gem "metadata-json-lint", '~> 3.0', require: false
26+
gem "puppetlabs_spec_helper", '~> 6.0', require: false
27+
gem "rspec-puppet-facts", '~> 2.0', require: false
28+
gem "codecov", '~> 0.2', require: false
29+
gem "dependency_checker", '~> 1.0.0', require: false
30+
gem "parallel_tests", '= 3.12.1', require: false
31+
gem "pry", '~> 0.10', require: false
32+
gem "simplecov-console", '~> 0.5', require: false
33+
gem "puppet-debugger", '~> 1.0', require: false
34+
gem "rubocop", '= 1.48.1', require: false
35+
gem "rubocop-performance", '= 1.16.0', require: false
36+
gem "rubocop-rspec", '= 2.19.0', require: false
37+
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
1538
gem 'webmock'
16-
gem 'concurrent-ruby', '= 1.1.10', require: false
39+
end
40+
group :system_tests do
41+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
42+
gem "serverspec", '~> 2.41', require: false
43+
end
44+
45+
puppet_version = ENV['PUPPET_GEM_VERSION']
46+
facter_version = ENV['FACTER_GEM_VERSION']
47+
hiera_version = ENV['HIERA_GEM_VERSION']
48+
49+
gems = {}
50+
51+
gems['puppet'] = location_for(puppet_version)
52+
53+
# If facter or hiera versions have been specified via the environment
54+
# variables
55+
56+
gems['facter'] = location_for(facter_version) if facter_version
57+
gems['hiera'] = location_for(hiera_version) if hiera_version
58+
59+
gems.each do |gem_name, gem_params|
60+
gem gem_name, *gem_params
1761
end
1862

1963
# Evaluate Gemfile.local and ~/.gemfile if they exist
@@ -27,3 +71,4 @@ extra_gemfiles.each do |gemfile|
2771
eval(File.read(gemfile), binding)
2872
end
2973
end
74+
# vim: syntax=ruby

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ require 'bundler'
44
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
55
require 'puppetlabs_spec_helper/rake_tasks'
66
require 'puppet-syntax/tasks/puppet-syntax'
7-
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
87
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
98
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
109

0 commit comments

Comments
 (0)