datadog-ci 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -2
- data/lib/datadog/ci/async_writer.rb +112 -0
- data/lib/datadog/ci/codeowners/rule.rb +5 -0
- data/lib/datadog/ci/configuration/components.rb +50 -9
- data/lib/datadog/ci/configuration/settings.rb +17 -0
- data/lib/datadog/ci/contrib/activesupport/configuration/settings.rb +25 -0
- data/lib/datadog/ci/contrib/activesupport/ext.rb +14 -0
- data/lib/datadog/ci/contrib/activesupport/integration.rb +43 -0
- data/lib/datadog/ci/contrib/activesupport/logs_formatter.rb +41 -0
- data/lib/datadog/ci/contrib/activesupport/patcher.rb +50 -0
- data/lib/datadog/ci/contrib/knapsack/patcher.rb +1 -3
- data/lib/datadog/ci/contrib/knapsack/runner.rb +2 -0
- data/lib/datadog/ci/contrib/lograge/configuration/settings.rb +25 -0
- data/lib/datadog/ci/contrib/lograge/ext.rb +14 -0
- data/lib/datadog/ci/contrib/lograge/integration.rb +43 -0
- data/lib/datadog/ci/contrib/lograge/log_subscriber.rb +41 -0
- data/lib/datadog/ci/contrib/lograge/patcher.rb +32 -0
- data/lib/datadog/ci/contrib/minitest/runner.rb +1 -0
- data/lib/datadog/ci/contrib/minitest/test.rb +7 -2
- data/lib/datadog/ci/contrib/parallel_tests/patcher.rb +1 -4
- data/lib/datadog/ci/contrib/patcher.rb +4 -0
- data/lib/datadog/ci/contrib/rspec/helpers.rb +1 -3
- data/lib/datadog/ci/contrib/semantic_logger/configuration/settings.rb +25 -0
- data/lib/datadog/ci/contrib/semantic_logger/ext.rb +14 -0
- data/lib/datadog/ci/contrib/semantic_logger/integration.rb +42 -0
- data/lib/datadog/ci/contrib/semantic_logger/logger.rb +32 -0
- data/lib/datadog/ci/contrib/semantic_logger/patcher.rb +32 -0
- data/lib/datadog/ci/ext/environment/extractor.rb +4 -6
- data/lib/datadog/ci/ext/environment/providers/appveyor.rb +5 -0
- data/lib/datadog/ci/ext/environment/providers/base.rb +7 -2
- data/lib/datadog/ci/ext/environment/providers/bitbucket.rb +6 -0
- data/lib/datadog/ci/ext/environment/providers/bitrise.rb +7 -1
- data/lib/datadog/ci/ext/environment/providers/buddy.rb +5 -0
- data/lib/datadog/ci/ext/environment/providers/github_actions.rb +37 -18
- data/lib/datadog/ci/ext/environment/providers/gitlab.rb +13 -1
- data/lib/datadog/ci/ext/environment/providers/user_defined_tags.rb +12 -0
- data/lib/datadog/ci/ext/git.rb +3 -0
- data/lib/datadog/ci/ext/settings.rb +3 -0
- data/lib/datadog/ci/ext/telemetry.rb +4 -0
- data/lib/datadog/ci/ext/test.rb +7 -3
- data/lib/datadog/ci/ext/transport.rb +3 -0
- data/lib/datadog/ci/git/local_repository.rb +238 -4
- data/lib/datadog/ci/git/tree_uploader.rb +10 -3
- data/lib/datadog/ci/impacted_tests_detection/component.rb +83 -0
- data/lib/datadog/ci/impacted_tests_detection/telemetry.rb +16 -0
- data/lib/datadog/ci/logs/component.rb +46 -0
- data/lib/datadog/ci/logs/transport.rb +73 -0
- data/lib/datadog/ci/remote/component.rb +6 -1
- data/lib/datadog/ci/remote/library_settings.rb +8 -0
- data/lib/datadog/ci/span.rb +7 -0
- data/lib/datadog/ci/test.rb +16 -0
- data/lib/datadog/ci/test_management/tests_properties.rb +2 -1
- data/lib/datadog/ci/test_retries/component.rb +8 -17
- data/lib/datadog/ci/test_retries/driver/{retry_new.rb → retry_flake_detection.rb} +2 -2
- data/lib/datadog/ci/test_retries/strategy/{retry_new.rb → retry_flake_detection.rb} +4 -4
- data/lib/datadog/ci/test_visibility/component.rb +6 -0
- data/lib/datadog/ci/test_visibility/null_component.rb +3 -1
- data/lib/datadog/ci/transport/api/agentless.rb +8 -1
- data/lib/datadog/ci/transport/api/base.rb +4 -0
- data/lib/datadog/ci/transport/api/builder.rb +5 -1
- data/lib/datadog/ci/transport/api/evp_proxy.rb +4 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci.rb +3 -0
- metadata +25 -6
- data/lib/datadog/ci/test_optimisation/coverage/writer.rb +0 -116
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module CI
|
5
|
+
module Contrib
|
6
|
+
module Lograge
|
7
|
+
module LogSubscriber
|
8
|
+
def self.included(base)
|
9
|
+
base.prepend(InstanceMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module InstanceMethods
|
13
|
+
private
|
14
|
+
|
15
|
+
def before_format(data, payload)
|
16
|
+
return super unless datadog_logs_component.enabled
|
17
|
+
return super unless datadog_configuration[:enabled]
|
18
|
+
|
19
|
+
result = super
|
20
|
+
|
21
|
+
if result.fetch(:dd, {}).fetch(:trace_id, nil).nil?
|
22
|
+
Datadog.logger.debug { "Discarding uncorrelated log event: #{result.inspect}" }
|
23
|
+
return result
|
24
|
+
end
|
25
|
+
datadog_logs_component.write(result)
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
29
|
+
def datadog_logs_component
|
30
|
+
Datadog.send(:components).agentless_logs_submission
|
31
|
+
end
|
32
|
+
|
33
|
+
def datadog_configuration
|
34
|
+
Datadog.configuration.ci[:lograge]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../patcher"
|
4
|
+
require_relative "log_subscriber"
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module CI
|
8
|
+
module Contrib
|
9
|
+
module Lograge
|
10
|
+
# Patcher enables patching of lograge module
|
11
|
+
module Patcher
|
12
|
+
include Datadog::CI::Contrib::Patcher
|
13
|
+
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def patch
|
17
|
+
unless datadog_logs_component.enabled
|
18
|
+
Datadog.logger.debug("Datadog logs submission is disabled, skipping lograge patching")
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
::Lograge::LogSubscribers::Base.include(LogSubscriber)
|
23
|
+
end
|
24
|
+
|
25
|
+
def datadog_logs_component
|
26
|
+
Datadog.send(:components).agentless_logs_submission
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -40,7 +40,11 @@ module Datadog
|
|
40
40
|
},
|
41
41
|
service: datadog_configuration[:service_name]
|
42
42
|
)
|
43
|
+
# Steep type checker doesn't know that we patched Minitest::Test class definition
|
44
|
+
#
|
45
|
+
# steep:ignore:start
|
43
46
|
test_span&.itr_unskippable! if self.class.dd_suite_unskippable? || self.class.dd_test_unskippable?(name)
|
47
|
+
# steep:ignore:end
|
44
48
|
skip(test_span&.datadog_skip_reason) if test_span&.should_skip?
|
45
49
|
end
|
46
50
|
|
@@ -100,9 +104,10 @@ module Datadog
|
|
100
104
|
end
|
101
105
|
|
102
106
|
def dd_test_unskippable?(test_name)
|
103
|
-
|
107
|
+
tests = @datadog_itr_unskippable_tests
|
108
|
+
return false unless tests
|
104
109
|
|
105
|
-
|
110
|
+
tests.include?(test_name)
|
106
111
|
end
|
107
112
|
end
|
108
113
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "cli"
|
4
|
-
require_relative "integration"
|
5
4
|
require_relative "../patcher"
|
6
5
|
|
7
6
|
module Datadog
|
@@ -12,9 +11,7 @@ module Datadog
|
|
12
11
|
module Patcher
|
13
12
|
include Datadog::CI::Contrib::Patcher
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
def patch
|
14
|
+
def self.patch
|
18
15
|
::ParallelTests::CLI.include(CLI)
|
19
16
|
end
|
20
17
|
end
|
@@ -29,9 +29,13 @@ module Datadog
|
|
29
29
|
return unless defined?(super)
|
30
30
|
|
31
31
|
patch_only_once.run do
|
32
|
+
# There is no way to tell Steep that we prepend these methods to modules that have .patch method
|
33
|
+
#
|
34
|
+
# steep:ignore:start
|
32
35
|
super.tap do
|
33
36
|
@patch_successful = true
|
34
37
|
end
|
38
|
+
# steep:ignore:end
|
35
39
|
rescue => e
|
36
40
|
on_patch_error(e)
|
37
41
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../ext"
|
4
|
+
require_relative "../../settings"
|
5
|
+
require_relative "../../../utils/configuration"
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
module CI
|
9
|
+
module Contrib
|
10
|
+
module SemanticLogger
|
11
|
+
module Configuration
|
12
|
+
# Custom settings for the SemanticLogger integration
|
13
|
+
# @public_api
|
14
|
+
class Settings < Datadog::CI::Contrib::Settings
|
15
|
+
option :enabled do |o|
|
16
|
+
o.type :bool
|
17
|
+
o.env Ext::ENV_ENABLED
|
18
|
+
o.default true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../integration"
|
4
|
+
require_relative "configuration/settings"
|
5
|
+
require_relative "patcher"
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
module CI
|
9
|
+
module Contrib
|
10
|
+
module SemanticLogger
|
11
|
+
# Description of SemanticLogger integration
|
12
|
+
class Integration < Datadog::CI::Contrib::Integration
|
13
|
+
MINIMUM_VERSION = Gem::Version.new("4.0")
|
14
|
+
|
15
|
+
def version
|
16
|
+
Gem.loaded_specs["semantic_logger"]&.version
|
17
|
+
end
|
18
|
+
|
19
|
+
def loaded?
|
20
|
+
!defined?(::SemanticLogger).nil? && !defined?(::SemanticLogger::Logger).nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def compatible?
|
24
|
+
super && version >= MINIMUM_VERSION
|
25
|
+
end
|
26
|
+
|
27
|
+
def late_instrument?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def new_configuration
|
32
|
+
Configuration::Settings.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def patcher
|
36
|
+
Patcher
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module CI
|
5
|
+
module Contrib
|
6
|
+
module SemanticLogger
|
7
|
+
module Logger
|
8
|
+
def self.included(base)
|
9
|
+
base.prepend(InstanceMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module InstanceMethods
|
13
|
+
def log(log, message = nil, progname = nil, &block)
|
14
|
+
return super unless log.is_a?(::SemanticLogger::Log)
|
15
|
+
return super unless datadog_logs_component.enabled
|
16
|
+
|
17
|
+
result = super
|
18
|
+
|
19
|
+
datadog_logs_component.write(log.to_h.clone)
|
20
|
+
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
def datadog_logs_component
|
25
|
+
Datadog.send(:components).agentless_logs_submission
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../patcher"
|
4
|
+
require_relative "logger"
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module CI
|
8
|
+
module Contrib
|
9
|
+
module SemanticLogger
|
10
|
+
# Patcher enables patching of semantic_logger module
|
11
|
+
module Patcher
|
12
|
+
include Datadog::CI::Contrib::Patcher
|
13
|
+
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def patch
|
17
|
+
unless datadog_logs_component.enabled
|
18
|
+
Datadog.logger.debug("Datadog logs submission is disabled, skipping semantic_logger patching")
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
::SemanticLogger::Logger.include(Logger)
|
23
|
+
end
|
24
|
+
|
25
|
+
def datadog_logs_component
|
26
|
+
Datadog.send(:components).agentless_logs_submission
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -46,14 +46,12 @@ module Datadog
|
|
46
46
|
Git::TAG_COMMIT_COMMITTER_EMAIL => @provider.git_commit_committer_email,
|
47
47
|
Git::TAG_COMMIT_COMMITTER_NAME => @provider.git_commit_committer_name,
|
48
48
|
Git::TAG_COMMIT_MESSAGE => @provider.git_commit_message,
|
49
|
-
Git::TAG_COMMIT_SHA => @provider.git_commit_sha
|
49
|
+
Git::TAG_COMMIT_SHA => @provider.git_commit_sha,
|
50
|
+
Git::TAG_PULL_REQUEST_BASE_BRANCH => @provider.git_pull_request_base_branch,
|
51
|
+
Git::TAG_PULL_REQUEST_BASE_BRANCH_SHA => @provider.git_pull_request_base_branch_sha,
|
52
|
+
Git::TAG_COMMIT_HEAD_SHA => @provider.git_commit_head_sha
|
50
53
|
}
|
51
54
|
|
52
|
-
# set additional tags if provider needs them
|
53
|
-
@provider.additional_tags.each do |key, value|
|
54
|
-
@tags[key] = value
|
55
|
-
end
|
56
|
-
|
57
55
|
# Normalize Git references and filter sensitive data
|
58
56
|
normalize_git!
|
59
57
|
# Expand ~
|
@@ -83,6 +83,11 @@ module Datadog
|
|
83
83
|
commit_message
|
84
84
|
end
|
85
85
|
|
86
|
+
def git_pull_request_base_branch
|
87
|
+
# from docs: build branch. For Pull Request commits it is base branch PR is merging into
|
88
|
+
env["APPVEYOR_REPO_BRANCH"]
|
89
|
+
end
|
90
|
+
|
86
91
|
private
|
87
92
|
|
88
93
|
def github_repo_provider?
|
@@ -59,6 +59,12 @@ module Datadog
|
|
59
59
|
env["BITBUCKET_TAG"]
|
60
60
|
end
|
61
61
|
|
62
|
+
def git_pull_request_base_branch
|
63
|
+
# from docs: The pull request destination branch (used in combination with BITBUCKET_BRANCH).
|
64
|
+
# Only available on a pull request triggered build
|
65
|
+
env["BITBUCKET_PR_DESTINATION_BRANCH"]
|
66
|
+
end
|
67
|
+
|
62
68
|
private
|
63
69
|
|
64
70
|
def url
|
@@ -47,7 +47,7 @@ module Datadog
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def git_branch
|
50
|
-
env["
|
50
|
+
env["BITRISEIO_PULL_REQUEST_HEAD_BRANCH"] || env["BITRISE_GIT_BRANCH"]
|
51
51
|
end
|
52
52
|
|
53
53
|
def git_tag
|
@@ -73,6 +73,12 @@ module Datadog
|
|
73
73
|
def git_commit_committer_email
|
74
74
|
env["GIT_CLONE_COMMIT_COMMITER_EMAIL"] || env["GIT_CLONE_COMMIT_COMMITER_NAME"]
|
75
75
|
end
|
76
|
+
|
77
|
+
def git_pull_request_base_branch
|
78
|
+
# from docs: Used only with builds triggered by pull requests: the destination/target branch of the pull request that triggered the build.
|
79
|
+
# For example, a pull request wants to merge the content of a branch into the branch main. In this case, this Env Var’s value is main.
|
80
|
+
env["BITRISEIO_GIT_BRANCH_DEST"]
|
81
|
+
end
|
76
82
|
end
|
77
83
|
end
|
78
84
|
end
|
@@ -65,6 +65,11 @@ module Datadog
|
|
65
65
|
def git_commit_committer_email
|
66
66
|
env["BUDDY_EXECUTION_REVISION_COMMITTER_EMAIL"]
|
67
67
|
end
|
68
|
+
|
69
|
+
def git_pull_request_base_branch
|
70
|
+
# from docs: The name of the Git BASE branch of the currently run Pull Request
|
71
|
+
env["BUDDY_RUN_PR_BASE_BRANCH"]
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
@@ -76,34 +76,53 @@ module Datadog
|
|
76
76
|
}.reject { |_, v| v.nil? }.to_json
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
80
|
-
|
81
|
-
return {} if base_ref.nil? || base_ref.empty?
|
79
|
+
def git_pull_request_base_branch
|
80
|
+
return nil if github_event_json.nil?
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
Git::TAG_PULL_REQUEST_BASE_BRANCH => base_ref
|
86
|
-
}
|
87
|
-
|
88
|
-
event_path = env["GITHUB_EVENT_PATH"]
|
89
|
-
event_json = JSON.parse(File.read(event_path))
|
82
|
+
env["GITHUB_BASE_REF"]
|
83
|
+
end
|
90
84
|
|
91
|
-
|
92
|
-
|
85
|
+
def git_pull_request_base_branch_sha
|
86
|
+
return nil if git_pull_request_base_branch.nil?
|
93
87
|
|
94
|
-
|
95
|
-
|
88
|
+
event_json = github_event_json
|
89
|
+
return nil if event_json.nil?
|
96
90
|
|
97
|
-
|
91
|
+
event_json.dig("pull_request", "base", "sha")
|
98
92
|
rescue => e
|
99
|
-
Datadog.logger.error("Failed to extract
|
100
|
-
Core::Telemetry::Logger.report(e, description: "Failed to extract
|
93
|
+
Datadog.logger.error("Failed to extract pull request base branch SHA from GitHub Actions: #{e}")
|
94
|
+
Core::Telemetry::Logger.report(e, description: "Failed to extract pull request base branch SHA from GitHub Actions")
|
95
|
+
nil
|
96
|
+
end
|
101
97
|
|
102
|
-
|
98
|
+
def git_commit_head_sha
|
99
|
+
return nil if git_pull_request_base_branch.nil?
|
100
|
+
|
101
|
+
event_json = github_event_json
|
102
|
+
return nil if event_json.nil?
|
103
|
+
|
104
|
+
event_json.dig("pull_request", "head", "sha")
|
105
|
+
rescue => e
|
106
|
+
Datadog.logger.error("Failed to extract commit head SHA from GitHub Actions: #{e}")
|
107
|
+
Core::Telemetry::Logger.report(e, description: "Failed to extract commit head SHA from GitHub Actions")
|
108
|
+
nil
|
103
109
|
end
|
104
110
|
|
105
111
|
private
|
106
112
|
|
113
|
+
def github_event_json
|
114
|
+
return @github_event_json if defined?(@github_event_json)
|
115
|
+
|
116
|
+
event_path = env["GITHUB_EVENT_PATH"]
|
117
|
+
return @github_event_json = nil if event_path.nil? || event_path.empty?
|
118
|
+
|
119
|
+
@github_event_json = JSON.parse(File.read(event_path))
|
120
|
+
rescue => e
|
121
|
+
Datadog.logger.error("Failed to parse GitHub event JSON: #{e}")
|
122
|
+
Core::Telemetry::Logger.report(e, description: "Failed to parse GitHub event JSON")
|
123
|
+
@github_event_json = nil
|
124
|
+
end
|
125
|
+
|
107
126
|
def github_server_url
|
108
127
|
return @github_server_url if defined?(@github_server_url)
|
109
128
|
|
@@ -100,13 +100,25 @@ module Datadog
|
|
100
100
|
}.to_json
|
101
101
|
end
|
102
102
|
|
103
|
+
def git_pull_request_base_branch
|
104
|
+
env["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]
|
105
|
+
end
|
106
|
+
|
107
|
+
def git_pull_request_base_branch_sha
|
108
|
+
env["CI_MERGE_REQUEST_TARGET_BRANCH_SHA"]
|
109
|
+
end
|
110
|
+
|
111
|
+
def git_commit_head_sha
|
112
|
+
env["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"]
|
113
|
+
end
|
114
|
+
|
103
115
|
private
|
104
116
|
|
105
117
|
def extract_name_email
|
106
118
|
return @name_email_tuple if defined?(@name_email_tuple)
|
107
119
|
|
108
120
|
name_and_email_string = env["CI_COMMIT_AUTHOR"]
|
109
|
-
if name_and_email_string
|
121
|
+
if name_and_email_string&.include?("<") && (match = /^([^<]*)<([^>]*)>$/.match(name_and_email_string))
|
110
122
|
name = match[1]
|
111
123
|
name = name.strip if name
|
112
124
|
email = match[2]
|
@@ -54,6 +54,18 @@ module Datadog
|
|
54
54
|
def git_commit_committer_date
|
55
55
|
env[Git::ENV_COMMIT_COMMITTER_DATE]
|
56
56
|
end
|
57
|
+
|
58
|
+
def git_pull_request_base_branch
|
59
|
+
env[Git::ENV_PULL_REQUEST_BASE_BRANCH]
|
60
|
+
end
|
61
|
+
|
62
|
+
def git_pull_request_base_branch_sha
|
63
|
+
env[Git::ENV_PULL_REQUEST_BASE_BRANCH_SHA]
|
64
|
+
end
|
65
|
+
|
66
|
+
def git_commit_head_sha
|
67
|
+
env[Git::ENV_COMMIT_HEAD_SHA]
|
68
|
+
end
|
57
69
|
end
|
58
70
|
end
|
59
71
|
end
|
data/lib/datadog/ci/ext/git.rb
CHANGED
@@ -36,6 +36,9 @@ module Datadog
|
|
36
36
|
ENV_COMMIT_COMMITTER_NAME = "DD_GIT_COMMIT_COMMITTER_NAME"
|
37
37
|
ENV_COMMIT_COMMITTER_EMAIL = "DD_GIT_COMMIT_COMMITTER_EMAIL"
|
38
38
|
ENV_COMMIT_COMMITTER_DATE = "DD_GIT_COMMIT_COMMITTER_DATE"
|
39
|
+
ENV_PULL_REQUEST_BASE_BRANCH = "DD_GIT_PULL_REQUEST_BASE_BRANCH"
|
40
|
+
ENV_PULL_REQUEST_BASE_BRANCH_SHA = "DD_GIT_PULL_REQUEST_BASE_BRANCH_SHA"
|
41
|
+
ENV_COMMIT_HEAD_SHA = "DD_GIT_COMMIT_HEAD_SHA"
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -23,6 +23,9 @@ module Datadog
|
|
23
23
|
ENV_TEST_MANAGEMENT_ENABLED = "DD_TEST_MANAGEMENT_ENABLED"
|
24
24
|
ENV_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES = "DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES"
|
25
25
|
ENV_TEST_VISIBILITY_DRB_SERVER_URI = "DD_TEST_VISIBILITY_DRB_SERVER_URI"
|
26
|
+
ENV_AGENTLESS_LOGS_SUBMISSION_ENABLED = "DD_AGENTLESS_LOG_SUBMISSION_ENABLED"
|
27
|
+
ENV_AGENTLESS_LOGS_SUBMISSION_URL = "DD_AGENTLESS_LOG_SUBMISSION_URL"
|
28
|
+
ENV_IMPACTED_TESTS_DETECTION_ENABLED = "DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED"
|
26
29
|
|
27
30
|
# Source: https://docs.datadoghq.com/getting_started/site/
|
28
31
|
DD_SITE_ALLOWLIST = %w[
|
@@ -68,6 +68,8 @@ module Datadog
|
|
68
68
|
|
69
69
|
METRIC_TEST_SESSION = "test_session"
|
70
70
|
|
71
|
+
METRIC_IMPACTED_TESTS_IS_MODIFIED = "impacted_tests.is_modified"
|
72
|
+
|
71
73
|
TAG_TEST_FRAMEWORK = "test_framework"
|
72
74
|
TAG_EVENT_TYPE = "event_type"
|
73
75
|
TAG_HAS_CODEOWNER = "has_codeowner"
|
@@ -138,6 +140,8 @@ module Datadog
|
|
138
140
|
GET_LOCAL_COMMITS = "get_local_commits"
|
139
141
|
GET_OBJECTS = "get_objects"
|
140
142
|
PACK_OBJECTS = "pack_objects"
|
143
|
+
DIFF = "diff"
|
144
|
+
BASE_COMMIT_SHA = "base_commit_sha"
|
141
145
|
end
|
142
146
|
|
143
147
|
module Provider
|
data/lib/datadog/ci/ext/test.rb
CHANGED
@@ -94,7 +94,7 @@ module Datadog
|
|
94
94
|
AUTO_TEST_RETRIES_VERSION = "1"
|
95
95
|
TEST_MANAGEMENT_QUARANTINE_VERSION = "1"
|
96
96
|
TEST_MANAGEMENT_DISABLE_VERSION = "1"
|
97
|
-
TEST_MANAGEMENT_ATTEMPT_TO_FIX_VERSION = "
|
97
|
+
TEST_MANAGEMENT_ATTEMPT_TO_FIX_VERSION = "4"
|
98
98
|
end
|
99
99
|
|
100
100
|
# Map of capabilities to their versions
|
@@ -108,6 +108,9 @@ module Datadog
|
|
108
108
|
}.freeze
|
109
109
|
end
|
110
110
|
|
111
|
+
# impacted tests detection
|
112
|
+
TAG_TEST_IS_MODIFIED = "test.is_modified"
|
113
|
+
|
111
114
|
# internal APM tag to mark a span as a test span
|
112
115
|
TAG_SPAN_KIND = "span.kind"
|
113
116
|
SPAN_KIND_TEST = "test"
|
@@ -151,9 +154,10 @@ module Datadog
|
|
151
154
|
|
152
155
|
# possible reasons why a test was retried
|
153
156
|
module RetryReason
|
154
|
-
|
155
|
-
RETRY_FAILED = "
|
157
|
+
RETRY_DETECT_FLAKY = "early_flake_detection"
|
158
|
+
RETRY_FAILED = "auto_test_retries"
|
156
159
|
RETRY_FLAKY_FIXED = "attempt_to_fix"
|
160
|
+
RETRY_EXTERNAL = "external"
|
157
161
|
end
|
158
162
|
|
159
163
|
# possible reasons why a test was skipped
|
@@ -28,6 +28,8 @@ module Datadog
|
|
28
28
|
TEST_COVERAGE_INTAKE_HOST_PREFIX = "citestcov-intake"
|
29
29
|
TEST_COVERAGE_INTAKE_PATH = "/api/v2/citestcov"
|
30
30
|
|
31
|
+
LOGS_INTAKE_HOST_PREFIX = "http-intake.logs"
|
32
|
+
|
31
33
|
DD_API_HOST_PREFIX = "api"
|
32
34
|
|
33
35
|
DD_API_SETTINGS_PATH = "/api/v2/libraries/tests/services/setting"
|
@@ -46,6 +48,7 @@ module Datadog
|
|
46
48
|
DD_API_SETTINGS_RESPONSE_TEST_MANAGEMENT_KEY = "test_management"
|
47
49
|
DD_API_SETTINGS_RESPONSE_ATTEMPT_TO_FIX_RETRIES_KEY = "attempt_to_fix_retries"
|
48
50
|
DD_API_SETTINGS_RESPONSE_DEFAULT = {DD_API_SETTINGS_RESPONSE_ITR_ENABLED_KEY => false}.freeze
|
51
|
+
DD_API_SETTINGS_RESPONSE_IMPACTED_TESTS_ENABLED_KEY = "impacted_tests_enabled"
|
49
52
|
|
50
53
|
DD_API_GIT_SEARCH_COMMITS_PATH = "/api/v2/git/repository/search_commits"
|
51
54
|
|