datadog-ci 1.8.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -2
  3. data/README.md +6 -8
  4. data/exe/ddcirb +3 -1
  5. data/lib/datadog/ci/auto_instrument.rb +8 -0
  6. data/lib/datadog/ci/cli/cli.rb +5 -1
  7. data/lib/datadog/ci/cli/command/exec.rb +29 -0
  8. data/lib/datadog/ci/configuration/settings.rb +3 -21
  9. data/lib/datadog/ci/contrib/ciqueue/integration.rb +34 -0
  10. data/lib/datadog/ci/contrib/ciqueue/patcher.rb +23 -0
  11. data/lib/datadog/ci/contrib/cucumber/formatter.rb +10 -5
  12. data/lib/datadog/ci/contrib/cucumber/integration.rb +5 -14
  13. data/lib/datadog/ci/contrib/cucumber/patcher.rb +2 -6
  14. data/lib/datadog/ci/contrib/instrumentation.rb +173 -0
  15. data/lib/datadog/ci/contrib/integration.rb +101 -117
  16. data/lib/datadog/ci/contrib/knapsack/extension.rb +27 -0
  17. data/lib/datadog/ci/contrib/knapsack/integration.rb +36 -0
  18. data/lib/datadog/ci/contrib/knapsack/patcher.rb +29 -0
  19. data/lib/datadog/ci/contrib/knapsack/runner.rb +66 -0
  20. data/lib/datadog/ci/contrib/minitest/integration.rb +6 -14
  21. data/lib/datadog/ci/contrib/minitest/patcher.rb +1 -5
  22. data/lib/datadog/ci/contrib/minitest/runner.rb +6 -1
  23. data/lib/datadog/ci/contrib/minitest/test.rb +6 -1
  24. data/lib/datadog/ci/contrib/patcher.rb +62 -0
  25. data/lib/datadog/ci/contrib/rspec/example.rb +64 -25
  26. data/lib/datadog/ci/contrib/rspec/example_group.rb +18 -1
  27. data/lib/datadog/ci/contrib/rspec/integration.rb +10 -13
  28. data/lib/datadog/ci/contrib/rspec/patcher.rb +2 -33
  29. data/lib/datadog/ci/contrib/rspec/runner.rb +6 -1
  30. data/lib/datadog/ci/contrib/selenium/capybara_driver.rb +1 -1
  31. data/lib/datadog/ci/contrib/selenium/driver.rb +1 -1
  32. data/lib/datadog/ci/contrib/selenium/integration.rb +6 -10
  33. data/lib/datadog/ci/contrib/selenium/navigation.rb +6 -2
  34. data/lib/datadog/ci/contrib/selenium/patcher.rb +2 -6
  35. data/lib/datadog/ci/contrib/selenium/rum.rb +0 -2
  36. data/lib/datadog/ci/contrib/simplecov/integration.rb +6 -10
  37. data/lib/datadog/ci/contrib/simplecov/patcher.rb +2 -6
  38. data/lib/datadog/ci/test.rb +8 -7
  39. data/lib/datadog/ci/test_optimisation/component.rb +9 -4
  40. data/lib/datadog/ci/test_retries/strategy/retry_new.rb +1 -1
  41. data/lib/datadog/ci/test_visibility/component.rb +2 -2
  42. data/lib/datadog/ci/test_visibility/telemetry.rb +2 -1
  43. data/lib/datadog/ci/version.rb +2 -2
  44. data/lib/datadog/ci.rb +9 -1
  45. metadata +13 -7
  46. data/lib/datadog/ci/contrib/contrib.rb +0 -31
  47. data/lib/datadog/ci/contrib/rspec/knapsack_pro/extension.rb +0 -29
  48. data/lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb +0 -26
  49. data/lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb +0 -62
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-18 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: datadog
@@ -61,8 +61,10 @@ files:
61
61
  - ext/datadog_cov/datadog_cov.c
62
62
  - ext/datadog_cov/extconf.rb
63
63
  - lib/datadog/ci.rb
64
+ - lib/datadog/ci/auto_instrument.rb
64
65
  - lib/datadog/ci/cli/cli.rb
65
66
  - lib/datadog/ci/cli/command/base.rb
67
+ - lib/datadog/ci/cli/command/exec.rb
66
68
  - lib/datadog/ci/cli/command/skippable_tests_percentage.rb
67
69
  - lib/datadog/ci/cli/command/skippable_tests_percentage_estimate.rb
68
70
  - lib/datadog/ci/codeowners/matcher.rb
@@ -72,7 +74,8 @@ files:
72
74
  - lib/datadog/ci/configuration/components.rb
73
75
  - lib/datadog/ci/configuration/extensions.rb
74
76
  - lib/datadog/ci/configuration/settings.rb
75
- - lib/datadog/ci/contrib/contrib.rb
77
+ - lib/datadog/ci/contrib/ciqueue/integration.rb
78
+ - lib/datadog/ci/contrib/ciqueue/patcher.rb
76
79
  - lib/datadog/ci/contrib/cucumber/configuration/settings.rb
77
80
  - lib/datadog/ci/contrib/cucumber/ext.rb
78
81
  - lib/datadog/ci/contrib/cucumber/filter.rb
@@ -80,7 +83,12 @@ files:
80
83
  - lib/datadog/ci/contrib/cucumber/instrumentation.rb
81
84
  - lib/datadog/ci/contrib/cucumber/integration.rb
82
85
  - lib/datadog/ci/contrib/cucumber/patcher.rb
