From 43bba0ad4ed71588d88560a4f10148c745d555d5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 28 Oct 2020 20:19:29 +0100 Subject: [PATCH 1/9] add translate module as dependency --- .fixtures.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.fixtures.yml b/.fixtures.yml index e6a230c..e798308 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,6 +3,7 @@ fixtures: stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" apt: "https://github.com/puppetlabs/puppetlabs-apt.git" docker: "https://github.com/puppetlabs/puppetlabs-docker.git" + translate: "https://github.com/puppetlabs/puppetlabs-translate.git" yumrepo_core: - repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git + repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" puppet_version: ">= 6.0.0" From 52aa0daaffc6889f7e403b06b62a22da94ba1f03 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 20 Nov 2020 14:46:04 +0100 Subject: [PATCH 2/9] Drop EL6 support The docker module fails on EL7 so the tests started to fail on this. --- metadata.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/metadata.json b/metadata.json index 4e3ca74..4a52dd9 100644 --- a/metadata.json +++ b/metadata.json @@ -32,7 +32,6 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "6", "7", "8" ] @@ -40,7 +39,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6", "7", "8" ] @@ -48,7 +46,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "6", "7", "8" ] @@ -56,7 +53,6 @@ { "operatingsystem": "Scientific", "operatingsystemrelease": [ - "6", "7" ] }, From 2d7ed96e822cb9e95c2e5a2e2f655cf559ea610b Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 20 Nov 2020 16:42:08 +0100 Subject: [PATCH 3/9] Drop Amazon Linux support The latest docker module hard fails on this since it's detected as Red Hat < 7. --- metadata.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/metadata.json b/metadata.json index 4a52dd9..895796d 100644 --- a/metadata.json +++ b/metadata.json @@ -22,13 +22,6 @@ } ], "operatingsystem_support": [ - { - "operatingsystem": "Amazon", - "operatingsystemrelease": [ - "1", - "2" - ] - }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ From 5c51b2b2e5f9bf89bff2489e00ac538140aed37a Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 20 Nov 2020 14:38:03 +0100 Subject: [PATCH 4/9] Modulesync 4.1.0 --- .editorconfig | 3 +- .github/CONTRIBUTING.md | 39 +- .github/workflows/ci.yml | 81 +++ .github/workflows/release.yml | 34 ++ .gitignore | 3 + .msync.yml | 6 +- .overcommit.yml | 5 +- .pmtignore | 20 +- .rspec | 3 + .rspec_parallel | 3 + .rubocop.yml | 553 +----------------- .sync.yml | 17 - .travis.yml | 114 ---- .yardopts | 3 + Dockerfile | 5 +- Gemfile | 40 +- Rakefile | 12 +- scripts/start-gitlab.sh | 5 - spec/acceptance/nodesets/archlinux-2-x64.yml | 13 - .../nodesets/ec2/amazonlinux-2016091.yml | 31 - .../nodesets/ec2/image_templates.yaml | 34 -- spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 29 - .../nodesets/ec2/sles-12sp2-x64.yml | 29 - .../nodesets/ec2/ubuntu-1604-x64.yml | 29 - .../nodesets/ec2/windows-2016-base-x64.yml | 29 - spec/spec_helper.rb | 7 +- 26 files changed, 197 insertions(+), 950 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml delete mode 100644 spec/acceptance/nodesets/archlinux-2-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml delete mode 100644 spec/acceptance/nodesets/ec2/image_templates.yaml delete mode 100644 spec/acceptance/nodesets/ec2/rhel-73-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml diff --git a/.editorconfig b/.editorconfig index d77700e..ecb10a8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,7 @@ # editorconfig.org -# MANAGED BY MODULESYNC +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ root = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2240a97..887d571 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,6 +33,8 @@ By participating in this project you agree to abide by its terms. Please be prepared to repeat some of these steps as our contributors review your code. +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + ## Writing proper commits - short version * Make commits of logical units. @@ -230,33 +232,7 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake acceptance -``` - -This will run the tests on the module's default nodeset. You can override the -nodeset used, e.g., - -```sh -BEAKER_set=centos-7-x64 bundle exec rake acceptance -``` - -There are default rake tasks for the various acceptance test modules, e.g., - -```sh -bundle exec rake beaker:centos-7-x64 -bundle exec rake beaker:ssh:centos-7-x64 -``` - -If you don't want to have to recreate the virtual machine every time you can -use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at -least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the -created virtual machines will be in `.vagrant/beaker_vagrant_files`. - -Beaker also supports docker containers. We also use that in our automated CI -pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: - -```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +BEAKER_setfile=debian10-x64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. @@ -264,18 +240,13 @@ The following strings are known to work: * ubuntu1604 * ubuntu1804 -* debian8 +* ubuntu2004 * debian9 * debian10 -* centos6 * centos7 * centos8 -The easiest way to debug in a docker container is to open a shell: - -```sh -docker exec -it -u root ${container_id_or_name} bash -``` +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) repository. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6fadb7c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: pull_request + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + timeout-minutes: 40 + outputs: + beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} + puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + env: + BUNDLE_WITHOUT: development:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run static validations + run: bundle exec rake validate lint check + - name: Run rake rubocop + run: bundle exec rake rubocop + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake parallel_spec + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} + puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Start gitlab + run: ./scripts/start-gitlab.sh + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..664ba69 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.gitignore b/.gitignore index e9b3cf4..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + pkg/ Gemfile.lock Gemfile.local diff --git a/.msync.yml b/.msync.yml index 4c7999c..9c9f18f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1,5 @@ -modulesync_config_version: '3.0.0' +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '4.1.0' diff --git a/.overcommit.yml b/.overcommit.yml index 1b03fad..d367ada 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -1,4 +1,5 @@ -# Managed by https://github.com/voxpupuli/modulesync_configs +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # # Hooks are only enabled if you take action. # @@ -61,4 +62,4 @@ PrePush: - 'validate' - 'test' - 'rubocop' - command: [ 'bundle', 'exec', 'rake' ] + command: ['bundle', 'exec', 'rake'] diff --git a/.pmtignore b/.pmtignore index 4e6d54b..65f5051 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,11 +1,15 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + docs/ pkg/ +Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ +spec/ +Rakefile .vagrant/ .bundle/ .ruby-version @@ -13,9 +17,21 @@ coverage/ log/ .idea/ .dependencies/ +.github/ .librarian/ Puppetfile.lock *.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml .*.sw? .yardoc/ +.yardopts Dockerfile diff --git a/.rspec b/.rspec index 8c18f1a..f634583 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation --color diff --git a/.rspec_parallel b/.rspec_parallel index e4d136b..a9a84f8 100644 --- a/.rspec_parallel +++ b/.rspec_parallel @@ -1 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format progress diff --git a/.rubocop.yml b/.rubocop.yml index 316e4ec..53ac189 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,549 +1,6 @@ -require: rubocop-rspec -AllCops: -# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5 - TargetRubyVersion: 1.9 - Include: - - ./**/*.rb - Exclude: - - files/**/* - - vendor/**/* - - .vendor/**/* - - pkg/**/* - - spec/fixtures/**/* - - Gemfile - - Rakefile - - Guardfile - - Vagrantfile -Lint/ConditionPosition: - Enabled: True +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -Lint/ElseLayout: - Enabled: True - -Lint/UnreachableCode: - Enabled: True - -Lint/UselessComparison: - Enabled: True - -Lint/EnsureReturn: - Enabled: True - -Lint/HandleExceptions: - Enabled: True - -Lint/LiteralInCondition: - Enabled: True - -Lint/ShadowingOuterLocalVariable: - Enabled: True - -Lint/LiteralInInterpolation: - Enabled: True - -Style/HashSyntax: - Enabled: True - -Style/RedundantReturn: - Enabled: True - -Layout/EndOfLine: - Enabled: False - -Lint/AmbiguousOperator: - Enabled: True - -Lint/AssignmentInCondition: - Enabled: True - -Layout/SpaceBeforeComment: - Enabled: True - -Style/AndOr: - Enabled: True - -Style/RedundantSelf: - Enabled: True - -Metrics/BlockLength: - Enabled: False - -# Method length is not necessarily an indicator of code quality -Metrics/MethodLength: - Enabled: False - -# Module length is not necessarily an indicator of code quality -Metrics/ModuleLength: - Enabled: False - -Style/WhileUntilModifier: - Enabled: True - -Lint/AmbiguousRegexpLiteral: - Enabled: True - -Security/Eval: - Enabled: True - -Lint/BlockAlignment: - Enabled: True - -Lint/DefEndAlignment: - Enabled: True - -Lint/EndAlignment: - Enabled: True - -Lint/DeprecatedClassMethods: - Enabled: True - -Lint/Loop: - Enabled: True - -Lint/ParenthesesAsGroupedExpression: - Enabled: True - -Lint/RescueException: - Enabled: True - -Lint/StringConversionInInterpolation: - Enabled: True - -Lint/UnusedBlockArgument: - Enabled: True - -Lint/UnusedMethodArgument: - Enabled: True - -Lint/UselessAccessModifier: - Enabled: True - -Lint/UselessAssignment: - Enabled: True - -Lint/Void: - Enabled: True - -Layout/AccessModifierIndentation: - Enabled: True - -Style/AccessorMethodName: - Enabled: True - -Style/Alias: - Enabled: True - -Layout/AlignArray: - Enabled: True - -Layout/AlignHash: - Enabled: True - -Layout/AlignParameters: - Enabled: True - -Metrics/BlockNesting: - Enabled: True - -Style/AsciiComments: - Enabled: True - -Style/Attr: - Enabled: True - -Style/BracesAroundHashParameters: - Enabled: True - -Style/CaseEquality: - Enabled: True - -Layout/CaseIndentation: - Enabled: True - -Style/CharacterLiteral: - Enabled: True - -Style/ClassAndModuleCamelCase: - Enabled: True - -Style/ClassAndModuleChildren: - Enabled: False - -Style/ClassCheck: - Enabled: True - -# Class length is not necessarily an indicator of code quality -Metrics/ClassLength: - Enabled: False - -Style/ClassMethods: - Enabled: True - -Style/ClassVars: - Enabled: True - -Style/WhenThen: - Enabled: True - -Style/WordArray: - Enabled: True - -Style/UnneededPercentQ: - Enabled: True - -Layout/Tab: - Enabled: True - -Layout/SpaceBeforeSemicolon: - Enabled: True - -Layout/TrailingBlankLines: - Enabled: True - -Layout/SpaceInsideBlockBraces: - Enabled: True - -Layout/SpaceInsideBrackets: - Enabled: True - -Layout/SpaceInsideHashLiteralBraces: - Enabled: True - -Layout/SpaceInsideParens: - Enabled: True - -Layout/LeadingCommentSpace: - Enabled: True - -Layout/SpaceBeforeFirstArg: - Enabled: True - -Layout/SpaceAfterColon: - Enabled: True - -Layout/SpaceAfterComma: - Enabled: True - -Layout/SpaceAfterMethodName: - Enabled: True - -Layout/SpaceAfterNot: - Enabled: True - -Layout/SpaceAfterSemicolon: - Enabled: True - -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: True - -Layout/SpaceAroundOperators: - Enabled: True - -Layout/SpaceBeforeBlockBraces: - Enabled: True - -Layout/SpaceBeforeComma: - Enabled: True - -Style/CollectionMethods: - Enabled: True - -Layout/CommentIndentation: - Enabled: True - -Style/ColonMethodCall: - Enabled: True - -Style/CommentAnnotation: - Enabled: True - -# 'Complexity' is very relative -Metrics/CyclomaticComplexity: - Enabled: False - -Style/ConstantName: - Enabled: True - -Style/Documentation: - Enabled: False - -Style/DefWithParentheses: - Enabled: True - -Style/PreferredHashMethods: - Enabled: True - -Layout/DotPosition: - EnforcedStyle: trailing - -Style/DoubleNegation: - Enabled: True - -Style/EachWithObject: - Enabled: True - -Layout/EmptyLineBetweenDefs: - Enabled: True - -Layout/IndentArray: - Enabled: True - -Layout/IndentHash: - Enabled: True - -Layout/IndentationConsistency: - Enabled: True - -Layout/IndentationWidth: - Enabled: True - -Layout/EmptyLines: - Enabled: True - -Layout/EmptyLinesAroundAccessModifier: - Enabled: True - -Style/EmptyLiteral: - Enabled: True - -# Configuration parameters: AllowURI, URISchemes. -Metrics/LineLength: - Enabled: False - -Style/MethodCallWithoutArgsParentheses: - Enabled: True - -Style/MethodDefParentheses: - Enabled: True - -Style/LineEndConcatenation: - Enabled: True - -Layout/TrailingWhitespace: - Enabled: True - -Style/StringLiterals: - Enabled: True - -Style/TrailingCommaInArguments: - Enabled: True - -Style/TrailingCommaInLiteral: - Enabled: True - -Style/GlobalVars: - Enabled: True - -Style/GuardClause: - Enabled: True - -Style/IfUnlessModifier: - Enabled: True - -Style/MultilineIfThen: - Enabled: True - -Style/NegatedIf: - Enabled: True - -Style/NegatedWhile: - Enabled: True - -Style/Next: - Enabled: True - -Style/SingleLineBlockParams: - Enabled: True - -Style/SingleLineMethods: - Enabled: True - -Style/SpecialGlobalVars: - Enabled: True - -Style/TrivialAccessors: - Enabled: True - -Style/UnlessElse: - Enabled: True - -Style/VariableInterpolation: - Enabled: True - -Style/VariableName: - Enabled: True - -Style/WhileUntilDo: - Enabled: True - -Style/EvenOdd: - Enabled: True - -Style/FileName: - Enabled: True - -Style/For: - Enabled: True - -Style/Lambda: - Enabled: True - -Style/MethodName: - Enabled: True - -Style/MultilineTernaryOperator: - Enabled: True - -Style/NestedTernaryOperator: - Enabled: True - -Style/NilComparison: - Enabled: True - -Style/FormatString: - Enabled: True - -Style/MultilineBlockChain: - Enabled: True - -Style/Semicolon: - Enabled: True - -Style/SignalException: - Enabled: True - -Style/NonNilCheck: - Enabled: True - -Style/Not: - Enabled: True - -Style/NumericLiterals: - Enabled: True - -Style/OneLineConditional: - Enabled: True - -Style/OpMethod: - Enabled: True - -Style/ParenthesesAroundCondition: - Enabled: True - -Style/PercentLiteralDelimiters: - Enabled: True - -Style/PerlBackrefs: - Enabled: True - -Style/PredicateName: - Enabled: True - -Style/RedundantException: - Enabled: True - -Style/SelfAssignment: - Enabled: True - -Style/Proc: - Enabled: True - -Style/RaiseArgs: - Enabled: True - -Style/RedundantBegin: - Enabled: True - -Style/RescueModifier: - Enabled: True - -# based on https://github.com/voxpupuli/modulesync_config/issues/168 -Style/RegexpLiteral: - EnforcedStyle: percent_r - Enabled: True - -Lint/UnderscorePrefixedVariableName: - Enabled: True - -Metrics/ParameterLists: - Enabled: False - -Lint/RequireParentheses: - Enabled: True - -Style/ModuleFunction: - Enabled: True - -Lint/Debugger: - Enabled: True - -Style/IfWithSemicolon: - Enabled: True - -Style/Encoding: - Enabled: True - -Style/BlockDelimiters: - Enabled: True - -Layout/MultilineBlockLayout: - Enabled: True - -# 'Complexity' is very relative -Metrics/AbcSize: - Enabled: False - -# 'Complexity' is very relative -Metrics/PerceivedComplexity: - Enabled: False - -Lint/UselessAssignment: - Enabled: True - -Layout/ClosingParenthesisIndentation: - Enabled: True - -# RSpec - -RSpec/BeforeAfterAll: - Exclude: - - spec/acceptance/**/* - -# We don't use rspec in this way -RSpec/DescribeClass: - Enabled: False - -# Example length is not necessarily an indicator of code quality -RSpec/ExampleLength: - Enabled: False - -RSpec/NamedSubject: - Enabled: False - -# disabled for now since they cause a lot of issues -# these issues aren't easy to fix -RSpec/RepeatedDescription: - Enabled: False - -RSpec/NestedGroups: - Enabled: False - -RSpec/MultipleExpectations: - Enabled: false - -# this is broken on ruby1.9 -Layout/IndentHeredoc: - Enabled: False - -# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs -Security/YAMLLoad: - Enabled: false - -# This affects hiera interpolation, as well as some configs that we push. -Style/FormatStringToken: - Enabled: false - -# This is useful, but sometimes a little too picky about where unit tests files -# are located. -RSpec/FilePath: - Enabled: false +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.sync.yml b/.sync.yml index 8a3e798..426dd12 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,21 +1,4 @@ --- -.travis.yml: - before_install: - - yes | gem update --system - - bundle --version - - git clone https://github.com/puppetlabs/puppetlabs-ruby_task_helper ../ruby_task_helper - - scripts/start-gitlab.sh - docker_sets: - - set: centos6-64 - - set: centos7-64 - - set: centos8-64 - - set: debian8-64 - - set: debian9-64 - - set: debian10-64 - - set: ubuntu1604-64 - - set: ubuntu1804-64 - secure: "uwKQeb0ngonWkgYCFTgrzALAOhjlTBXmJMTdB37z/E9cdFRqwDJy6aUpgXTMCareaiEUaKnkPW0+nNRZZl+ewA7JOb1oBqx2rYNf1URX+eRQLT5yZjD+9h2r1pSNId3ku45q4WhtWRsZ/foD3iPM+S -2g2BI28Ui4/AZYvz//YBa9uWpxVb1pqr2x6aAWxfh3pIGAiok8YnsYZ3qoW0MheGAcL4ReLsdQD9+eSUHYx+eA0zHvMbBVpdTnwFbEgD0WLV5bhaNShHBYWLrOKrYZFsd+XZjOyC8jDiYReeo219KHjDd5RZL38FC8Mtg+oHjUKUvvq2GEKDpPGq1BJ3opBChYbPfRx4KVQpYBeYap9PtkE2s9rSbvsARYVELl9nVoW0j2+nZYhL94efXieEiX/Qt/rwyR9YFvuRO71hzA4nIIaC11pz+kLm1uzJsLgd5tVAlUQjhjvUecRdL98XoI0WTGm3l4sT/ptqfdRvP4XJj0jN4twEQ6FKKUAQ0oaPOZwM2HF4YRN9PtijqU1VoZsUEpYtJECGQjrWEADpYD4qpRxpgGw/4/k/McRFegLC1oCSNqB2uiZIqyTmcr9X5ycNkG0yis4Koq+Chc4CXgZTOAwa2AgzUI8qPdBTI/1G1CBSiGta1X5MKHQM2yEgj2G0jnDAFhi5Im1ylYjBb5O+k=" Gemfile: optional: ':test': diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b0d4cc2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,114 +0,0 @@ ---- -os: linux -dist: bionic -language: ruby -cache: bundler -before_install: - - yes | gem update --system - - bundle --version - - git clone https://github.com/puppetlabs/puppetlabs-ruby_task_helper ../ruby_task_helper - - scripts/start-gitlab.sh -script: - - 'bundle exec rake $CHECK' -jobs: - fast_finish: true - include: - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos6-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos6-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker -branches: - only: - - master - - /^v\d/ -notifications: - email: false - webhooks: https://voxpupu.li/incoming/travis - irc: - on_success: always - on_failure: always - channels: - - "chat.freenode.org#voxpupuli-notifications" -deploy: - provider: puppetforge - username: puppet - password: - secure: "uwKQeb0ngonWkgYCFTgrzALAOhjlTBXmJMTdB37z/E9cdFRqwDJy6aUpgXTMCareaiEUaKnkPW0+nNRZZl+ewA7JOb1oBqx2rYNf1URX+eRQLT5yZjD+9h2r1pSNId3ku45q4WhtWRsZ/foD3iPM+S 2g2BI28Ui4/AZYvz//YBa9uWpxVb1pqr2x6aAWxfh3pIGAiok8YnsYZ3qoW0MheGAcL4ReLsdQD9+eSUHYx+eA0zHvMbBVpdTnwFbEgD0WLV5bhaNShHBYWLrOKrYZFsd+XZjOyC8jDiYReeo219KHjDd5RZL38FC8Mtg+oHjUKUvvq2GEKDpPGq1BJ3opBChYbPfRx4KVQpYBeYap9PtkE2s9rSbvsARYVELl9nVoW0j2+nZYhL94efXieEiX/Qt/rwyR9YFvuRO71hzA4nIIaC11pz+kLm1uzJsLgd5tVAlUQjhjvUecRdL98XoI0WTGm3l4sT/ptqfdRvP4XJj0jN4twEQ6FKKUAQ0oaPOZwM2HF4YRN9PtijqU1VoZsUEpYtJECGQjrWEADpYD4qpRxpgGw/4/k/McRFegLC1oCSNqB2uiZIqyTmcr9X5ycNkG0yis4Koq+Chc4CXgZTOAwa2AgzUI8qPdBTI/1G1CBSiGta1X5MKHQM2yEgj2G0jnDAFhi5Im1ylYjBb5O+k=" - on: - tags: true - # all_branches is required to use tags - all_branches: true - # Only publish the build marked with "DEPLOY_TO_FORGE" - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/.yardopts b/.yardopts index 3687f51..bbd6e9c 100644 --- a/.yardopts +++ b/.yardopts @@ -1,2 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --markup markdown --output-dir docs/ diff --git a/Dockerfile b/Dockerfile index 6fd6342..e3cf307 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM ruby:2.5.3 +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index a2a4d56..6d9fda4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,49 +1,37 @@ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -def location_for(place, fake_version = nil) - if place =~ /^(git[:@][^#]*)#(.*)/ - [fake_version, { :git => $1, :branch => $2, :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path($1), :require => false }] - else - [place, { :require => false }] - end -end +source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.0', :require => false + gem 'voxpupuli-test', '~> 2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'webmock', :require => false end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - gem 'voxpupuli-acceptance', :require => false + gem 'puppet_metadata', '~> 0.3.0', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end +gem 'puppetlabs_spec_helper', '>= 2', '< 4', :require => false +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] - -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, :require => false, :groups => [:test] -else - gem 'facter', :require => false, :groups => [:test] -end - -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b450fe7..c84a24c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,13 @@ -require 'voxpupuli/test/rake' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + require 'puppetlabs_spec_helper/rake_tasks' +end # load optional tasks for releases # only available if gem group releases is installed @@ -26,6 +35,7 @@ end begin require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ diff --git a/scripts/start-gitlab.sh b/scripts/start-gitlab.sh index be389f4..7311ed7 100755 --- a/scripts/start-gitlab.sh +++ b/scripts/start-gitlab.sh @@ -1,10 +1,5 @@ #!/bin/bash -if [[ "${CHECK}" != "beaker" ]]; then - echo "Only starting Gitlab test container for beaker tests" - exit 0 -fi - docker run --detach --rm \ --name gitlab \ --hostname gitlab \ diff --git a/spec/acceptance/nodesets/archlinux-2-x64.yml b/spec/acceptance/nodesets/archlinux-2-x64.yml deleted file mode 100644 index 89b6300..0000000 --- a/spec/acceptance/nodesets/archlinux-2-x64.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - archlinux-2-x64: - roles: - - master - platform: archlinux-2-x64 - box: archlinux/archlinux - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml deleted file mode 100644 index 19dd43e..0000000 --- a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -# Amazon Linux is not a RHEL clone. -# -HOSTS: - amazonlinux-2016091-x64: - roles: - - master - platform: centos-6-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: amazonlinux-2016091-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml deleted file mode 100644 index e50593e..0000000 --- a/spec/acceptance/nodesets/ec2/image_templates.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -# Hint: image IDs (ami-*) for the same image are different per location. -# -AMI: - # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type - amazonlinux-2016091-eu-central-1: - :image: - :aio: ami-af0fc0c0 - :region: eu-central-1 - # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type - rhel-73-eu-central-1: - :image: - :aio: ami-e4c63e8b - :region: eu-central-1 - # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type - sles-12sp2-eu-central-1: - :image: - :aio: ami-c425e4ab - :region: eu-central-1 - # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ubuntu-1604-eu-central-1: - :image: - :aio: ami-fe408091 - :region: eu-central-1 - # Microsoft Windows Server 2016 Base - windows-2016-base-eu-central-1: - :image: - :aio: ami-88ec20e7 - :region: eu-central-1 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml deleted file mode 100644 index 7fac823..0000000 --- a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - rhel-73-x64: - roles: - - master - platform: el-7-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: rhel-73-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml deleted file mode 100644 index 8542154..0000000 --- a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - sles-12sp2-x64: - roles: - - master - platform: sles-12-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: sles-12sp2-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml deleted file mode 100644 index 9cf59d5..0000000 --- a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - ubuntu-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: ubuntu-1604-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ubuntu -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml deleted file mode 100644 index 0932e29..0000000 --- a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - windows-2016-base-x64: - roles: - - master - platform: windows-2016-64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: windows-2016-base-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b2b2704..fb5f0cb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. @@ -9,7 +8,7 @@ require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) - facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) if facts facts.each do |name, value| add_custom_fact name.to_sym, value From 84bc3c2e35697878d53e3160a9598f023bb03ada Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 20 Nov 2020 16:51:33 +0100 Subject: [PATCH 5/9] Add ruby_task_helper as a task helper --- .fixtures.yml | 1 + .github/workflows/ci.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.fixtures.yml b/.fixtures.yml index e798308..2145735 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,6 +3,7 @@ fixtures: stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" apt: "https://github.com/puppetlabs/puppetlabs-apt.git" docker: "https://github.com/puppetlabs/puppetlabs-docker.git" + ruby_task_helper: "https://github.com/puppetlabs/puppetlabs-ruby_task_helper.git" translate: "https://github.com/puppetlabs/puppetlabs-translate.git" yumrepo_core: repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fadb7c..5444ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,8 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + - name: Create task helper symlink + run: ln -s puppet-gitlab_ci_runner/spec/fixtures/modules/ruby_task_helper ../ - name: Run tests run: bundle exec rake parallel_spec From 52f382617ad4633f3bc09298645ea8ff247da747 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Thu, 15 Jul 2021 15:45:49 +0200 Subject: [PATCH 6/9] Bolt config changes due to new version --- spec/spec_helper_acceptance.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 13b08f0..600fee0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -31,28 +31,25 @@ # Setup Puppet Bolt gitlab_ip = File.read(File.expand_path('~/GITLAB_IP')).chomp bolt = <<-MANIFEST - $bolt_config = @("GITCONFIG"/L) + $bolt_config = @("BOLTPROJECT"/L) modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules" - ssh: - host-key-check: false - user: root - password: root - | GITCONFIG + analytics: false + | BOLTPROJECT package { 'puppet-bolt': ensure => installed, } - file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt']: + file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']: ensure => directory, } - file { '/root/.puppetlabs/bolt/analytics.yaml': + # Needs to existing to not trigger a warning sign... + file { '/root/.puppetlabs/etc/bolt/analytics.yaml': ensure => file, - content => "disabled: true\n", } - file { '/root/.puppetlabs/bolt/bolt.yaml': + file { '/root/.puppetlabs/bolt/bolt-project.yaml': ensure => file, content => $bolt_config, } From 9a3ecfa47f21fedc573391f14950b9e63cdb7985 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Thu, 15 Jul 2021 15:47:35 +0200 Subject: [PATCH 7/9] Quote the API response --- spec/acceptance/gitlab_ci_runner_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/gitlab_ci_runner_spec.rb b/spec/acceptance/gitlab_ci_runner_spec.rb index 209782f..53c3a96 100644 --- a/spec/acceptance/gitlab_ci_runner_spec.rb +++ b/spec/acceptance/gitlab_ci_runner_spec.rb @@ -39,7 +39,7 @@ class { 'gitlab_ci_runner': it 'registered the runner' do authtoken = shell("grep 'token = ' /etc/gitlab-runner/config.toml | cut -d '\"' -f2").stdout shell("/usr/bin/env curl -X POST --form 'token=#{authtoken}' http://gitlab/api/v4/runners/verify") do |r| - expect(r.stdout).to eq('200') + expect(r.stdout).to eq('"200"') end end end From e6f1f296044287239f570b47910a1cae2c1739f2 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 16 Jul 2021 14:06:34 +0200 Subject: [PATCH 8/9] Use setup_acceptance_node.pp This uses features from voxpupuli-acceptance to reduce spec_helper_acceptance's size. Another benefit is that editors recognize the .pp extension and you get syntax highlighting. --- spec/setup_acceptance_node.pp | 48 +++++++++++++++++++++++++++ spec/spec_helper_acceptance.rb | 60 ++-------------------------------- 2 files changed, 50 insertions(+), 58 deletions(-) create mode 100644 spec/setup_acceptance_node.pp diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp new file mode 100644 index 0000000..5b11d9a --- /dev/null +++ b/spec/setup_acceptance_node.pp @@ -0,0 +1,48 @@ +# The omnibus installer use the following algorithm to know what to do. +# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb +# If this peace of code trigger docker case, the installer hang indefinitly. +file {'/.dockerenv': + ensure => absent, +} + +package { 'curl': + ensure => present, +} + +# https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229 +# There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04 +# Gitlab installer fail without this file +if $facts['os']['release']['major'] in ['16.04', '18.04'] { + package { 'tzdata': + ensure => present, + } +} + +# Setup Puppet Bolt +$bolt_config = @("BOLTPROJECT"/L) +modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules" +analytics: false +| BOLTPROJECT + +package { 'puppet-bolt': + ensure => installed, +} + +file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']: + ensure => directory, +} + +# Needs to existing to not trigger a warning sign... +file { '/root/.puppetlabs/etc/bolt/analytics.yaml': + ensure => file, +} + +file { '/root/.puppetlabs/bolt/bolt-project.yaml': + ensure => file, + content => $bolt_config, +} + +file_line { '/etc/hosts-gitlab': + path => '/etc/hosts', + line => "${facts['gitlab_ip']} gitlab", +} diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 600fee0..e260638 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,63 +1,7 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' +ENV['BEAKER_FACTER_GITLAB_IP'] = File.read(File.expand_path('~/GITLAB_IP')).chomp + configure_beaker do |host| install_module_from_forge_on(host, 'puppetlabs/docker', '>= 0') - - # The omnibus installer use the following algorithm to know what to do. - # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb - # If this peace of code trigger docker case, the installer hang indefinitly. - pp = %( - file {'/.dockerenv': - ensure => absent, - } - package { ['curl']: - ensure => present, - } - ) - - apply_manifest_on(host, pp, catch_failures: true) - - # https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229 - # There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04 - # Gitlab installer fail without this file - tzdata = %( - package { ['tzdata']: - ensure => present, - } - ) - - apply_manifest_on(host, tzdata, catch_failures: true) if fact('os.release.major') =~ %r{(16.04|18.04)} - - # Setup Puppet Bolt - gitlab_ip = File.read(File.expand_path('~/GITLAB_IP')).chomp - bolt = <<-MANIFEST - $bolt_config = @("BOLTPROJECT"/L) - modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules" - analytics: false - | BOLTPROJECT - - package { 'puppet-bolt': - ensure => installed, - } - - file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']: - ensure => directory, - } - - # Needs to existing to not trigger a warning sign... - file { '/root/.puppetlabs/etc/bolt/analytics.yaml': - ensure => file, - } - - file { '/root/.puppetlabs/bolt/bolt-project.yaml': - ensure => file, - content => $bolt_config, - } - - file_line { '/etc/hosts-gitlab': - path => '/etc/hosts', - line => '#{gitlab_ip} gitlab', - } - MANIFEST - apply_manifest_on(host, bolt, catch_failures: true) end From 7ca95cba7073d56888337801d5d1c3113d5f789d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 16 Jul 2021 14:50:14 +0200 Subject: [PATCH 9/9] Only install github_changelog_generator on Ruby 2.5+ This module still has support for Puppet 5 which ships Ruby 2.4. This allows it to install there. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6d9fda4..e2b6bda 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false gem 'puppet-strings', '>= 2.2', :require => false