datadog-ci 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +30 -0
- data/LICENSE +6 -0
- data/LICENSE-3rdparty.csv +2 -0
- data/LICENSE.Apache +200 -0
- data/LICENSE.BSD3 +24 -0
- data/NOTICE +4 -0
- data/README.md +125 -0
- data/lib/datadog/ci/configuration/components.rb +32 -0
- data/lib/datadog/ci/configuration/settings.rb +51 -0
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +36 -0
- data/lib/datadog/ci/contrib/cucumber/ext.rb +22 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +94 -0
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +28 -0
- data/lib/datadog/ci/contrib/cucumber/integration.rb +47 -0
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +27 -0
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +36 -0
- data/lib/datadog/ci/contrib/minitest/ext.rb +21 -0
- data/lib/datadog/ci/contrib/minitest/hooks.rb +66 -0
- data/lib/datadog/ci/contrib/minitest/integration.rb +46 -0
- data/lib/datadog/ci/contrib/minitest/patcher.rb +26 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +36 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +70 -0
- data/lib/datadog/ci/contrib/rspec/ext.rb +21 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +50 -0
- data/lib/datadog/ci/contrib/rspec/patcher.rb +27 -0
- data/lib/datadog/ci/ext/app_types.rb +11 -0
- data/lib/datadog/ci/ext/environment/extractor.rb +101 -0
- data/lib/datadog/ci/ext/environment/providers/appveyor.rb +98 -0
- data/lib/datadog/ci/ext/environment/providers/azure.rb +109 -0
- data/lib/datadog/ci/ext/environment/providers/base.rb +115 -0
- data/lib/datadog/ci/ext/environment/providers/bitbucket.rb +69 -0
- data/lib/datadog/ci/ext/environment/providers/bitrise.rb +77 -0
- data/lib/datadog/ci/ext/environment/providers/buddy.rb +69 -0
- data/lib/datadog/ci/ext/environment/providers/buildkite.rb +95 -0
- data/lib/datadog/ci/ext/environment/providers/circleci.rb +82 -0
- data/lib/datadog/ci/ext/environment/providers/codefresh.rb +49 -0
- data/lib/datadog/ci/ext/environment/providers/github_actions.rb +76 -0
- data/lib/datadog/ci/ext/environment/providers/gitlab.rb +119 -0
- data/lib/datadog/ci/ext/environment/providers/jenkins.rb +74 -0
- data/lib/datadog/ci/ext/environment/providers/local_git.rb +170 -0
- data/lib/datadog/ci/ext/environment/providers/teamcity.rb +29 -0
- data/lib/datadog/ci/ext/environment/providers/travis.rb +65 -0
- data/lib/datadog/ci/ext/environment/providers/user_defined_tags.rb +62 -0
- data/lib/datadog/ci/ext/environment/providers.rb +52 -0
- data/lib/datadog/ci/ext/environment.rb +82 -0
- data/lib/datadog/ci/ext/git.rb +37 -0
- data/lib/datadog/ci/ext/settings.rb +12 -0
- data/lib/datadog/ci/ext/test.rb +37 -0
- data/lib/datadog/ci/extensions.rb +19 -0
- data/lib/datadog/ci/flush.rb +38 -0
- data/lib/datadog/ci/test.rb +82 -0
- data/lib/datadog/ci/utils/git.rb +22 -0
- data/lib/datadog/ci/version.rb +28 -0
- data/lib/datadog/ci.rb +24 -0
- data/sig/datadog/ci/configuration/components.rbs +11 -0
- data/sig/datadog/ci/configuration/settings.rbs +14 -0
- data/sig/datadog/ci/contrib/cucumber/configuration/settings.rbs +12 -0
- data/sig/datadog/ci/contrib/cucumber/ext.rbs +25 -0
- data/sig/datadog/ci/contrib/cucumber/formatter.rbs +35 -0
- data/sig/datadog/ci/contrib/cucumber/instrumentation.rbs +16 -0
- data/sig/datadog/ci/contrib/cucumber/integration.rbs +25 -0
- data/sig/datadog/ci/contrib/cucumber/patcher.rbs +15 -0
- data/sig/datadog/ci/contrib/minitest/configuration/settings.rbs +12 -0
- data/sig/datadog/ci/contrib/minitest/ext.rbs +23 -0
- data/sig/datadog/ci/contrib/minitest/hooks.rbs +19 -0
- data/sig/datadog/ci/contrib/minitest/integration.rbs +25 -0
- data/sig/datadog/ci/contrib/minitest/patcher.rbs +15 -0
- data/sig/datadog/ci/contrib/rspec/configuration/settings.rbs +12 -0
- data/sig/datadog/ci/contrib/rspec/example.rbs +20 -0
- data/sig/datadog/ci/contrib/rspec/ext.rbs +23 -0
- data/sig/datadog/ci/contrib/rspec/integration.rbs +25 -0
- data/sig/datadog/ci/contrib/rspec/patcher.rbs +15 -0
- data/sig/datadog/ci/ext/app_types.rbs +9 -0
- data/sig/datadog/ci/ext/environment/extractor.rbs +27 -0
- data/sig/datadog/ci/ext/environment/providers/appveyor.rbs +48 -0
- data/sig/datadog/ci/ext/environment/providers/azure.rbs +56 -0
- data/sig/datadog/ci/ext/environment/providers/base.rbs +69 -0
- data/sig/datadog/ci/ext/environment/providers/bitbucket.rbs +37 -0
- data/sig/datadog/ci/ext/environment/providers/bitrise.rbs +41 -0
- data/sig/datadog/ci/ext/environment/providers/buddy.rbs +37 -0
- data/sig/datadog/ci/ext/environment/providers/buildkite.rbs +45 -0
- data/sig/datadog/ci/ext/environment/providers/circleci.rbs +41 -0
- data/sig/datadog/ci/ext/environment/providers/codefresh.rbs +25 -0
- data/sig/datadog/ci/ext/environment/providers/github_actions.rbs +37 -0
- data/sig/datadog/ci/ext/environment/providers/gitlab.rbs +57 -0
- data/sig/datadog/ci/ext/environment/providers/jenkins.rbs +35 -0
- data/sig/datadog/ci/ext/environment/providers/local_git.rbs +66 -0
- data/sig/datadog/ci/ext/environment/providers/teamcity.rbs +17 -0
- data/sig/datadog/ci/ext/environment/providers/travis.rbs +35 -0
- data/sig/datadog/ci/ext/environment/providers/user_defined_tags.rbs +33 -0
- data/sig/datadog/ci/ext/environment/providers.rbs +13 -0
- data/sig/datadog/ci/ext/environment.rbs +44 -0
- data/sig/datadog/ci/ext/git.rbs +53 -0
- data/sig/datadog/ci/ext/settings.rbs +9 -0
- data/sig/datadog/ci/ext/test.rbs +43 -0
- data/sig/datadog/ci/extensions.rbs +7 -0
- data/sig/datadog/ci/flush.rbs +15 -0
- data/sig/datadog/ci/test.rbs +18 -0
- data/sig/datadog/ci/utils/git.rbs +11 -0
- data/sig/datadog/ci/version.rbs +16 -0
- data/sig/datadog/ci.rbs +7 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d6c84919f89f5feeee275c0050dfabed4507d04a381d18be6e3a605a0cf7b0f
|
4
|
+
data.tar.gz: eb37898c092f0af0667e35611d26a62c66a531d6917e8f484e94e8a318f1ddd1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4ab2aa07b7a1cbb1ffeb4838c72a7783bde0a853f9f831eedeb2ca303fa788ad2dfb0ce2889b12f939d0d393635871e3c3e8951affd2f114785df43b61ccb871
|
7
|
+
data.tar.gz: b347696c14d21e8536a052647fcf8810c5ddcb3dc3173141468faf38653e6eaa29a05cd0fbadde52ea6679c11f9883e08c4655e352071a6920aeac3b10cc4265
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## 0.1.0 - 2023-09-12
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
* Add cucumber 8.0.0 support ([#7][])
|
8
|
+
* Docs: contribution documentation ([#14][], [#28][])
|
9
|
+
* Dev process: issue templates ([#20][])
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
* Validate customer-supplied git tags ([#15][])
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
* Fix Datadog::CI::Environment to support the new CI specs ([#11][])
|
18
|
+
|
19
|
+
### Removed
|
20
|
+
|
21
|
+
* Ruby versions < 2.7 no longer supported ([#8][])
|
22
|
+
|
23
|
+
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v0.1.0...main
|
24
|
+
[#7]: https://github.com/DataDog/datadog-ci-rb/issues/7
|
25
|
+
[#8]: https://github.com/DataDog/datadog-ci-rb/issues/8
|
26
|
+
[#11]: https://github.com/DataDog/datadog-ci-rb/issues/11
|
27
|
+
[#14]: https://github.com/DataDog/datadog-ci-rb/issues/14
|
28
|
+
[#15]: https://github.com/DataDog/datadog-ci-rb/issues/15
|
29
|
+
[#20]: https://github.com/DataDog/datadog-ci-rb/issues/20
|
30
|
+
[#28]: https://github.com/DataDog/datadog-ci-rb/issues/28
|
data/LICENSE
ADDED
data/LICENSE.Apache
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2016 Datadog, Inc.
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
191
|
+
you may not use this file except in compliance with the License.
|
192
|
+
You may obtain a copy of the License at
|
193
|
+
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
195
|
+
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
199
|
+
See the License for the specific language governing permissions and
|
200
|
+
limitations under the License.
|
data/LICENSE.BSD3
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2016, Datadog <info@datadoghq.com>
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of Datadog nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/NOTICE
ADDED
data/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Datadog CI Visibility for Ruby
|
2
|
+
|
3
|
+
[![codecov](https://codecov.io/gh/DataDog/datadog-ci-rb/branch/main/graph/badge.svg)](https://app.codecov.io/gh/DataDog/datadog-ci-rb/branch/main)
|
4
|
+
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/DataDog/datadog-ci-rb/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/DataDog/datadog-ci-rb/tree/main)
|
5
|
+
|
6
|
+
Datadog's Ruby Library for instrumenting your test and continuous integration pipeline.
|
7
|
+
Learn more on our [official website](https://docs.datadoghq.com/continuous_integration/tests/ruby/).
|
8
|
+
|
9
|
+
> [!IMPORTANT]
|
10
|
+
> The `datadog-ci` gem is currently a component of [`ddtrace`](https://github.com/datadog/dd-trace-rb) and should not be used without it.
|
11
|
+
>
|
12
|
+
> We expect this to change in the future.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add to your Gemfile.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem "ddtrace"
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### RSpec
|
25
|
+
|
26
|
+
To activate `RSpec` integration, add this to the `spec_helper.rb` file:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'rspec'
|
30
|
+
require 'datadog/ci'
|
31
|
+
|
32
|
+
Datadog.configure do |c|
|
33
|
+
# Only activates test instrumentation on CI
|
34
|
+
c.tracing.enabled = (ENV["DD_ENV"] == "ci")
|
35
|
+
|
36
|
+
# Configures the tracer to ensure results delivery
|
37
|
+
c.ci.enabled = true
|
38
|
+
|
39
|
+
# The name of the service or library under test
|
40
|
+
c.service = 'my-ruby-app'
|
41
|
+
|
42
|
+
# Enables the RSpec instrumentation
|
43
|
+
c.ci.instrument :rspec, **options
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
`options` are the following keyword arguments:
|
48
|
+
|
49
|
+
| Key | Description | Default |
|
50
|
+
| --- | ----------- | ------- |
|
51
|
+
| `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
52
|
+
| `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
|
53
|
+
| `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
|
54
|
+
|
55
|
+
### Minitest
|
56
|
+
|
57
|
+
The Minitest integration will trace all executions of tests when using `minitest` test framework.
|
58
|
+
|
59
|
+
To activate your integration, use the `Datadog.configure` method:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
require 'minitest'
|
63
|
+
require 'datadog/ci'
|
64
|
+
|
65
|
+
# Configure default Minitest integration
|
66
|
+
Datadog.configure do |c|
|
67
|
+
# Only activates test instrumentation on CI
|
68
|
+
c.tracing.enabled = (ENV["DD_ENV"] == "ci")
|
69
|
+
|
70
|
+
# Configures the tracer to ensure results delivery
|
71
|
+
c.ci.enabled = true
|
72
|
+
|
73
|
+
# The name of the service or library under test
|
74
|
+
c.service = 'my-ruby-app'
|
75
|
+
|
76
|
+
c.ci.instrument :minitest, **options
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
`options` are the following keyword arguments:
|
81
|
+
|
82
|
+
| Key | Description | Default |
|
83
|
+
| --- | ----------- | ------- |
|
84
|
+
| `enabled` | Defines whether Minitest tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
85
|
+
| `service_name` | Service name used for `minitest` instrumentation. | `'minitest'` |
|
86
|
+
| `operation_name` | Operation name used for `minitest` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'minitest.test'` |
|
87
|
+
|
88
|
+
### Cucumber
|
89
|
+
|
90
|
+
Activate `Cucumber` integration with configuration
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
require 'cucumber'
|
94
|
+
require 'datadog/ci'
|
95
|
+
|
96
|
+
Datadog.configure do |c|
|
97
|
+
# Only activates test instrumentation on CI
|
98
|
+
c.tracing.enabled = (ENV["DD_ENV"] == "ci")
|
99
|
+
|
100
|
+
# Configures the tracer to ensure results delivery
|
101
|
+
c.ci.enabled = true
|
102
|
+
|
103
|
+
# The name of the service or library under test
|
104
|
+
c.service = 'my-ruby-app'
|
105
|
+
|
106
|
+
# Enables the Cucumber instrumentation
|
107
|
+
c.ci.instrument :cucumber, **options
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
`options` are the following keyword arguments:
|
112
|
+
|
113
|
+
| Key | Description | Default |
|
114
|
+
| --- | ----------- | ------- |
|
115
|
+
| `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
116
|
+
| `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
|
117
|
+
| `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
|
118
|
+
|
119
|
+
## Contributing
|
120
|
+
|
121
|
+
See [development guide](/docs/DevelopmentGuide.md), [static typing guide](docs/StaticTypingGuide.md) and [contributing guidelines](/CONTRIBUTING.md).
|
122
|
+
|
123
|
+
## Code of Conduct
|
124
|
+
|
125
|
+
Everyone interacting in the `Datadog::CI` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../flush"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
module Configuration
|
8
|
+
# Adds CI behavior to Datadog trace components
|
9
|
+
module Components
|
10
|
+
def initialize(settings)
|
11
|
+
# Activate CI mode if enabled
|
12
|
+
activate_ci!(settings) if settings.ci.enabled
|
13
|
+
|
14
|
+
# Initialize normally
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def activate_ci!(settings)
|
19
|
+
# Activate underlying tracing test mode
|
20
|
+
settings.tracing.test_mode.enabled = true
|
21
|
+
|
22
|
+
# Choose user defined TraceFlush or default to CI TraceFlush
|
23
|
+
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush \
|
24
|
+
|| CI::Flush::Finished.new
|
25
|
+
|
26
|
+
# Pass through any other options
|
27
|
+
settings.tracing.test_mode.writer_options = settings.ci.writer_options
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../ext/settings"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
module Configuration
|
8
|
+
# Adds CI behavior to Datadog trace settings
|
9
|
+
module Settings
|
10
|
+
def self.extended(base)
|
11
|
+
base = base.singleton_class unless base.is_a?(Class)
|
12
|
+
add_settings!(base)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.add_settings!(base)
|
16
|
+
base.class_eval do
|
17
|
+
settings :ci do
|
18
|
+
option :enabled do |o|
|
19
|
+
o.type :bool
|
20
|
+
o.env CI::Ext::Settings::ENV_MODE_ENABLED
|
21
|
+
o.default false
|
22
|
+
end
|
23
|
+
|
24
|
+
# DEV: Alias to Datadog::Tracing::Contrib::Extensions::Configuration::Settings#instrument.
|
25
|
+
# DEV: Should be removed when CI implement its own `c.ci.instrument`.
|
26
|
+
define_method(:instrument) do |integration_name, options = {}, &block|
|
27
|
+
Datadog.configuration.tracing.instrument(integration_name, options, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
# DEV: Alias to Datadog::Tracing::Contrib::Extensions::Configuration::Settings#instrument.
|
31
|
+
# DEV: Should be removed when CI implement its own `c.ci[]`.
|
32
|
+
define_method(:[]) do |integration_name, key = :default|
|
33
|
+
Datadog.configuration.tracing[integration_name, key]
|
34
|
+
end
|
35
|
+
|
36
|
+
# TODO: Deprecate in the next major version, as `instrument` better describes this method's purpose
|
37
|
+
alias_method :use, :instrument
|
38
|
+
|
39
|
+
option :trace_flush
|
40
|
+
|
41
|
+
option :writer_options do |o|
|
42
|
+
o.type :hash
|
43
|
+
o.default({})
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../ext"
|
4
|
+
|
5
|
+
require "datadog/tracing/contrib/configuration/settings"
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
module CI
|
9
|
+
module Contrib
|
10
|
+
module Cucumber
|
11
|
+
module Configuration
|
12
|
+
# Custom settings for the Cucumber integration
|
13
|
+
# TODO: mark as `@public_api` when GA
|
14
|
+
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
|
15
|
+
option :enabled do |o|
|
16
|
+
o.type :bool
|
17
|
+
o.env Ext::ENV_ENABLED
|
18
|
+
o.default true
|
19
|
+
end
|
20
|
+
|
21
|
+
option :service_name do |o|
|
22
|
+
o.type :string
|
23
|
+
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
|
24
|
+
end
|
25
|
+
|
26
|
+
option :operation_name do |o|
|
27
|
+
o.type :string
|
28
|
+
o.env Ext::ENV_OPERATION_NAME
|
29
|
+
o.default Ext::OPERATION_NAME
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module CI
|
5
|
+
module Contrib
|
6
|
+
module Cucumber
|
7
|
+
# Cucumber integration constants
|
8
|
+
# TODO: mark as `@public_api` when GA, to protect from resource and tag name changes.
|
9
|
+
module Ext
|
10
|
+
APP = "cucumber"
|
11
|
+
ENV_ENABLED = "DD_TRACE_CUCUMBER_ENABLED"
|
12
|
+
ENV_OPERATION_NAME = "DD_TRACE_CUCUMBER_OPERATION_NAME"
|
13
|
+
FRAMEWORK = "cucumber"
|
14
|
+
OPERATION_NAME = "cucumber.test"
|
15
|
+
SERVICE_NAME = "cucumber"
|
16
|
+
STEP_SPAN_TYPE = "step"
|
17
|
+
TEST_TYPE = "test"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../test"
|
4
|
+
require_relative "../../ext/app_types"
|
5
|
+
require_relative "../../ext/environment"
|
6
|
+
require_relative "../../ext/test"
|
7
|
+
require_relative "ext"
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module CI
|
11
|
+
module Contrib
|
12
|
+
module Cucumber
|
13
|
+
# Defines collection of instrumented Cucumber events
|
14
|
+
class Formatter
|
15
|
+
attr_reader :config, :current_feature_span, :current_step_span
|
16
|
+
private :config
|
17
|
+
private :current_feature_span, :current_step_span
|
18
|
+
|
19
|
+
def initialize(config)
|
20
|
+
@config = config
|
21
|
+
|
22
|
+
bind_events(config)
|
23
|
+
end
|
24
|
+
|
25
|
+
def bind_events(config)
|
26
|
+
config.on_event :test_case_started, &method(:on_test_case_started)
|
27
|
+
config.on_event :test_case_finished, &method(:on_test_case_finished)
|
28
|
+
config.on_event :test_step_started, &method(:on_test_step_started)
|
29
|
+
config.on_event :test_step_finished, &method(:on_test_step_finished)
|
30
|
+
end
|
31
|
+
|
32
|
+
def on_test_case_started(event)
|
33
|
+
@current_feature_span = CI::Test.trace(
|
34
|
+
configuration[:operation_name],
|
35
|
+
{
|
36
|
+
span_options: {
|
37
|
+
resource: event.test_case.name,
|
38
|
+
service: configuration[:service_name]
|
39
|
+
},
|
40
|
+
framework: Ext::FRAMEWORK,
|
41
|
+
framework_version: CI::Contrib::Cucumber::Integration.version.to_s,
|
42
|
+
test_name: event.test_case.name,
|
43
|
+
test_suite: event.test_case.location.file,
|
44
|
+
test_type: Ext::TEST_TYPE
|
45
|
+
}
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_test_case_finished(event)
|
50
|
+
return if @current_feature_span.nil?
|
51
|
+
|
52
|
+
if event.result.skipped?
|
53
|
+
CI::Test.skipped!(@current_feature_span)
|
54
|
+
elsif event.result.ok?
|
55
|
+
CI::Test.passed!(@current_feature_span)
|
56
|
+
elsif event.result.failed?
|
57
|
+
CI::Test.failed!(@current_feature_span)
|
58
|
+
end
|
59
|
+
|
60
|
+
@current_feature_span.finish
|
61
|
+
end
|
62
|
+
|
63
|
+
def on_test_step_started(event)
|
64
|
+
trace_options = {
|
65
|
+
resource: event.test_step.to_s,
|
66
|
+
span_type: Ext::STEP_SPAN_TYPE
|
67
|
+
}
|
68
|
+
@current_step_span = Tracing.trace(Ext::STEP_SPAN_TYPE, **trace_options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def on_test_step_finished(event)
|
72
|
+
return if @current_step_span.nil?
|
73
|
+
|
74
|
+
if event.result.skipped?
|
75
|
+
CI::Test.skipped!(@current_step_span, event.result.exception)
|
76
|
+
elsif event.result.ok?
|
77
|
+
CI::Test.passed!(@current_step_span)
|
78
|
+
elsif event.result.failed?
|
79
|
+
CI::Test.failed!(@current_step_span, event.result.exception)
|
80
|
+
end
|
81
|
+
|
82
|
+
@current_step_span.finish
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def configuration
|
88
|
+
Datadog.configuration.ci[:cucumber]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "formatter"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
module Contrib
|
8
|
+
module Cucumber
|
9
|
+
# Instrumentation for Cucumber
|
10
|
+
module Instrumentation
|
11
|
+
def self.included(base)
|
12
|
+
base.prepend(InstanceMethods)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Instance methods for configuration
|
16
|
+
module InstanceMethods
|
17
|
+
attr_reader :datadog_formatter
|
18
|
+
|
19
|
+
def formatters
|
20
|
+
@datadog_formatter ||= CI::Contrib::Cucumber::Formatter.new(@configuration)
|
21
|
+
[@datadog_formatter] + super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|