Skip to content

Commit

Permalink
fix gemfile for ruby < 3.1 and puppet 8; bump bundler to v2.4.13 in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang committed Jan 28, 2025
1 parent daa8e2d commit 78a4cce
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 179 deletions.
254 changes: 127 additions & 127 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -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(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 78a4cce

Please sign in to comment.