Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for Ruby 2.2 and 2.3 #1778

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.2.10, 3.2.0]
ruby-version: [2.4.10, 3.2.0]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -54,27 +54,27 @@ jobs:
key: ${{ matrix.ruby-version }}
map: |
{
"2.2.10": {
"rails": "norails,rails41,rails32"
"2.4.10": {
"rails": "norails,rails42,rails52"
},
"3.2.0": {
"rails": "norails,rails61,rails70"
}
}

- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/[email protected]
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.2.10'
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.4.10'
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
--health-timeout 5s
--health-retries 5
mongodb:
image: ${{ contains(fromJson('["2.2.10", "2.3.8", "2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
ports:
- 27017:27017
mysql:
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
fail-fast: false
matrix:
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.2.10, 3.2.0]
ruby-version: [2.4.10, 3.2.0]

steps:
- name: Configure git
Expand All @@ -202,19 +202,19 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}

# This allows the cache in the following step to be able to write files to the directory needed for mysql
- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql directory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/[email protected]
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.2.10'
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.4.10'
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down
25 changes: 9 additions & 16 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- main
- dev
- major-release-9

schedule:
- cron: '0 9 * * *'
workflow_dispatch:
Expand Down Expand Up @@ -38,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.2.10, 2.3.8, 2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.0]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.0]

steps:
- name: Configure git
Expand All @@ -63,12 +62,6 @@ jobs:
key: ${{ matrix.ruby-version }}
map: |
{
"2.2.10": {
"rails": "norails,rails41,rails40,rails32"
},
"2.3.8": {
"rails": "norails,rails52,rails51,rails42,rails41,rails40,rails32"
},
"2.4.10": {
"rails": "norails,rails52,rails51,rails42"
},
Expand All @@ -92,19 +85,19 @@ jobs:
}
}

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/[email protected]
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10')
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10')
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down Expand Up @@ -161,7 +154,7 @@ jobs:
--health-timeout 5s
--health-retries 5
mongodb:
image: ${{ contains(fromJson('["2.2.10", "2.3.8", "2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
ports:
- 27017:27017
mysql:
Expand Down Expand Up @@ -205,7 +198,7 @@ jobs:
fail-fast: false
matrix:
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.2.10, 2.3.8, 2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.0]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.0]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -222,19 +215,19 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/[email protected]
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8')
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10')
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down
31 changes: 6 additions & 25 deletions .github/workflows/scripts/setup_bundler
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function using_old_rails {

function using_old_ruby {
# example RUBY_VERSION strings:
# '2.2.10' => true, starts with "2", next digit is not a "6" or "7"
# '2.4.10' => true, starts with "2", next digit is not a "6" or "7"
# '2.7.7' => false, starts with "2", next digit is "7"
# '3.1.3' => false, does not start with "2"
echo "DEBUG: RUBY_VERSION = $RUBY_VERSION"
Expand All @@ -28,12 +28,7 @@ function update_to_desired_rubygems_version {
# correctly install Bundler 1.17 for the multiverse test suite
# Rubies < 2.3 need to use update_rubygems,
# newer Rubies can use 'gem update --system'
if [[ $RUBY_VERSION = "2.2.10" ]]; then
echo "DEBUG: installing rubygems-update version 2.7.11"
gem install rubygems-update:2.7.11
echo "DEBUG: running 'rubygems-update'"
update_rubygems
elif [[ $RUBY_VERSION =~ 2.[^7] ]]; then
if [[ $RUBY_VERSION =~ 2.[^7] ]]; then
echo "DEBUG: running 'gem update --system 3.0.6 --force'"
gem update --system 3.0.6 --force >/dev/null
else
Expand All @@ -56,23 +51,10 @@ function install_desired_bundler_version {
echo "DEBUG: running 'gem list bundler'"
gem list bundler
echo "DEBUG: RUBY_VERSION = $RUBY_VERSION"
if [[ $RUBY_VERSION != "2.2.10" ]]; then
echo "DEBUG: running 'gem uninstall bundler'"
gem uninstall bundler
echo "DEBUG: running 'gem list bundler' again"
gem list bundler
fi
}

function configure_bundler {
if ! [[ $RUBY_VERSION =~ 2.[23] ]]; then
echo "DEBUG: Ruby is not at version 2.2-2.5, skipping 'bundler config'"
return
fi

# add mysql specific config for bundler when we are using older mysql
echo "DEBUG: running 'bundle config'"
bundle config --global build.mysql2 --with-mysql-config=/usr/local/mysql55/bin/mysql_config
echo "DEBUG: running 'gem uninstall bundler'"
gem uninstall bundler
echo "DEBUG: running 'gem list bundler' again"
gem list bundler
}

function install_ruby_version_specific_gems {
Expand Down Expand Up @@ -108,7 +90,6 @@ function set_up_bundler {

update_to_desired_rubygems_version
install_desired_bundler_version
configure_bundler
}

echo "DEBUG: setting up Bundler"
Expand Down
28 changes: 0 additions & 28 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1081,18 +1081,6 @@ Performance/MapCompact:
Performance/MethodObjectAsBlock:
Enabled: false

# TODO: OLD RUBIES - Requires 2.4
hannahramadan marked this conversation as resolved.
Show resolved Hide resolved
Performance/RegexpMatch:
Enabled: false

# TODO: OLD RUBIES - Requires 2.4
Performance/Sum:
Enabled: false

# TODO: OLD RUBIES - Requires 2.3
Performance/UnfreezeString:
Enabled: false

# Disabling for now
Security/Eval:
Enabled: false
Expand Down Expand Up @@ -1330,11 +1318,6 @@ Style/ExplicitBlockArgument:
Style/ExponentialNotation:
Enabled: false

# TODO: MAJOR VERSION - Re-enable FetchEnvVar after dropping support for Ruby 2.2
# Ruby 2.3+ allows for ENV.fetch('KEY') { default }
Style/FetchEnvVar:
Enabled: false

Style/FloatDivision:
Enabled: false

Expand Down Expand Up @@ -1740,17 +1723,6 @@ Style/RescueStandardError:
Style/ReturnNil:
Enabled: false

# Can't use, not available in Ruby 2.2
Style/SafeNavigation:
Enabled: false
# ConvertCodeThatCanStartToReturnNil: false
# AllowedMethods:
# - present?
# - blank?
# - presence
# - try
# - try!

Style/Sample:
Enabled: true

Expand Down
44 changes: 41 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-10-03 22:57:47 UTC using RuboCop version 1.36.0.
# on 2023-02-02 15:27:55 UTC using RuboCop version 1.44.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 412
# Offense count: 422
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 54
Expand All @@ -31,7 +31,13 @@ Minitest/DuplicateTestRun:
- 'test/multiverse/suites/rails/error_tracing_test.rb'
- 'test/multiverse/suites/sinatra/ignoring_test.rb'

# Offense count: 263
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Minitest/EmptyLineBeforeAssertionMethods:
tannalynn marked this conversation as resolved.
Show resolved Hide resolved
Exclude:
- 'test/new_relic/agent_test.rb'

# Offense count: 269
Minitest/MultipleAssertions:
Max: 28

Expand All @@ -57,6 +63,38 @@ Minitest/EmptyLineBeforeAssertionMethods:
- 'test/new_relic/agent_test.rb'
- 'test/new_relic/cli/commands/deployments_test.rb'

# Offense count: 23
# This cop supports safe autocorrection (--autocorrect).
tannalynn marked this conversation as resolved.
Show resolved Hide resolved
Performance/RegexpMatch:
Enabled: false

# Offense count: 1
tannalynn marked this conversation as resolved.
Show resolved Hide resolved
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: OnlySumOrWithInitialValue.
Performance/Sum:
Exclude:
- 'lib/new_relic/agent/system_info.rb'

# Offense count: 72
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/UnfreezeString:
Enabled: false

# Offense count: 21
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:
Enabled: false

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantStringEscape:
tannalynn marked this conversation as resolved.
Show resolved Hide resolved
Exclude:
- 'test/new_relic/agent/logging_test.rb'

# Offense count: 115
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Enabled: false
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

## v9.0.0

Version 9.0.0 of the agent enables thread tracing.
Version 9.0.0 of the agent enables thread tracing and removes support for Ruby versions 2.2 and 2.3.

- **Enable Thread Instrumentation by default**

The configuration option `instrumentation.thread.tracing` is now enabled by default. This will allow the agent to properly monitor code that occurs inside of threads. If you are currently using custom instrumentation to start a new transaction inside of threads, this may be a breaking change, as it will no longer start a new transaction if one already exists.

- **Ruby 2.2 and 2.3 Dropped**

Support for Ruby 2.2 and 2.3 dropped with this release. They are no longer included in our test matrices and are not supported
for 9.0.0 and onward.


## 8.16.0
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ includes unreleased work. Please create all new branches off of `dev`.
- Fork the repository inside GitHub
- `git clone [email protected]:<gh username>/newrelic-ruby-agent.git`
1. Pick a Ruby version
- Use rbenv, rvm, chruby, asdf, etc. to install any version of Ruby between 2.2 up to the latest stable version
- Use rbenv, rvm, chruby, asdf, etc. to install any version of Ruby between 2.4 up to the latest stable version
1. Install development dependencies
- `bundle install`
1. Check that your env is setup correctly
Expand Down
Loading