86
+ - lib/datadog/ci/contrib/instrumentation.rb
83
87
  - lib/datadog/ci/contrib/integration.rb
88
+ - lib/datadog/ci/contrib/knapsack/extension.rb
89
+ - lib/datadog/ci/contrib/knapsack/integration.rb
90
+ - lib/datadog/ci/contrib/knapsack/patcher.rb
91
+ - lib/datadog/ci/contrib/knapsack/runner.rb
84
92
  - lib/datadog/ci/contrib/minitest/configuration/settings.rb
85
93
  - lib/datadog/ci/contrib/minitest/ext.rb
86
94
  - lib/datadog/ci/contrib/minitest/helpers.rb
@@ -90,14 +98,12 @@ files:
90
98
  - lib/datadog/ci/contrib/minitest/runnable.rb
91
99
  - lib/datadog/ci/contrib/minitest/runner.rb
92
100
  - lib/datadog/ci/contrib/minitest/test.rb
101
+ - lib/datadog/ci/contrib/patcher.rb
93
102
  - lib/datadog/ci/contrib/rspec/configuration/settings.rb
94
103
  - lib/datadog/ci/contrib/rspec/example.rb
95
104
  - lib/datadog/ci/contrib/rspec/example_group.rb
96
105
  - lib/datadog/ci/contrib/rspec/ext.rb
97
106
  - lib/datadog/ci/contrib/rspec/integration.rb
98
- - lib/datadog/ci/contrib/rspec/knapsack_pro/extension.rb
99
- - lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb
100
- - lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb
101
107
  - lib/datadog/ci/contrib/rspec/patcher.rb
102
108
  - lib/datadog/ci/contrib/rspec/runner.rb
103
109
  - lib/datadog/ci/contrib/selenium/capybara_driver.rb
@@ -241,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
247
  - !ruby/object:Gem::Version
242
248
  version: 2.0.0
243
249
  requirements: []
244
- rubygems_version: 3.5.16
250
+ rubygems_version: 3.5.22
245
251
  signing_key:
246
252
  specification_version: 4
247
253
  summary: Datadog CI visibility for your ruby application
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "integration"
4
-
5
- module Datadog
6
- module CI
7
- module Contrib
8
- # This method auto instruments all test libraries (ex: selenium-webdriver).
9
- # It is intended to be called when test session starts to add additional capabilities to test visibility.
10
- #
11
- # This method does not automatically instrument test frameworks (ex: RSpec, Cucumber, etc), it requires
12
- # test framework to be already instrumented.
13
- def self.auto_instrument_on_session_start!
14
- Datadog.logger.debug("Auto instrumenting all integrations...")
15
-
16
- Integration.registry.each do |name, integration|
17
- next unless integration.auto_instrument?
18
-
19
- Datadog.logger.debug "#{name} is allowed to be auto instrumented"
20
-
21
- patch_results = integration.patch
22
- if patch_results == true
23
- Datadog.logger.debug("#{name} is patched")
24
- else
25
- Datadog.logger.debug("#{name} is not patched (#{patch_results})")
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "knapsack_pro/extensions/rspec_extension"
4
-
5
- require_relative "runner"
6
-
7
- module Datadog
8
- module CI
9
- module Contrib
10
- module RSpec
11
- module KnapsackPro
12
- module Extension
13
- def self.included(base)
14
- base.singleton_class.prepend(ClassMethods)
15
- end
16
-
17
- module ClassMethods
18
- def setup!
19
- super
20
-
21
- ::RSpec::Core::Runner.include(Datadog::CI::Contrib::RSpec::KnapsackPro::Runner)
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Datadog
4
- module CI
5
- module Contrib
6
- module RSpec
7
- module KnapsackPro
8
- module Patcher
9
- def self.patch
10
- if defined?(::KnapsackPro::Extensions::RSpecExtension::Runner) &&
11
- ::RSpec::Core::Runner.ancestors.include?(::KnapsackPro::Extensions::RSpecExtension::Runner)
12
- # knapsack already patched rspec runner
13
- require_relative "runner"
14
- ::RSpec::Core::Runner.include(KnapsackPro::Runner)
15
- else
16
- # knapsack didn't patch rspec runner yet
17
- require_relative "extension"
18
- ::KnapsackPro::Extensions::RSpecExtension.include(KnapsackPro::Extension)
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../../ext/test"
4
- require_relative "../ext"
5
-
6
- module Datadog
7
- module CI
8
- module Contrib
9
- module RSpec
10
- module KnapsackPro
11
- module Runner
12
- def self.included(base)
13
- base.prepend(InstanceMethods)
14
- end
15
-
16
- module InstanceMethods
17
- def knapsack__run_specs(*args)
18
- return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
19
- return super unless datadog_configuration[:enabled]
20
-
21
- test_session = test_visibility_component.start_test_session(
22
- tags: {
23
- CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
24
- CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s
25
- },
26
- service: datadog_configuration[:service_name]
27
- )
28
-
29
- test_module = test_visibility_component.start_test_module(Ext::FRAMEWORK)
30
-
31
- result = super
32
- return result unless test_module && test_session
33
-
34
- if result != 0
35
- test_module.failed!
36
- test_session.failed!
37
- else
38
- test_module.passed!
39
- test_session.passed!
40
- end
41
- test_module.finish
42
- test_session.finish
43
-
44
- result
45
- end
46
-
47
- private
48
-
49
- def datadog_configuration
50
- Datadog.configuration.ci[:rspec]
51
- end
52
-
53
- def test_visibility_component
54
- Datadog.send(:components).test_visibility
55
- end
56
- end
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end