@datadog/datadog-ci 2.40.1 → 2.40.3

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.
Files changed (255) hide show
  1. package/dist/__tests__/cli.test.d.ts +1 -0
  2. package/dist/__tests__/cli.test.js +41 -0
  3. package/dist/__tests__/cli.test.js.map +1 -0
  4. package/dist/commands/cloud-run/__tests__/fixtures.d.ts +2 -0
  5. package/dist/commands/cloud-run/__tests__/fixtures.js +12 -0
  6. package/dist/commands/cloud-run/__tests__/fixtures.js.map +1 -0
  7. package/dist/commands/cloud-run/__tests__/flare.test.d.ts +1 -0
  8. package/dist/commands/cloud-run/__tests__/flare.test.js +557 -0
  9. package/dist/commands/cloud-run/__tests__/flare.test.js.map +1 -0
  10. package/dist/commands/deployment/__tests__/mark.test.d.ts +1 -0
  11. package/dist/commands/deployment/__tests__/mark.test.js +47 -0
  12. package/dist/commands/deployment/__tests__/mark.test.js.map +1 -0
  13. package/dist/commands/dora/__tests__/deployment.test.d.ts +1 -0
  14. package/dist/commands/dora/__tests__/deployment.test.js +201 -0
  15. package/dist/commands/dora/__tests__/deployment.test.js.map +1 -0
  16. package/dist/commands/dsyms/__tests__/upload.test.d.ts +1 -0
  17. package/dist/commands/dsyms/__tests__/upload.test.js +346 -0
  18. package/dist/commands/dsyms/__tests__/upload.test.js.map +1 -0
  19. package/dist/commands/dsyms/__tests__/utils.test.d.ts +1 -0
  20. package/dist/commands/dsyms/__tests__/utils.test.js +103 -0
  21. package/dist/commands/dsyms/__tests__/utils.test.js.map +1 -0
  22. package/dist/commands/dsyms/utils.js +4 -2
  23. package/dist/commands/dsyms/utils.js.map +1 -1
  24. package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +1 -0
  25. package/dist/commands/elf-symbols/__tests__/elf.test.js +813 -0
  26. package/dist/commands/elf-symbols/__tests__/elf.test.js.map +1 -0
  27. package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +1 -0
  28. package/dist/commands/elf-symbols/__tests__/upload.test.js +249 -0
  29. package/dist/commands/elf-symbols/__tests__/upload.test.js.map +1 -0
  30. package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +1 -0
  31. package/dist/commands/flutter-symbols/__tests__/upload.test.js +617 -0
  32. package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +1 -0
  33. package/dist/commands/gate/__tests__/evaluate.test.d.ts +1 -0
  34. package/dist/commands/gate/__tests__/evaluate.test.js +398 -0
  35. package/dist/commands/gate/__tests__/evaluate.test.js.map +1 -0
  36. package/dist/commands/gate/__tests__/scope.test.d.ts +1 -0
  37. package/dist/commands/gate/__tests__/scope.test.js +29 -0
  38. package/dist/commands/gate/__tests__/scope.test.js.map +1 -0
  39. package/dist/commands/git-metadata/__tests__/git.test.d.ts +1 -0
  40. package/dist/commands/git-metadata/__tests__/git.test.js +132 -0
  41. package/dist/commands/git-metadata/__tests__/git.test.js.map +1 -0
  42. package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +1 -0
  43. package/dist/commands/git-metadata/__tests__/gitdb.test.js +1386 -0
  44. package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +1 -0
  45. package/dist/commands/git-metadata/__tests__/library.test.d.ts +1 -0
  46. package/dist/commands/git-metadata/__tests__/library.test.js +118 -0
  47. package/dist/commands/git-metadata/__tests__/library.test.js.map +1 -0
  48. package/dist/commands/git-metadata/__tests__/upload.test.d.ts +1 -0
  49. package/dist/commands/git-metadata/__tests__/upload.test.js +52 -0
  50. package/dist/commands/git-metadata/__tests__/upload.test.js.map +1 -0
  51. package/dist/commands/junit/__tests__/id.test.d.ts +1 -0
  52. package/dist/commands/junit/__tests__/id.test.js +24 -0
  53. package/dist/commands/junit/__tests__/id.test.js.map +1 -0
  54. package/dist/commands/junit/__tests__/upload.test.d.ts +1 -0
  55. package/dist/commands/junit/__tests__/upload.test.js +495 -0
  56. package/dist/commands/junit/__tests__/upload.test.js.map +1 -0
  57. package/dist/commands/lambda/__tests__/fixtures.d.ts +51 -0
  58. package/dist/commands/lambda/__tests__/fixtures.js +146 -0
  59. package/dist/commands/lambda/__tests__/fixtures.js.map +1 -0
  60. package/dist/commands/lambda/__tests__/flare.test.d.ts +1 -0
  61. package/dist/commands/lambda/__tests__/flare.test.js +730 -0
  62. package/dist/commands/lambda/__tests__/flare.test.js.map +1 -0
  63. package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +1 -0
  64. package/dist/commands/lambda/__tests__/functions/commons.test.js +791 -0
  65. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +1 -0
  66. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +1 -0
  67. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +386 -0
  68. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +1 -0
  69. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +1 -0
  70. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +721 -0
  71. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +1 -0
  72. package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +1 -0
  73. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +513 -0
  74. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +1 -0
  75. package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +1 -0
  76. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +33 -0
  77. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +1 -0
  78. package/dist/commands/lambda/__tests__/instrument.test.d.ts +1 -0
  79. package/dist/commands/lambda/__tests__/instrument.test.js +1511 -0
  80. package/dist/commands/lambda/__tests__/instrument.test.js.map +1 -0
  81. package/dist/commands/lambda/__tests__/loggroup.test.d.ts +1 -0
  82. package/dist/commands/lambda/__tests__/loggroup.test.js +340 -0
  83. package/dist/commands/lambda/__tests__/loggroup.test.js.map +1 -0
  84. package/dist/commands/lambda/__tests__/prompt.test.d.ts +1 -0
  85. package/dist/commands/lambda/__tests__/prompt.test.js +206 -0
  86. package/dist/commands/lambda/__tests__/prompt.test.js.map +1 -0
  87. package/dist/commands/lambda/__tests__/tags.test.d.ts +1 -0
  88. package/dist/commands/lambda/__tests__/tags.test.js +305 -0
  89. package/dist/commands/lambda/__tests__/tags.test.js.map +1 -0
  90. package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +1 -0
  91. package/dist/commands/lambda/__tests__/uninstrument.test.js +722 -0
  92. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +1 -0
  93. package/dist/commands/measure/__tests__/measure.test.d.ts +1 -0
  94. package/dist/commands/measure/__tests__/measure.test.js +110 -0
  95. package/dist/commands/measure/__tests__/measure.test.js.map +1 -0
  96. package/dist/commands/react-native/__tests__/codepush.test.d.ts +1 -0
  97. package/dist/commands/react-native/__tests__/codepush.test.js +161 -0
  98. package/dist/commands/react-native/__tests__/codepush.test.js.map +1 -0
  99. package/dist/commands/react-native/__tests__/interfaces.test.d.ts +1 -0
  100. package/dist/commands/react-native/__tests__/interfaces.test.js +33 -0
  101. package/dist/commands/react-native/__tests__/interfaces.test.js.map +1 -0
  102. package/dist/commands/react-native/__tests__/upload.test.d.ts +1 -0
  103. package/dist/commands/react-native/__tests__/upload.test.js +238 -0
  104. package/dist/commands/react-native/__tests__/upload.test.js.map +1 -0
  105. package/dist/commands/react-native/__tests__/utils.test.d.ts +1 -0
  106. package/dist/commands/react-native/__tests__/utils.test.js +27 -0
  107. package/dist/commands/react-native/__tests__/utils.test.js.map +1 -0
  108. package/dist/commands/react-native/__tests__/xcode.test.d.ts +1 -0
  109. package/dist/commands/react-native/__tests__/xcode.test.js +465 -0
  110. package/dist/commands/react-native/__tests__/xcode.test.js.map +1 -0
  111. package/dist/commands/sarif/__tests__/upload.test.d.ts +1 -0
  112. package/dist/commands/sarif/__tests__/upload.test.js +228 -0
  113. package/dist/commands/sarif/__tests__/upload.test.js.map +1 -0
  114. package/dist/commands/sbom/__tests__/payload.test.d.ts +1 -0
  115. package/dist/commands/sbom/__tests__/payload.test.js +262 -0
  116. package/dist/commands/sbom/__tests__/payload.test.js.map +1 -0
  117. package/dist/commands/sbom/__tests__/validation.test.d.ts +1 -0
  118. package/dist/commands/sbom/__tests__/validation.test.js +41 -0
  119. package/dist/commands/sbom/__tests__/validation.test.js.map +1 -0
  120. package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +1 -0
  121. package/dist/commands/sourcemaps/__tests__/upload.test.js +270 -0
  122. package/dist/commands/sourcemaps/__tests__/upload.test.js.map +1 -0
  123. package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +1 -0
  124. package/dist/commands/sourcemaps/__tests__/utils.test.js +31 -0
  125. package/dist/commands/sourcemaps/__tests__/utils.test.js.map +1 -0
  126. package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +1 -0
  127. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +192 -0
  128. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +1 -0
  129. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +6 -0
  130. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +45 -0
  131. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +1 -0
  132. package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +5 -0
  133. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +19 -0
  134. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +1 -0
  135. package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +1 -0
  136. package/dist/commands/stepfunctions/__tests__/helpers.test.js +205 -0
  137. package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +1 -0
  138. package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +1 -0
  139. package/dist/commands/stepfunctions/__tests__/instrument.test.js +431 -0
  140. package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +1 -0
  141. package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +1 -0
  142. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +166 -0
  143. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +1 -0
  144. package/dist/commands/synthetics/__tests__/api.test.d.ts +1 -0
  145. package/dist/commands/synthetics/__tests__/api.test.js +422 -0
  146. package/dist/commands/synthetics/__tests__/api.test.js.map +1 -0
  147. package/dist/commands/synthetics/__tests__/cli.test.d.ts +1 -0
  148. package/dist/commands/synthetics/__tests__/cli.test.js +1325 -0
  149. package/dist/commands/synthetics/__tests__/cli.test.js.map +1 -0
  150. package/dist/commands/synthetics/__tests__/fixtures.d.ts +149 -0
  151. package/dist/commands/synthetics/__tests__/fixtures.js +507 -0
  152. package/dist/commands/synthetics/__tests__/fixtures.js.map +1 -0
  153. package/dist/commands/synthetics/__tests__/mobile.test.d.ts +1 -0
  154. package/dist/commands/synthetics/__tests__/mobile.test.js +376 -0
  155. package/dist/commands/synthetics/__tests__/mobile.test.js.map +1 -0
  156. package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +1 -0
  157. package/dist/commands/synthetics/__tests__/reporters/default.test.js +354 -0
  158. package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +1 -0
  159. package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +1 -0
  160. package/dist/commands/synthetics/__tests__/reporters/junit.test.js +353 -0
  161. package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +1 -0
  162. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +1 -0
  163. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +232 -0
  164. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +1 -0
  165. package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +1 -0
  166. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +735 -0
  167. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +1 -0
  168. package/dist/commands/synthetics/__tests__/test.test.d.ts +1 -0
  169. package/dist/commands/synthetics/__tests__/test.test.js +33 -0
  170. package/dist/commands/synthetics/__tests__/test.test.js.map +1 -0
  171. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +1 -0
  172. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +21 -0
  173. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +1 -0
  174. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +1 -0
  175. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +80 -0
  176. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +1 -0
  177. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +1 -0
  178. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +109 -0
  179. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +1 -0
  180. package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +1 -0
  181. package/dist/commands/synthetics/__tests__/utils/internal.test.js +186 -0
  182. package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +1 -0
  183. package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +1 -0
  184. package/dist/commands/synthetics/__tests__/utils/public.test.js +1526 -0
  185. package/dist/commands/synthetics/__tests__/utils/public.test.js.map +1 -0
  186. package/dist/commands/synthetics/api.d.ts +1 -1
  187. package/dist/commands/synthetics/api.js +10 -5
  188. package/dist/commands/synthetics/api.js.map +1 -1
  189. package/dist/commands/synthetics/run-tests-command.d.ts +1 -0
  190. package/dist/commands/synthetics/run-tests-command.js +3 -2
  191. package/dist/commands/synthetics/run-tests-command.js.map +1 -1
  192. package/dist/commands/synthetics/run-tests-lib.js +0 -4
  193. package/dist/commands/synthetics/run-tests-lib.js.map +1 -1
  194. package/dist/commands/synthetics/test.js +9 -1
  195. package/dist/commands/synthetics/test.js.map +1 -1
  196. package/dist/commands/synthetics/utils/public.js +1 -1
  197. package/dist/commands/synthetics/utils/public.js.map +1 -1
  198. package/dist/commands/tag/__tests__/tag.test.d.ts +1 -0
  199. package/dist/commands/tag/__tests__/tag.test.js +75 -0
  200. package/dist/commands/tag/__tests__/tag.test.js.map +1 -0
  201. package/dist/commands/trace/__tests__/trace.test.d.ts +1 -0
  202. package/dist/commands/trace/__tests__/trace.test.js +145 -0
  203. package/dist/commands/trace/__tests__/trace.test.js.map +1 -0
  204. package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +1 -0
  205. package/dist/commands/unity-symbols/__tests__/upload.test.js +369 -0
  206. package/dist/commands/unity-symbols/__tests__/upload.test.js.map +1 -0
  207. package/dist/helpers/__tests__/app.test.d.ts +1 -0
  208. package/dist/helpers/__tests__/app.test.js +31 -0
  209. package/dist/helpers/__tests__/app.test.js.map +1 -0
  210. package/dist/helpers/__tests__/ci.test.d.ts +1 -0
  211. package/dist/helpers/__tests__/ci.test.js +252 -0
  212. package/dist/helpers/__tests__/ci.test.js.map +1 -0
  213. package/dist/helpers/__tests__/fixtures.d.ts +33 -0
  214. package/dist/helpers/__tests__/fixtures.js +71 -0
  215. package/dist/helpers/__tests__/fixtures.js.map +1 -0
  216. package/dist/helpers/__tests__/flare.test.d.ts +1 -0
  217. package/dist/helpers/__tests__/flare.test.js +226 -0
  218. package/dist/helpers/__tests__/flare.test.js.map +1 -0
  219. package/dist/helpers/__tests__/fs.test.d.ts +1 -0
  220. package/dist/helpers/__tests__/fs.test.js +189 -0
  221. package/dist/helpers/__tests__/fs.test.js.map +1 -0
  222. package/dist/helpers/__tests__/plist.test.d.ts +1 -0
  223. package/dist/helpers/__tests__/plist.test.js +43 -0
  224. package/dist/helpers/__tests__/plist.test.js.map +1 -0
  225. package/dist/helpers/__tests__/prompt.test.d.ts +1 -0
  226. package/dist/helpers/__tests__/prompt.test.js +71 -0
  227. package/dist/helpers/__tests__/prompt.test.js.map +1 -0
  228. package/dist/helpers/__tests__/retry.test.d.ts +1 -0
  229. package/dist/helpers/__tests__/retry.test.js +99 -0
  230. package/dist/helpers/__tests__/retry.test.js.map +1 -0
  231. package/dist/helpers/__tests__/tags.test.d.ts +1 -0
  232. package/dist/helpers/__tests__/tags.test.js +71 -0
  233. package/dist/helpers/__tests__/tags.test.js.map +1 -0
  234. package/dist/helpers/__tests__/upload.test.d.ts +1 -0
  235. package/dist/helpers/__tests__/upload.test.js +231 -0
  236. package/dist/helpers/__tests__/upload.test.js.map +1 -0
  237. package/dist/helpers/__tests__/user-provided-git.test.d.ts +1 -0
  238. package/dist/helpers/__tests__/user-provided-git.test.js +119 -0
  239. package/dist/helpers/__tests__/user-provided-git.test.js.map +1 -0
  240. package/dist/helpers/__tests__/utils.test.d.ts +1 -0
  241. package/dist/helpers/__tests__/utils.test.js +429 -0
  242. package/dist/helpers/__tests__/utils.test.js.map +1 -0
  243. package/dist/helpers/__tests__/validation.test.d.ts +1 -0
  244. package/dist/helpers/__tests__/validation.test.js +25 -0
  245. package/dist/helpers/__tests__/validation.test.js.map +1 -0
  246. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +1 -0
  247. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +103 -0
  248. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +1 -0
  249. package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +1 -0
  250. package/dist/helpers/git/__tests__/format-git-span-data.test.js +121 -0
  251. package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +1 -0
  252. package/dist/helpers/git/__tests__/get-git-data.test.d.ts +1 -0
  253. package/dist/helpers/git/__tests__/get-git-data.test.js +72 -0
  254. package/dist/helpers/git/__tests__/get-git-data.test.js.map +1 -0
  255. package/package.json +5 -7
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const simple_git_1 = __importDefault(require("simple-git"));
16
+ const tags_1 = require("../../tags");
17
+ const format_git_span_data_1 = require("../format-git-span-data");
18
+ jest.mock('simple-git');
19
+ describe('getGitMetadata', () => {
20
+ it('reads git metadata successfully', () => __awaiter(void 0, void 0, void 0, function* () {
21
+ ;
22
+ simple_git_1.default.mockImplementation(() => ({
23
+ branch: () => ({ current: 'main' }),
24
+ listRemote: (git) => __awaiter(void 0, void 0, void 0, function* () { return 'repository_url'; }),
25
+ revparse: () => 'commitSHA',
26
+ show: (input) => {
27
+ if (input[1] === '--format=%s') {
28
+ return 'commit message';
29
+ }
30
+ return 'authorName,authorEmail,authorDate,committerName,committerEmail,committerDate';
31
+ },
32
+ }));
33
+ const result = yield (0, format_git_span_data_1.getGitMetadata)();
34
+ expect(result).toEqual({
35
+ [tags_1.GIT_REPOSITORY_URL]: 'repository_url',
36
+ [tags_1.GIT_BRANCH]: 'main',
37
+ [tags_1.GIT_SHA]: 'commitSHA',
38
+ [tags_1.GIT_COMMIT_MESSAGE]: 'commit message',
39
+ [tags_1.GIT_COMMIT_COMMITTER_DATE]: 'committerDate',
40
+ [tags_1.GIT_COMMIT_COMMITTER_EMAIL]: 'committerEmail',
41
+ [tags_1.GIT_COMMIT_COMMITTER_NAME]: 'committerName',
42
+ [tags_1.GIT_COMMIT_AUTHOR_DATE]: 'authorDate',
43
+ [tags_1.GIT_COMMIT_AUTHOR_EMAIL]: 'authorEmail',
44
+ [tags_1.GIT_COMMIT_AUTHOR_NAME]: 'authorName',
45
+ });
46
+ }));
47
+ it('does not crash when git is not available', () => __awaiter(void 0, void 0, void 0, function* () {
48
+ ;
49
+ simple_git_1.default.mockImplementation(() => ({
50
+ branch: () => {
51
+ throw new Error();
52
+ },
53
+ listRemote: () => {
54
+ throw new Error();
55
+ },
56
+ revparse: () => {
57
+ throw new Error();
58
+ },
59
+ show: () => {
60
+ throw new Error();
61
+ },
62
+ }));
63
+ const result = yield (0, format_git_span_data_1.getGitMetadata)();
64
+ expect(result).toEqual({});
65
+ }));
66
+ it('scrubs credentials from https repository url', () => __awaiter(void 0, void 0, void 0, function* () {
67
+ ;
68
+ simple_git_1.default.mockImplementation(() => ({
69
+ branch: () => ({ current: 'main' }),
70
+ listRemote: (git) => __awaiter(void 0, void 0, void 0, function* () { return 'https://x-oauth-basic:ghp_safe_characters@github.com/datadog/safe-repository.git'; }),
71
+ revparse: () => 'commitSHA',
72
+ show: (input) => {
73
+ if (input[1] === '--format=%s') {
74
+ return 'commit message';
75
+ }
76
+ return 'authorName,authorEmail,authorDate,committerName,committerEmail,committerDate';
77
+ },
78
+ }));
79
+ const result = yield (0, format_git_span_data_1.getGitMetadata)();
80
+ expect(result).toEqual({
81
+ [tags_1.GIT_REPOSITORY_URL]: 'https://github.com/datadog/safe-repository.git',
82
+ [tags_1.GIT_BRANCH]: 'main',
83
+ [tags_1.GIT_SHA]: 'commitSHA',
84
+ [tags_1.GIT_COMMIT_MESSAGE]: 'commit message',
85
+ [tags_1.GIT_COMMIT_COMMITTER_DATE]: 'committerDate',
86
+ [tags_1.GIT_COMMIT_COMMITTER_EMAIL]: 'committerEmail',
87
+ [tags_1.GIT_COMMIT_COMMITTER_NAME]: 'committerName',
88
+ [tags_1.GIT_COMMIT_AUTHOR_DATE]: 'authorDate',
89
+ [tags_1.GIT_COMMIT_AUTHOR_EMAIL]: 'authorEmail',
90
+ [tags_1.GIT_COMMIT_AUTHOR_NAME]: 'authorName',
91
+ });
92
+ }));
93
+ it('scrubs credentials from ssh repository url', () => __awaiter(void 0, void 0, void 0, function* () {
94
+ ;
95
+ simple_git_1.default.mockImplementation(() => ({
96
+ branch: () => ({ current: 'main' }),
97
+ listRemote: (git) => __awaiter(void 0, void 0, void 0, function* () { return 'ssh://username@host.xz:port/path/to/repo.git/'; }),
98
+ revparse: () => 'commitSHA',
99
+ show: (input) => {
100
+ if (input[1] === '--format=%s') {
101
+ return 'commit message';
102
+ }
103
+ return 'authorName,authorEmail,authorDate,committerName,committerEmail,committerDate';
104
+ },
105
+ }));
106
+ const result = yield (0, format_git_span_data_1.getGitMetadata)();
107
+ expect(result).toEqual({
108
+ [tags_1.GIT_REPOSITORY_URL]: 'ssh://host.xz:port/path/to/repo.git/',
109
+ [tags_1.GIT_BRANCH]: 'main',
110
+ [tags_1.GIT_SHA]: 'commitSHA',
111
+ [tags_1.GIT_COMMIT_MESSAGE]: 'commit message',
112
+ [tags_1.GIT_COMMIT_COMMITTER_DATE]: 'committerDate',
113
+ [tags_1.GIT_COMMIT_COMMITTER_EMAIL]: 'committerEmail',
114
+ [tags_1.GIT_COMMIT_COMMITTER_NAME]: 'committerName',
115
+ [tags_1.GIT_COMMIT_AUTHOR_DATE]: 'authorDate',
116
+ [tags_1.GIT_COMMIT_AUTHOR_EMAIL]: 'authorEmail',
117
+ [tags_1.GIT_COMMIT_AUTHOR_NAME]: 'authorName',
118
+ });
119
+ }));
120
+ });
121
+ //# sourceMappingURL=format-git-span-data.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-git-span-data.test.js","sourceRoot":"","sources":["../../../../src/helpers/git/__tests__/format-git-span-data.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4DAAkC;AAElC,qCAWmB;AAEnB,kEAAsD;AAEtD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAEvB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAC/C,CAAC;QAAC,oBAAuB,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;YAClD,MA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-0,0 +1,72 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const get_git_data_1 = require("../get-git-data");
13
+ describe('git', () => {
14
+ describe('gitRemote', () => {
15
+ const createMockSimpleGit = (remotes, defaultOrigin) => ({
16
+ getRemotes: (arg) => remotes,
17
+ getConfig: (arg) => ({
18
+ // eslint-disable-next-line no-null/no-null
19
+ value: defaultOrigin !== null && defaultOrigin !== void 0 ? defaultOrigin : null,
20
+ }),
21
+ });
22
+ test('should choose the remote named origin if no default is specified', () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const mock = createMockSimpleGit([
24
+ { name: 'first', refs: { push: 'remote1' } },
25
+ { name: 'origin', refs: { push: 'remote2' } },
26
+ ], undefined);
27
+ const remote = yield (0, get_git_data_1.gitRemote)(mock);
28
+ expect(remote).toBe('remote2');
29
+ }));
30
+ test('should choose the remote named first if that is the default origin', () => __awaiter(void 0, void 0, void 0, function* () {
31
+ const mock = createMockSimpleGit([
32
+ { name: 'first', refs: { push: 'remote1' } },
33
+ { name: 'origin', refs: { push: 'remote2' } },
34
+ ], 'first');
35
+ const remote = yield (0, get_git_data_1.gitRemote)(mock);
36
+ expect(remote).toBe('remote1');
37
+ }));
38
+ test('should choose the first remote', () => __awaiter(void 0, void 0, void 0, function* () {
39
+ const mock = createMockSimpleGit([
40
+ { name: 'first', refs: { push: 'remote1' } },
41
+ { name: 'second', refs: { push: 'remote2' } },
42
+ ], undefined);
43
+ const remote = yield (0, get_git_data_1.gitRemote)(mock);
44
+ expect(remote).toBe('remote1');
45
+ }));
46
+ });
47
+ describe('stripCredentials: git protocol', () => {
48
+ test('should return the same value', () => {
49
+ const input = 'git@github.com:user/project.git';
50
+ expect((0, get_git_data_1.stripCredentials)(input)).toBe(input);
51
+ });
52
+ });
53
+ describe('stripCredentials: nothing to remove', () => {
54
+ test('should return the same value', () => {
55
+ const input = 'https://gitlab.com/user/project.git';
56
+ expect((0, get_git_data_1.stripCredentials)(input)).toBe(input);
57
+ });
58
+ });
59
+ describe('stripCredentials: user:pwd', () => {
60
+ test('should return without credentials', () => {
61
+ const input = 'https://token:[MASKED]@gitlab.com/user/project.git';
62
+ expect((0, get_git_data_1.stripCredentials)(input)).toBe('https://gitlab.com/user/project.git');
63
+ });
64
+ });
65
+ describe('stripCredentials: token', () => {
66
+ test('should return without credentials', () => {
67
+ const input = 'https://token@gitlab.com/user/project.git';
68
+ expect((0, get_git_data_1.stripCredentials)(input)).toBe('https://gitlab.com/user/project.git');
69
+ });
70
+ });
71
+ });
72
+ //# sourceMappingURL=get-git-data.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-git-data.test.js","sourceRoot":"","sources":["../../../../src/helpers/git/__tests__/get-git-data.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kDAA2D;AAE3D,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACnB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,MAAM,mBAAmB,GAAG,CAAC,OAAc,EAAE,aAAiC,EAAE,EAAE,CAAC,CAAC;YAClF,UAAU,EAAE,CAAC,GAAY,EAAE,EAAE,CAAC,OAAO;YACrC,SAAS,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC;gBAC3B,2CAA2C;gBAC3C,KAAK,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,IAAI;aAC7B,CAAC;SACH,CAAC,CAAA;QAEF,IA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C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/datadog-ci",
3
- "version": "2.40.1",
3
+ "version": "2.40.3",
4
4
  "description": "Run datadog actions from the CI.",
