DataDog / datadog-ci-rb

Ruby library for Datadog test visibility
https://docs.datadoghq.com/continuous_integration/tests/ruby
Other
8 stars 4 forks source link

[CIVIS-9333] support custom configuration tags supplied from the environment #166

Closed anmarchenko closed 6 months ago

anmarchenko commented 6 months ago

What does this PR do? There are some configurations that cannot be directly identified and reported automatically. For those cases, the user must provide the configuration details to the library so CI Visibility can properly identify them. These tags affect the test fingerprint. These custom configurations are passed via DD_TAGS with a test.configuration. prefix, that is, every test.configuration.* tag will be treated as a custom configuration.

We send these custom configurations when requesting library settings and skippable tests in data.attributes.configurations.custom field.

How to test the change? Using anmarchenko/sidekiq

Test with custom configurations:

image

Logs when sending skippable request:

D, [2024-04-24T14:02:38.210618 #19229] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/itr/skippable.rb:71:in `fetch_skippable_tests') Fetching skippable tests with request: {"data":{"type":"test_params","attributes":{"test_level":"test","service":"sidekiq","env":"ci","repository_url":"git@github.com:anmarchenko/sidekiq.git","sha":"345a0d3c42d02b86fb2b9e590d70e6fe67da95a4","configurations":{"os.platform":"darwin23","os.architecture":"arm64","os.version":"23.4.0","runtime.name":"ruby","runtime.version":"3.3.0","custom":{"disk":"slow","memory":"low"}}}}}

Logs when sending settings request:

D, [2024-04-24T14:02:36.620087 #19229] DEBUG -- datadog: [datadog] (/Users/andrey.marchenko/p/datadog-ci-rb/lib/datadog/ci/transport/remote_settings_api.rb:65:in `fetch_library_settings') Fetching library settings with request: {"data":{"id":"d0bf8c94-c9c2-45e0-a317-088d1ca75b7f","type":"ci_app_test_service_libraries_settings","attributes":{"service":"sidekiq","env":"ci","repository_url":"git@github.com:anmarchenko/sidekiq.git","branch":"itr_test1","sha":"345a0d3c42d02b86fb2b9e590d70e6fe67da95a4","test_level":"test","configurations":{"os.platform":"darwin23","os.architecture":"arm64","os.version":"23.4.0","runtime.name":"ruby","runtime.version":"3.3.0","custom":{"disk":"slow","memory":"low"}}}}}
codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.06%. Comparing base (f0592d1) to head (a1f0eb7).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #166 +/- ## ======================================= Coverage 99.06% 99.06% ======================================= Files 196 196 Lines 9377 9419 +42 Branches 407 409 +2 ======================================= + Hits 9289 9331 +42 Misses 88 88 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.