datadog-ci 0.8.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6437d01abc30b7fd5bb6ec729d6b5a22877a85b1f82cd71c075353251b98bcd4
4
- data.tar.gz: 2b872c9737bd530287f719bf7b7a475638e61e662677b772aa3fe22e8dfb1504
3
+ metadata.gz: bf750f24412b0800ba1599f22c5b12e8679dddc1d0e9a30aed98d0a51a6badd3
4
+ data.tar.gz: 652631fac9702beb340f136e32d4b72b3b38d7c84a8de7dc8ce4f203dc67983b
5
5
  SHA512:
6
- metadata.gz: '084bdc7fa2dfa45581f8a11f3882ff56e71e241744ecbde54f6ca32b2d1086d78f00019af75d86f33b9ce8c3faaccc9bb4d9f54a08fd1f467080c0dc287fa9ea'
7
- data.tar.gz: '028f261a9674fc42378e5b47bf142d375e060b0ee8e9518ed59f89f022a60779ccbe10eee65633cf358b90a6c4311a455284ec98669b6eb44d073b18101beced'
6
+ metadata.gz: 3295d136609aca4be41cc041613873297a5e91bb37a428a6612a1e62f7e547db2bb2c836f4a0348fdd4466d085a29ec78a26962d48f1c59e05163dcb26668783
7
+ data.tar.gz: 5446bba62689a4133a75b64437efd47f8369814e863c8ddab0c91d52692b5bf71b5be2a4f4264839ec81374ff3c4ff498e4c2cd7a8c54f566e63558cb1f55cff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.3] - 2024-03-20
4
+
5
+ ### Fixed
6
+
7
+ * fix: cucumber-ruby 9.2 includes breaking change for Cucumber::Core::Test::Result ([#145][])
8
+
9
+ ### Changed
10
+
11
+ * remove temporary hack and use Core::Remote::Negotiation's new constructor param ([#142][])
12
+ * use filter_basic_auth method from Datadog::Core ([#141][])
13
+
14
+ ## [0.8.2] - 2024-03-19
15
+
16
+ ### Fixed
17
+
18
+ * assign the single running test suite for a test if none found by test suite name ([#139][])
19
+
3
20
  ## [0.8.1] - 2024-03-12
4
21
 
5
22
  ### Fixed
@@ -170,7 +187,9 @@ Currently test suite level visibility is not used by our instrumentation: it wil
170
187
 
171
188
  * Ruby versions < 2.7 no longer supported ([#8][])
172
189
 
173
- [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.1...main
190
+ [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.3...main
191
+ [0.8.3]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.2...v0.8.3
192
+ [0.8.2]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.1...v0.8.2
174
193
  [0.8.1]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.0...v0.8.1
175
194
  [0.8.0]: https://github.com/DataDog/datadog-ci-rb/compare/v0.7.0...v0.8.0
176
195
  [0.7.0]: https://github.com/DataDog/datadog-ci-rb/compare/v0.6.0...v0.7.0
@@ -239,3 +258,7 @@ Currently test suite level visibility is not used by our instrumentation: it wil
239
258
  [#123]: https://github.com/DataDog/datadog-ci-rb/issues/123
240
259
  [#131]: https://github.com/DataDog/datadog-ci-rb/issues/131
241
260
  [#134]: https://github.com/DataDog/datadog-ci-rb/issues/134
261
+ [#139]: https://github.com/DataDog/datadog-ci-rb/issues/139
262
+ [#141]: https://github.com/DataDog/datadog-ci-rb/issues/141
263
+ [#142]: https://github.com/DataDog/datadog-ci-rb/issues/142
264
+ [#145]: https://github.com/DataDog/datadog-ci-rb/issues/145
data/README.md CHANGED
@@ -79,6 +79,25 @@ if ENV["DD_ENV"] == "ci"
79
79
  end
80
80
  ```
81
81
 
82
+ > [!IMPORTANT]
83
+ > When using `minitest/autorun` the order of requires matters: `datadog/ci` must be
84
+ > always required before `minitest/autorun`.
85
+
86
+ Example using `minitest/autorun`
87
+
88
+ ```ruby
89
+ require 'datadog/ci'
90
+ require 'minitest/autorun'
91
+
92
+ if ENV["DD_ENV"] == "ci"
93
+ Datadog.configure do |c|
94
+ c.ci.enabled = true
95
+ c.service = 'my-ruby-app'
96
+ c.ci.instrument :minitest
97
+ end
98
+ end
99
+ ```
100
+
82
101
  `options` are the following keyword arguments:
83
102
 
84
103
  | Key | Description | Default |
@@ -113,7 +113,7 @@ module Datadog
113
113
  end
114
114
 
115
115
  def finish_span(span, result)
116
- if !result.passed? && result.ok?(@config.strict)
116
+ if !result.passed? && ok?(result, @config.strict)
117
117
  span.skipped!(reason: result.message)
118
118
  elsif result.passed?
119
119
  span.passed!
@@ -186,6 +186,16 @@ module Datadog
186
186
  nil
187
187
  end
188
188
 
189
+ def ok?(result, strict)
190
+ # in minor update in Cucumber 9.2.0, the arity of the `ok?` method changed
191
+ parameters = result.method(:ok?).parameters
192
+ if parameters == [[:opt, :be_strict]]
193
+ result.ok?(strict)
194
+ else
195
+ result.ok?(strict: strict)
196
+ end
197
+ end
198
+
189
199
  def configuration
190
200
  Datadog.configuration.ci[:cucumber]
191
201
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "datadog/core/utils/url"
4
+
3
5
  require_relative "../git"
4
6
  require_relative "../../utils/git"
5
- require_relative "../../utils/url"
6
7
  require_relative "providers"
7
8
 
8
9
  module Datadog
@@ -76,7 +77,7 @@ module Datadog
76
77
 
77
78
  @tags[Git::TAG_TAG] = Utils::Git.normalize_ref(@tags[Git::TAG_TAG])
78
79
  @tags[Git::TAG_BRANCH] = Utils::Git.normalize_ref(@tags[Git::TAG_BRANCH])
79
- @tags[Git::TAG_REPOSITORY_URL] = Utils::Url.filter_sensitive_info(
80
+ @tags[Git::TAG_REPOSITORY_URL] = Datadog::Core::Utils::Url.filter_basic_auth(
80
81
  @tags[Git::TAG_REPOSITORY_URL]
81
82
  )
82
83
  end
@@ -2,8 +2,9 @@
2
2
 
3
3
  require "json"
4
4
 
5
+ require "datadog/core/utils/url"
6
+
5
7
  require_relative "base"
6
- require_relative "../../../utils/url"
7
8
 
8
9
  module Datadog
9
10
  module CI
@@ -79,7 +80,7 @@ module Datadog
79
80
  def github_server_url
80
81
  return @github_server_url if defined?(@github_server_url)
81
82
 
82
- @github_server_url ||= Utils::Url.filter_sensitive_info(env["GITHUB_SERVER_URL"])
83
+ @github_server_url ||= Datadog::Core::Utils::Url.filter_basic_auth(env["GITHUB_SERVER_URL"])
83
84
  end
84
85
  end
85
86
  end
@@ -21,6 +21,14 @@ module Datadog
21
21
  end
22
22
  end
23
23
 
24
+ def fetch_single_test_suite
25
+ @mutex.synchronize do
26
+ return nil if @test_suites.empty? || @test_suites.size > 1
27
+
28
+ @test_suites.values.first
29
+ end
30
+ end
31
+
24
32
  def fetch_or_activate_test_module(&block)
25
33
  @mutex.synchronize do
26
34
  @test_module ||= block.call
@@ -227,6 +227,11 @@ module Datadog
227
227
  def build_test(tracer_span, tags)
228
228
  test = Test.new(tracer_span)
229
229
  set_initial_tags(test, tags)
230
+
231
+ # sometimes test suite is not being assigned correctly
232
+ # fix it by fetching the one single running test suite from the global context
233
+ fix_test_suite!(test) if test.test_suite_id.nil?
234
+
230
235
  validate_test_suite_level_visibility_correctness(test)
231
236
  set_codeowners(test)
232
237
 
@@ -294,6 +299,24 @@ module Datadog
294
299
  end
295
300
  end
296
301
 
302
+ def fix_test_suite!(test)
303
+ test_suite = @global_context.fetch_single_test_suite
304
+ unless test_suite
305
+ Datadog.logger.debug do
306
+ "Trying to fix test suite for test [#{test.name}] but no single test suite is running."
307
+ end
308
+ return
309
+ end
310
+
311
+ Datadog.logger.debug do
312
+ "For test [#{test.name}]: expected test suite [#{test.test_suite_name}] to be running, " \
313
+ "but it was not found. Fixing it by assigning test suite [#{test_suite.name}] to the test."
314
+ end
315
+
316
+ test.set_tag(Ext::Test::TAG_TEST_SUITE_ID, test_suite.id.to_s)
317
+ test.set_tag(Ext::Test::TAG_SUITE, test_suite.name)
318
+ end
319
+
297
320
  def start_datadog_tracer_span(span_name, span_options, &block)
298
321
  if block
299
322
  Datadog::Tracing.trace(span_name, **span_options) do |tracer_span, trace|
@@ -29,10 +29,11 @@ module Datadog
29
29
 
30
30
  def self.build_evp_proxy_api(settings)
31
31
  agent_settings = Datadog::Core::Configuration::AgentSettingsResolver.call(settings)
32
- negotiation = Datadog::Core::Remote::Negotiation.new(settings, agent_settings)
33
-
34
- # temporary, remove this when patch will be accepted in Core to make logging configurable
35
- negotiation.instance_variable_set(:@logged, {no_config_endpoint: true})
32
+ negotiation = Datadog::Core::Remote::Negotiation.new(
33
+ settings,
34
+ agent_settings,
35
+ suppress_logging: {no_config_endpoint: true}
36
+ )
36
37
 
37
38
  evp_proxy_path_prefix = Ext::Transport::EVP_PROXY_PATH_PREFIXES.find do |path_prefix|
38
39
  negotiation.endpoint?(path_prefix)
@@ -5,7 +5,7 @@ module Datadog
5
5
  module VERSION
6
6
  MAJOR = "0"
7
7
  MINOR = "8"
8
- PATCH = "1"
8
+ PATCH = "3"
9
9
  PRE = nil
10
10
  BUILD = nil
11
11
  # PRE and BUILD above are modified for dev gems during gem build GHA workflow
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: 0.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-12 00:00:00.000000000 Z
11
+ date: 2024-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -129,7 +129,6 @@ files:
129
129
  - lib/datadog/ci/utils/configuration.rb
130
130
  - lib/datadog/ci/utils/git.rb
131
131
  - lib/datadog/ci/utils/test_run.rb
132
- - lib/datadog/ci/utils/url.rb
133
132
  - lib/datadog/ci/version.rb
134
133
  homepage: https://github.com/DataDog/datadog-ci-rb
135
134
  licenses:
@@ -157,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
156
  - !ruby/object:Gem::Version
158
157
  version: 2.0.0
159
158
  requirements: []
160
- rubygems_version: 3.5.3
159
+ rubygems_version: 3.5.6
161
160
  signing_key:
162
161
  specification_version: 4
163
162
  summary: Datadog CI visibility for your ruby application
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Datadog
4
- module CI
5
- module Utils
6
- module Url
7
- def self.filter_sensitive_info(url)
8
- return nil if url.nil?
9
-
10
- url.gsub(%r{((https?|ssh)://)[^/]*@}, '\1')
11
- end
12
- end
13
- end
14
- end
15
- end