-
Notifications
You must be signed in to change notification settings - Fork 399
add supported versions workflow #4210
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
3f4560a
add supported version script and table
quinna-h 1980b6f
update script
quinna-h 1b2986e
rubocop lint
quinna-h 5bee321
modify script locations, add description to md table
quinna-h b2818a9
improve table output
quinna-h 53b807f
wip
quinna-h df5640a
refactor code
quinna-h 2b15400
wip
quinna-h 112db1f
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h 3b5aae2
add supported versions
quinna-h 4ada6cf
add branch for testing
quinna-h b4526e2
remove json to avoid merge conflict issues
quinna-h d44249b
update PR body
quinna-h 514be2c
Update .github/scripts/generate_table_versions.rb
quinna-h 65aee38
switch to use gem declarations instead of hardcoded mappings
quinna-h 6fb1de7
linting checks
quinna-h 3b8cff4
cleanup comments
quinna-h c45330a
refactor code
quinna-h 589bccc
cleanup code
quinna-h 49ce6a8
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h d015ca2
Combine duplicate option table rows
soulcutter c24490f
Enable type checking for AgentSettingsResolver/AgentSettings
ivoanjo 7796a9e
Move url building behavior from `AgentBaseUrl` to `AgentSettings`
ivoanjo 2f824ff
Refactor crashtracking to use `AgentSettings#url`
ivoanjo 2716176
[PROF-11078] Fix profiling exception when agent url is an ipv6 address
ivoanjo e8d7381
Implement `==` for new `AgentSettings` class
ivoanjo 3750e4e
use Ruby 3.4.1 for test-memcheck GHA
anmarchenko 9112473
Update exceptions file with another variant of thread creation memory…
ivoanjo 9daf9a0
Introduce Ruby 3.5 gemfile variant for testing with dev builds
ivoanjo 828f75e
Update list of files used to compute cache checksum
ivoanjo ae5d2a3
Bump Ruby 3.4 integration image to stable version
ivoanjo 2e10ee4
Remove workaround for strscan issue
ivoanjo 1f4afdc
Add unsafe api calls checker to track down issues such as #4195
ivoanjo 33fc72f
Fix going into Ruby code when looking up otel context
ivoanjo f200a83
Avoid trying to sample allocations when VM is raising exception
ivoanjo 3dfd113
Update tests with new signatures for test methods
ivoanjo 092fa93
Check if symbol is static before calling SYM2ID on it
ivoanjo 45c7dbe
Document that unsafe api calls checker is only for test code
ivoanjo 4f6eb84
Add 3.4 support
sarahchen6 831f89f
Update DevelopmentGuide
sarahchen6 a62ee88
Remove `racc` gem from 3.3 and 3.4 appraisal files
sarahchen6 f544d4a
[🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/r…
ivoanjo da2860a
Remove strscan specification in 3.4 gemfile
sarahchen6 d1f47ad
[🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/r…
ivoanjo cb788d7
add hardcoded
quinna-h 3f1112e
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| require 'pathname' | ||
| require 'rubygems' | ||
| require 'json' | ||
| require 'bundler' | ||
|
|
||
| lib = File.expand_path('lib', __dir__) | ||
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
| require 'datadog' | ||
|
|
||
| def parse_gemfiles(directory = 'gemfiles/') | ||
| min_gems = { 'ruby' => {}, 'jruby' => {} } | ||
| max_gems = { 'ruby' => {}, 'jruby' => {} } | ||
|
|
||
| gemfiles = Dir.glob(File.join(directory, '*')) | ||
| gemfiles.each do |gemfile_name| | ||
| runtime = File.basename(gemfile_name).split('_').first # ruby or jruby | ||
| next unless %w[ruby jruby].include?(runtime) | ||
| # parse the gemfile | ||
| if gemfile_name.end_with?(".gemfile") | ||
| process_gemfile(gemfile_name, runtime, min_gems, max_gems) | ||
| elsif gemfile_name.end_with?('.gemfile.lock') | ||
| process_lockfile(gemfile_name, runtime, min_gems, max_gems) | ||
| end | ||
| end | ||
|
|
||
| [min_gems['ruby'], min_gems['jruby'], max_gems['ruby'], max_gems['jruby']] | ||
| end | ||
|
|
||
| def process_gemfile(gemfile_name, runtime, min_gems, max_gems) | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| begin | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| definition = Bundler::Definition.build(gemfile_name, nil, nil) | ||
| definition.dependencies.each do |dependency| | ||
| gem_name = dependency.name | ||
| version = dependency.requirement.to_s | ||
| update_gem_versions(runtime, gem_name, version, min_gems, max_gems) | ||
| end | ||
| rescue Bundler::GemfileError => e | ||
| puts "Error reading Gemfile: #{e.message}" | ||
| end | ||
| end | ||
|
|
||
| def process_lockfile(gemfile_name, runtime, min_gems, max_gems) | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| lockfile_contents = File.read(gemfile_name) | ||
| parser = Bundler::LockfileParser.new(lockfile_contents) | ||
| parser.specs.each do |spec| | ||
| gem_name = spec.name | ||
| version = spec.version.to_s | ||
| update_gem_versions(runtime, gem_name, version, min_gems, max_gems) | ||
| end | ||
| end | ||
|
|
||
| def update_gem_versions(runtime, gem_name, version, min_gems, max_gems) | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return unless version_valid?(version) | ||
|
|
||
| gem_version = Gem::Version.new(version) | ||
|
|
||
| # Update minimum gems | ||
| if min_gems[runtime][gem_name].nil? || gem_version < Gem::Version.new(min_gems[runtime][gem_name]) | ||
| min_gems[runtime][gem_name] = version | ||
| end | ||
|
|
||
| # Update maximum gems | ||
| if max_gems[runtime][gem_name].nil? || gem_version > Gem::Version.new(max_gems[runtime][gem_name]) | ||
| max_gems[runtime][gem_name] = version | ||
| end | ||
| end | ||
|
|
||
|
|
||
|
|
||
| # Helper: Validate the version format | ||
| def version_valid?(version) | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return false if version.nil? | ||
|
|
||
| version = version.to_s.strip | ||
|
|
||
| return false if version.empty? | ||
|
|
||
| # Ensure it's a valid Gem::Version | ||
| begin | ||
| Gem::Version.new(version) | ||
| true | ||
| rescue ArgumentError | ||
| false | ||
| end | ||
| end | ||
|
|
||
| def get_integration_names(directory = 'lib/datadog/tracing/contrib/') | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Datadog::Tracing::Contrib::REGISTRY.map{ |i| i.name.to_s } | ||
| end | ||
|
|
||
| # TODO: The gem information should reside in the integration declaration instead of here. | ||
|
|
||
| mapping = { | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
marcotc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "action_mailer" => "actionmailer", | ||
| "opensearch" => "opensearch-ruby", | ||
| "concurrent_ruby" => "concurrent-ruby", | ||
| "action_view" => "actionview", | ||
| "action_cable" => "actioncable", | ||
| "active_record" => "activerecord", | ||
| "mongodb" => "mongo", | ||
| "rest_client" => "rest-client", | ||
| "active_support" => "activesupport", | ||
| "action_pack" => "actionpack", | ||
| "active_job" => "activejob", | ||
| "httprb" => "http", | ||
| "kafka" => "ruby-kafka", | ||
| "presto" => "presto-client", | ||
| "aws" => "aws-sdk-core" | ||
| } | ||
|
|
||
| excluded = ["configuration", "propagation", "utils"] | ||
| min_gems_ruby, min_gems_jruby, max_gems_ruby, max_gems_jruby = parse_gemfiles("gemfiles/") | ||
| integrations = get_integration_names('lib/datadog/tracing/contrib/') | ||
|
|
||
| integration_json_mapping = {} | ||
|
|
||
| integrations.each do |integration| | ||
| if excluded.include?(integration) | ||
| next | ||
| end | ||
| integration_name = mapping[integration] || integration | ||
|
|
||
| min_version_jruby = min_gems_jruby[integration_name] | ||
| min_version_ruby = min_gems_ruby[integration_name] | ||
| max_version_jruby = max_gems_jruby[integration_name] | ||
| max_version_ruby = max_gems_ruby[integration_name] | ||
|
|
||
| # mapping jruby, ruby | ||
| integration_json_mapping[integration] = [min_version_ruby, max_version_ruby, min_version_jruby, max_version_jruby] | ||
| integration_json_mapping.replace(integration_json_mapping.sort.to_h) | ||
| end | ||
|
|
||
| File.write("gem_output.json", JSON.pretty_generate(integration_json_mapping)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| require 'json' | ||
|
|
||
| # Input and output file names | ||
| input_file = 'gem_output.json' | ||
| output_file = 'integration_versions.md' | ||
|
|
||
| # Read JSON data from the input file | ||
| data = JSON.parse(File.read(input_file)) | ||
|
|
||
| # Prepare the Markdown content | ||
| comment = "# This is a table of supported integration versions generated from gemfiles.\n\n" | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| header = "| Integration | Ruby Min | Ruby Max | JRuby Min | JRuby Max |\n" | ||
| separator = "|-------------|----------|-----------|----------|----------|\n" | ||
| rows = data.map do |integration_name, versions| | ||
| ruby_min, ruby_max, jruby_min, jruby_max = versions.map { |v| v || "None" } | ||
| "| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |" | ||
| end | ||
|
|
||
| # Write the Markdown file | ||
| File.open(output_file, 'w') do |file| | ||
| file.puts comment | ||
| file.puts header | ||
| file.puts separator | ||
| rows.each { |row| file.puts row } | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: "Generate Supported Versions" | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - quinna.halim/add-supported-versions-table | ||
quinna-h marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| workflow_dispatch: | ||
|
|
||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true # runs bundle install | ||
| ruby-version: "3.3" | ||
|
|
||
| - name: Update latest | ||
| run: bundle exec ruby .github/scripts/find_gem_version_bounds.rb | ||
|
|
||
| - name: Generate versions table | ||
| run: ruby .github/scripts/generate_table_versions.rb | ||
|
|
||
| - run: git diff | ||
|
|
||
| - name: Create Pull Request | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| token: ${{ secrets.GHA_PAT }} | ||
| branch: auto-generate/update-supported-versions | ||
| title: '[🤖] Update Supported Versions' | ||
| base: master | ||
| labels: dev/internal, integrations | ||
| commit-message: "Test creating supported versions" | ||
| delete-branch: true | ||
| body: | | ||
| This is a PR to update the table for supported integration versions. | ||
| Workflow run: [Generate Supported Versions](https://github.com/DataDog/dd-trace-rb/actions/workflows/generate-supported-versions.yml) | ||
| This should be tied to tracer releases, or triggered manually. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.