diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f4280c6..50015711 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,39 +10,39 @@ jobs: RUBY_VERSION: '2.1.9' PUPPET_VERSION: '4.6.2' steps: - # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ - - run: - name: Fix git clones - command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig - - checkout - - run: - name: Install RVM - command: | - gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB - \curl -sSL https://get.rvm.io | bash -s stable - - run: - name: Install old libssl1.0-dev - command: | - ruby_major=$(echo $RUBY_VERSION | awk -F. '{ print $1 }') - ruby_minor=$(echo $RUBY_VERSION | awk -F. '{ print $2 }') - # We need libssl1.0-dev to even compile Ruby <= 2.3 with RVM; - if [ $ruby_major -eq "2" ] && [ $ruby_minor -le "3" ]; then - sudo bash -c "echo deb http://security.ubuntu.com/ubuntu bionic-security main >> /etc/apt/sources.list" - sudo apt update && apt-cache policy libssl1.0-dev - sudo apt install -y libssl1.0-dev - fi - - run: - name: Install Ruby version - command: rvm install $RUBY_VERSION - - run: - name: Install bundler - command: rvm $RUBY_VERSION --verbose do gem install bundler:1.17.3 - - run: - name: Install gem dependencies - command: rm Gemfile.lock && rvm $RUBY_VERSION --verbose do bundle install --path .bundle - - run: - name: Run tests - command: rvm $RUBY_VERSION --verbose do bundle exec rake test + # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ + - run: + name: Fix git clones + command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - checkout + - run: + name: Install RVM + command: | + gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + \curl -sSL https://get.rvm.io | bash -s stable + - run: + name: Install old libssl1.0-dev + command: | + ruby_major=$(echo $RUBY_VERSION | awk -F. '{ print $1 }') + ruby_minor=$(echo $RUBY_VERSION | awk -F. '{ print $2 }') + # We need libssl1.0-dev to even compile Ruby <= 2.3 with RVM; + if [ $ruby_major -eq "2" ] && [ $ruby_minor -le "3" ]; then + sudo bash -c "echo deb http://security.ubuntu.com/ubuntu bionic-security main >> /etc/apt/sources.list" + sudo apt update && apt-cache policy libssl1.0-dev + sudo apt install -y libssl1.0-dev + fi + - run: + name: Install Ruby version + command: rvm install $RUBY_VERSION + - run: + name: Install bundler + command: rvm $RUBY_VERSION --verbose do bundle config set --local path '.bundle' && gem install bundler:2.4.13 + - run: + name: Install gem dependencies + command: rm Gemfile.lock && rvm $RUBY_VERSION --verbose do bundle install --path .bundle + - run: + name: Run tests + command: rvm $RUBY_VERSION --verbose do bundle exec rake test specs-ruby21-puppet410: <<: *specs @@ -271,23 +271,23 @@ jobs: name: win/default # Comes with ruby 2.6, which is not supported on Windows as of puppet 6.10.1 shell: bash.exe steps: - # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ - - run: - name: Fix git clones - command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig - - checkout - - run: - name: Run tests - command: | - set -e - choco install ruby --allow-downgrade -y --version 2.5.3.101 # Keep version in sync with next command! - export PATH=/c/tools/ruby25/bin:$PATH # Make Ruby 2.5 take precedence over the pre-installed 2.6 - ruby --version - choco install msys2 --allow-downgrade -y --version 20210604.0.0 - ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain - gem install bundler -v 1.17.3 - rm Gemfile.lock && bundle install --path .bundle - bundle exec rake test + # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ + - run: + name: Fix git clones + command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - checkout + - run: + name: Run tests + command: | + set -e + choco install ruby --allow-downgrade -y --version 2.5.3.101 # Keep version in sync with next command! + export PATH=/c/tools/ruby25/bin:$PATH # Make Ruby 2.5 take precedence over the pre-installed 2.6 + ruby --version + choco install msys2 --allow-downgrade -y --version 20210604.0.0 + ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain + gem install bundler -v 2.4.13 + rm Gemfile.lock && bundle install --path .bundle + bundle exec rake test environment: STRICT_VARIABLES: 'yes' #RUBY_VERSION hardcoded in install script @@ -300,28 +300,28 @@ jobs: STRICT_VARIABLES: 'yes' RUBY_VERSION: '2.5.3' steps: - # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ - - run: - name: Fix git clones - command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig - - checkout - - run: - name: Install RVM - command: | - gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB - \curl -sSL https://get.rvm.io | bash -s stable - - run: - name: Install Ruby versions - command: rvm install $RUBY_VERSION - - run: - name: Install bundler - command: rvm $RUBY_VERSION --verbose do gem install bundler:1.17.3 - - run: - name: Install gem dependencies - command: rvm $RUBY_VERSION --verbose do bundle install --path .bundle - - run: - name: Run tests - command: rvm $RUBY_VERSION --verbose do bundle exec rake test + # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ + - run: + name: Fix git clones + command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - checkout + - run: + name: Install RVM + command: | + gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + \curl -sSL https://get.rvm.io | bash -s stable + - run: + name: Install Ruby versions + command: rvm install $RUBY_VERSION + - run: + name: Install bundler + command: rvm $RUBY_VERSION --verbose do bundle config set --local path '.bundle' && gem install bundler:2.4.13 + - run: + name: Install gem dependencies + command: rvm $RUBY_VERSION --verbose do bundle install --path .bundle + - run: + name: Run tests + command: rvm $RUBY_VERSION --verbose do bundle exec rake test kitchen-tests: machine: @@ -330,63 +330,63 @@ jobs: STRICT_VARIABLES: 'yes' RUBY_VERSION: '2.5.3' steps: - # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ - - run: - name: Fix git clones - command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig - - checkout - - run: - name: Install RVM - command: | - gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB - \curl -sSL https://get.rvm.io | bash -s stable - - run: - name: Install Ruby versions - command: rvm install $RUBY_VERSION - - run: - name: Install bundler - command: rvm $RUBY_VERSION --verbose do gem install bundler:1.17.3 - - run: - name: Install gem dependencies - command: rvm $RUBY_VERSION --verbose do bundle install --path .bundle - - run: - name: Execute Kitchen tests - command: rvm $RUBY_VERSION --verbose do bundle exec rake circle - no_output_timeout: 900 + # See https://github.blog/2021-09-01-improving-git-protocol-security-github/ + - run: + name: Fix git clones + command: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - checkout + - run: + name: Install RVM + command: | + gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + \curl -sSL https://get.rvm.io | bash -s stable + - run: + name: Install Ruby versions + command: rvm install $RUBY_VERSION + - run: + name: Install bundler + command: rvm $RUBY_VERSION --verbose do bundle config set --local path '.bundle' && gem install bundler:2.4.13 + - run: + name: Install gem dependencies + command: rvm $RUBY_VERSION --verbose do bundle install --path .bundle + - run: + name: Execute Kitchen tests + command: rvm $RUBY_VERSION --verbose do bundle exec rake circle + no_output_timeout: 900 workflows: version: 2 build_and_test: jobs: - - specs-ruby21-puppet46 - - specs-ruby21-puppet410 - - specs-ruby21-puppet50 - - specs-ruby21-puppet53 - - specs-ruby22-puppet46 - - specs-ruby22-puppet410 - - specs-ruby22-puppet50 - - specs-ruby22-puppet53 - - specs-ruby23-puppet46 - - specs-ruby23-puppet410 - - specs-ruby23-puppet50 - - specs-ruby23-puppet53 - - specs-ruby23-puppet60 - - specs-ruby23-puppet65 - - specs-ruby24-puppet410 - - specs-ruby24-puppet50 - - specs-ruby24-puppet53 - - specs-ruby24-puppet60 - - specs-ruby24-puppet65 - - specs-ruby25-puppet410 - - specs-ruby25-puppet50 - - specs-ruby25-puppet53 - - specs-ruby25-puppet60 - - specs-ruby25-puppet65 - - specs-ruby25-puppet65-windows - - specs-ruby26-puppet60 - - specs-ruby26-puppet65 - - specs-ruby26-puppet79 - - specs-ruby26-puppet714 - - specs-ruby26-puppet725 - - verify-gemfile-lock-dependencies - - kitchen-tests + - specs-ruby21-puppet46 + - specs-ruby21-puppet410 + - specs-ruby21-puppet50 + - specs-ruby21-puppet53 + - specs-ruby22-puppet46 + - specs-ruby22-puppet410 + - specs-ruby22-puppet50 + - specs-ruby22-puppet53 + - specs-ruby23-puppet46 + - specs-ruby23-puppet410 + - specs-ruby23-puppet50 + - specs-ruby23-puppet53 + - specs-ruby23-puppet60 + - specs-ruby23-puppet65 + - specs-ruby24-puppet410 + - specs-ruby24-puppet50 + - specs-ruby24-puppet53 + - specs-ruby24-puppet60 + - specs-ruby24-puppet65 + - specs-ruby25-puppet410 + - specs-ruby25-puppet50 + - specs-ruby25-puppet53 + - specs-ruby25-puppet60 + - specs-ruby25-puppet65 + - specs-ruby25-puppet65-windows + - specs-ruby26-puppet60 + - specs-ruby26-puppet65 + - specs-ruby26-puppet79 + - specs-ruby26-puppet714 + - specs-ruby26-puppet725 + - verify-gemfile-lock-dependencies + - kitchen-tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 057fd29a..14230bbb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,8 +18,9 @@ cd puppet-datadog-agent First, to install the Ruby dependencies run: ```bash -gem install bundler:1.17.3 -bundle install --path .bundle +gem install bundler:2.4.13 +bundle config set --local path '.bundle' +bundle install ``` Afterwards, on the first run of the tests, further dependencies will be installed. diff --git a/Gemfile b/Gemfile index 980c57a1..b0d51caf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' +ruby_version = Gem::Version.new(RUBY_VERSION.dup) + def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} file_url_regex = %r{\Afile:\/\/(?.*)} @@ -42,7 +44,11 @@ group :development do gem "kitchen-verifier-serverspec" gem "rexml", '>= 3.0.0', '< 3.2.7', require: false gem "mixlib-shellout", "~> 2.2.7", platforms: [:ruby] - gem "test-kitchen", '~> 3.7.0' + if ruby_version >= Gem::Version.new('2.7') && ruby_version < Gem::Version.new('3.1') + gem "test-kitchen", '~> 3.4.0', platforms: [:ruby] + else + gem "test-kitchen", '~> 3.7.0' + end end group :development, :release_prep do gem "puppet-strings", '~> 4.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 5db49b9e..6e065689 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,13 +15,14 @@ GEM aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-ec2 (1.502.0) + aws-sdk-ec2 (1.503.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) bcrypt_pbkdf (1.0.1) + bcrypt_pbkdf (1.0.1-x64-mingw32) bigdecimal (3.1.9) bindata (2.5.0) bolt (4.0.0) @@ -76,22 +77,21 @@ GEM facterdb (2.1.0) facter (< 5.0.0) jgrep (~> 1.5, >= 1.5.4) - faraday (2.12.2) - faraday-net_http (>= 2.0, < 3.5) - json - logger + faraday (2.8.1) + base64 + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-net_http (3.4.0) - net-http (>= 0.5.0) + faraday-net_http (3.0.2) faraday-net_http_persistent (2.3.0) faraday (~> 2.5) net-http-persistent (>= 4.0.4, < 5) fast_gettext (2.4.0) prime - ffi (1.17.0-arm64-darwin) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x64-mingw32) forwardable (1.3.3) - getoptlong (0.2.1) gettext (3.5.1) erubi locale (>= 2.0.5) @@ -107,11 +107,11 @@ GEM gyoku (1.4.0) builder (>= 2.1.2) rexml (~> 3.0) + hiera (3.12.0) hiera-eyaml (3.4.0) highline optimist - highline (3.1.2) - reline + highline (2.1.0) hocon (1.4.0) http-accept (1.7.0) http-cookie (1.0.8) @@ -173,8 +173,6 @@ GEM ruby2_keywords (>= 0.0.5) molinillo (0.8.0) multi_json (1.15.0) - net-http (0.6.0) - uri net-http-persistent (4.0.5) connection_pool (~> 2.2) net-scp (4.1.0) @@ -187,8 +185,7 @@ GEM net-ssh (>= 2.0) net-telnet (0.2.0) netrc (0.11.0) - nori (2.7.1) - bigdecimal + nori (2.6.0) optimist (3.2.0) orchestrator_client (0.7.1) faraday (>= 1.4, < 3.0) @@ -201,7 +198,7 @@ GEM racc pastel (0.8.0) tty-color (~> 0.5) - pathspec (2.1.0) + pathspec (1.1.3) pluginator (1.5.0) prime (0.1.3) forwardable @@ -209,27 +206,15 @@ GEM pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (6.0.1) - puppet (8.10.0) - concurrent-ruby (~> 1.0) - deep_merge (~> 1.0) - facter (>= 4.3.0, < 5) - fast_gettext (>= 2.1, < 4) - getoptlong (~> 0.2.0) - locale (~> 2.1) - multi_json (~> 1.13) - puppet-resource_api (~> 1.5) - scanf (~> 1.0) - semantic_puppet (~> 1.0) - puppet (8.10.0-universal-darwin) - CFPropertyList (>= 3.0.6, < 4) + public_suffix (5.1.1) + puppet (7.34.0) concurrent-ruby (~> 1.0) deep_merge (~> 1.0) - facter (>= 4.3.0, < 5) - fast_gettext (>= 2.1, < 4) - getoptlong (~> 0.2.0) + facter (> 2.0.1, < 5) + fast_gettext (>= 1.1, < 3) + hiera (>= 3.2.1, < 4) locale (~> 2.1) - multi_json (~> 1.13) + multi_json (~> 1.10) puppet-resource_api (~> 1.5) scanf (~> 1.0) semantic_puppet (~> 1.0) @@ -323,18 +308,22 @@ GEM minitar (~> 0.9) multi_json (~> 1.10) puppet_forge (>= 4.1, < 6) - racc (1.8.1) + racc (1.4.16) rainbow (3.1.1) rake (13.2.1) rb-readline (0.5.5) regexp_parser (2.10.0) - reline (0.6.0) - io-console (~> 0.5) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rest-client (2.1.0-x64-mingw32) + ffi (~> 1.9) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) retryable (3.0.5) rexml (3.2.6) rgen (0.10.2) @@ -349,9 +338,9 @@ GEM rspec-support (~> 3.13.0) rspec-github (2.4.0) rspec-core (~> 3.0) - rspec-its (2.0.0) - rspec-core (>= 3.13.0) - rspec-expectations (>= 3.13.0) + rspec-its (1.3.1) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) @@ -465,7 +454,6 @@ GEM tty-cursor (~> 0.7) unicode-display_width (2.6.0) unicode_utils (1.4.0) - uri (1.0.2) voxpupuli-puppet-lint-plugins (5.0.0) puppet-lint (~> 4.0) puppet-lint-absolute_classname-check (~> 4.0) @@ -486,15 +474,14 @@ GEM puppet-lint-variable_contains_upcase (~> 2.0) puppet-lint-version_comparison-check (~> 2.0) windows_error (0.1.5) - winrm (2.3.9) + winrm (2.3.6) builder (>= 2.1.2) erubi (~> 1.8) gssapi (~> 1.2) gyoku (~> 1.0) httpclient (~> 2.2, >= 2.2.0.2) logging (>= 1.6.1, < 3.0) - nori (~> 2.0, >= 2.7.1) - rexml (~> 3.0) + nori (~> 2.0) rubyntlm (~> 0.6.0, >= 0.6.3) winrm-elevated (1.2.3) erubi (~> 1.8) @@ -529,7 +516,7 @@ DEPENDENCIES mixlib-shellout (~> 2.2.7) parallel_tests (= 3.12.1) pry (~> 0.10) - puppet (= 8.10.0) + puppet puppet-blacksmith (~> 7.0) puppet-debugger (~> 1.0) puppet-strings (~> 4.0) diff --git a/kitchen.yml b/kitchen.yml index bcee3051..596955d0 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -29,7 +29,7 @@ platforms: - printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile - printf <%= File.read('environments/etc/Gemfile').inspect %> > /home/Gemfile - - gem install bundler -v '= 1.17.3' + - gem install bundler -v '= 2.4.13' # we use bundle to install gems and to lock dependencies versions of semantic_puppet and multipart-post - cd /home && bundle install - cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules @@ -50,7 +50,7 @@ platforms: - printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile - printf <%= File.read('environments/etc/Gemfile').inspect %> > /home/Gemfile - - gem install bundler -v '= 1.17.3' + - gem install bundler -v '= 2.4.13' - cd /home && bundle install - cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules @@ -72,7 +72,7 @@ platforms: - printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile - printf <%= File.read('environments/etc/Gemfile').inspect %> > /home/Gemfile - - gem install bundler -v '= 1.17.3' + - gem install bundler -v '= 2.4.13' - cd /home && bundle install - cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules @@ -90,7 +90,7 @@ platforms: provision_command: - zypper ar -G https://yum.puppet.com/puppet/sles/15/x86_64/ puppet-repo - zypper install -y puppet-agent ruby=2.5 - - gem install bundler -v '= 1.17.3' + - gem install bundler -v '= 2.4.13' - gem install net-ssh -v '= 6.1.0' - gem install rspec-its -v '= 1.3.1' - gem install serverspec rspec