5
5
  "repository": "https://github.com/DataDog/datadog-ci",
6
6
  "license": "Apache-2.0",
@@ -26,7 +26,6 @@
26
26
  "@types/retry": "0.12.0",
27
27
  "aws-sdk-client-mock": "2.1.1",
28
28
  "aws-sdk-client-mock-jest": "2.1.1",
29
- "fast-xml-parser@npm:4.2.4": "4.2.5",
30
29
  "ini": "1.3.7",
31
30
  "kind-of@^6.0.0": "6.0.3"
32
31
  },
@@ -87,18 +86,18 @@
87
86
  "datadog-metrics": "0.9.3",
88
87
  "deep-extend": "0.6.0",
89
88
  "deep-object-diff": "^1.1.9",
90
- "fast-xml-parser": "^4.2.5",
89
+ "fast-xml-parser": "^4.4.1",
91
90
  "form-data": "4.0.0",
92
91
  "fuzzy": "^0.1.3",
93
- "glob": "7.1.4",
94
- "google-auth-library": "^8.9.0",
92
+ "glob": "^7.1.4",
93
+ "google-auth-library": "^9.12.0",
95
94
  "inquirer": "^8.2.5",
96
95
  "inquirer-checkbox-plus-prompt": "^1.4.2",
97
96
  "js-yaml": "3.13.1",
98
97
  "jszip": "^3.10.1",
99
98
  "ora": "5.4.1",
100
99
  "proxy-agent": "^6.4.0",
101
- "rimraf": "^3.0.2",
100
+ "rimraf": "^6.0.1",
102
101
  "semver": "^7.5.3",
103
102
  "simple-git": "3.16.0",
104
103
  "ssh2": "^1.15.0",
@@ -125,7 +124,6 @@
125
124
  "@types/jest": "29.5.3",
126
125
  "@types/js-yaml": "^4.0.5",
127
126
  "@types/node": "14.18.34",
128
- "@types/rimraf": "^3.0.2",
129
127
  "@types/semver": "^7.3.12",
130
128
  "@types/ssh2": "1.11.6",
131
129
  "@types/ssh2-streams": "0.1.9",