@datadog/datadog-ci 2.17.2 → 2.18.1

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 (100) hide show
  1. package/dist/commands/cloud-run/cli.d.ts +1 -0
  2. package/dist/commands/cloud-run/cli.js +5 -0
  3. package/dist/commands/cloud-run/cli.js.map +1 -0
  4. package/dist/commands/cloud-run/constants.d.ts +1 -0
  5. package/dist/commands/cloud-run/constants.js +22 -0
  6. package/dist/commands/cloud-run/constants.js.map +1 -0
  7. package/dist/commands/cloud-run/flare.d.ts +60 -0
  8. package/dist/commands/cloud-run/flare.js +369 -0
  9. package/dist/commands/cloud-run/flare.js.map +1 -0
  10. package/dist/commands/cloud-run/interfaces.d.ts +27 -0
  11. package/dist/commands/cloud-run/interfaces.js +3 -0
  12. package/dist/commands/cloud-run/interfaces.js.map +1 -0
  13. package/dist/commands/cloud-run/renderer.d.ts +4 -0
  14. package/dist/commands/cloud-run/renderer.js +38 -0
  15. package/dist/commands/cloud-run/renderer.js.map +1 -0
  16. package/dist/commands/flutter-symbols/renderer.js +2 -0
  17. package/dist/commands/flutter-symbols/renderer.js.map +1 -1
  18. package/dist/commands/gate/api.js +4 -0
  19. package/dist/commands/gate/api.js.map +1 -1
  20. package/dist/commands/gate/evaluate.js +5 -4
  21. package/dist/commands/gate/evaluate.js.map +1 -1
  22. package/dist/commands/gate/interfaces.d.ts +5 -0
  23. package/dist/commands/gate/renderer.d.ts +1 -1
  24. package/dist/commands/gate/renderer.js +16 -2
  25. package/dist/commands/gate/renderer.js.map +1 -1
  26. package/dist/commands/junit/utils.js +6 -13
  27. package/dist/commands/junit/utils.js.map +1 -1
  28. package/dist/commands/lambda/constants.d.ts +11 -8
  29. package/dist/commands/lambda/constants.js +85 -15
  30. package/dist/commands/lambda/constants.js.map +1 -1
  31. package/dist/commands/lambda/flare.d.ts +26 -40
  32. package/dist/commands/lambda/flare.js +275 -202
  33. package/dist/commands/lambda/flare.js.map +1 -1
  34. package/dist/commands/lambda/functions/commons.d.ts +7 -13
  35. package/dist/commands/lambda/functions/commons.js +39 -56
  36. package/dist/commands/lambda/functions/commons.js.map +1 -1
  37. package/dist/commands/lambda/functions/instrument.js +46 -45
  38. package/dist/commands/lambda/functions/instrument.js.map +1 -1
  39. package/dist/commands/lambda/functions/uninstrument.js +29 -28
  40. package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
  41. package/dist/commands/lambda/instrument.js +20 -17
  42. package/dist/commands/lambda/instrument.js.map +1 -1
  43. package/dist/commands/lambda/prompt.d.ts +1 -2
  44. package/dist/commands/lambda/prompt.js +32 -32
  45. package/dist/commands/lambda/prompt.js.map +1 -1
  46. package/dist/commands/lambda/renderers/common-renderer.d.ts +0 -26
  47. package/dist/commands/lambda/renderers/common-renderer.js +4 -32
  48. package/dist/commands/lambda/renderers/common-renderer.js.map +1 -1
  49. package/dist/commands/lambda/renderers/instrument-uninstrument-renderer.js +27 -27
  50. package/dist/commands/lambda/renderers/instrument-uninstrument-renderer.js.map +1 -1
  51. package/dist/commands/lambda/uninstrument.js +10 -8
  52. package/dist/commands/lambda/uninstrument.js.map +1 -1
  53. package/dist/commands/sarif/api.js +2 -18
  54. package/dist/commands/sarif/api.js.map +1 -1
  55. package/dist/commands/stepfunctions/awsCommands.d.ts +2 -0
  56. package/dist/commands/stepfunctions/awsCommands.js +26 -2
  57. package/dist/commands/stepfunctions/awsCommands.js.map +1 -1
  58. package/dist/commands/stepfunctions/constants.d.ts +1 -0
  59. package/dist/commands/stepfunctions/constants.js +2 -1
  60. package/dist/commands/stepfunctions/constants.js.map +1 -1
  61. package/dist/commands/stepfunctions/helpers.d.ts +22 -0
  62. package/dist/commands/stepfunctions/helpers.js +62 -4
  63. package/dist/commands/stepfunctions/helpers.js.map +1 -1
  64. package/dist/commands/stepfunctions/instrument.d.ts +1 -0
  65. package/dist/commands/stepfunctions/instrument.js +15 -4
  66. package/dist/commands/stepfunctions/instrument.js.map +1 -1
  67. package/dist/commands/synthetics/interfaces.d.ts +2 -1
  68. package/dist/commands/synthetics/interfaces.js.map +1 -1
  69. package/dist/commands/synthetics/reporters/default.js +3 -5
  70. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  71. package/dist/commands/synthetics/utils.js +3 -9
  72. package/dist/commands/synthetics/utils.js.map +1 -1
  73. package/dist/constants.d.ts +10 -0
  74. package/dist/constants.js +14 -1
  75. package/dist/constants.js.map +1 -1
  76. package/dist/helpers/app.d.ts +2 -0
  77. package/dist/helpers/app.js +17 -0
  78. package/dist/helpers/app.js.map +1 -0
  79. package/dist/helpers/flare.d.ts +19 -0
  80. package/dist/helpers/flare.js +81 -0
  81. package/dist/helpers/flare.js.map +1 -0
  82. package/dist/helpers/fs.d.ts +31 -0
  83. package/dist/helpers/fs.js +117 -0
  84. package/dist/helpers/fs.js.map +1 -0
  85. package/dist/helpers/prompt.d.ts +6 -0
  86. package/dist/helpers/prompt.js +39 -0
  87. package/dist/helpers/prompt.js.map +1 -0
  88. package/dist/helpers/renderer.d.ts +36 -0
  89. package/dist/helpers/renderer.js +47 -0
  90. package/dist/helpers/renderer.js.map +1 -0
  91. package/dist/helpers/utils.d.ts +8 -0
  92. package/dist/helpers/utils.js +40 -1
  93. package/dist/helpers/utils.js.map +1 -1
  94. package/package.json +8 -2
  95. package/dist/commands/lambda/renderers/flare-renderer.d.ts +0 -9
  96. package/dist/commands/lambda/renderers/flare-renderer.js +0 -18
  97. package/dist/commands/lambda/renderers/flare-renderer.js.map +0 -1
  98. package/dist/helpers/file.d.ts +0 -1
  99. package/dist/helpers/file.js +0 -9
  100. package/dist/helpers/file.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCommonAppBaseURL = exports.DEFAULT_DATADOG_SUBDOMAIN = void 0;
4
+ exports.DEFAULT_DATADOG_SUBDOMAIN = 'app';
5
+ const getCommonAppBaseURL = (datadogSite, subdomain) => {
6
+ const validSubdomain = subdomain || exports.DEFAULT_DATADOG_SUBDOMAIN;
7
+ const datadogSiteParts = datadogSite.split('.');
8
+ if (datadogSiteParts.length === 3) {
9
+ if (validSubdomain === exports.DEFAULT_DATADOG_SUBDOMAIN) {
10
+ return `https://${datadogSite}/`;
11
+ }
12
+ return `https://${validSubdomain}.${datadogSiteParts[1]}.${datadogSiteParts[2]}/`;
13
+ }
14
+ return `https://${validSubdomain}.${datadogSite}/`;
15
+ };
16
+ exports.getCommonAppBaseURL = getCommonAppBaseURL;
17
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/helpers/app.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,KAAK,CAAA;AAEvC,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,EAAE;IAC5E,MAAM,cAAc,GAAG,SAAS,IAAI,iCAAyB,CAAA;IAC7D,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAE/C,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,IAAI,cAAc,KAAK,iCAAyB,EAAE;YAChD,OAAO,WAAW,WAAW,GAAG,CAAA;SACjC;QAED,OAAO,WAAW,cAAc,IAAI,gBAAgB,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAA;KAClF;IAED,OAAO,WAAW,cAAc,IAAI,WAAW,GAAG,CAAA;AACpD,CAAC,CAAA;AAbY,QAAA,mBAAmB,uBAa/B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @file Functions used by `lambda flare` and `cloud-run flare`.
3
+ */
4
+ /**
5
+ * Send the zip file to Datadog support
6
+ * @param zipPath
7
+ * @param caseId
8
+ * @param email
9
+ * @param apiKey
10
+ * @param rootFolderPath
11
+ * @throws Error if the request fails
12
+ */
13
+ export declare const sendToDatadog: (zipPath: string, caseId: string, email: string, apiKey: string, rootFolderPath: string) => Promise<void>;
14
+ /**
15
+ * Calculates the full endpoint URL
16
+ * @throws Error if the site is invalid
17
+ * @returns the full endpoint URL
18
+ */
19
+ export declare const getEndpointUrl: () => string;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * @file Functions used by `lambda flare` and `cloud-run flare`.
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getEndpointUrl = exports.sendToDatadog = void 0;
19
+ const fs_1 = __importDefault(require("fs"));
20
+ const axios_1 = __importDefault(require("axios"));
21
+ const form_data_1 = __importDefault(require("form-data"));
22
+ const constants_1 = require("../constants");
23
+ const fs_2 = require("./fs");
24
+ const validation_1 = require("./validation");
25
+ const { version } = require('../../package.json');
26
+ /**
27
+ * Send the zip file to Datadog support
28
+ * @param zipPath
29
+ * @param caseId
30
+ * @param email
31
+ * @param apiKey
32
+ * @param rootFolderPath
33
+ * @throws Error if the request fails
34
+ */
35
+ const sendToDatadog = (zipPath, caseId, email, apiKey, rootFolderPath) => __awaiter(void 0, void 0, void 0, function* () {
36
+ var _a, _b, _c;
37
+ const endpointUrl = exports.getEndpointUrl();
38
+ const form = new form_data_1.default();
39
+ form.append('case_id', caseId);
40
+ form.append('flare_file', fs_1.default.createReadStream(zipPath));
41
+ form.append('datadog_ci_version', version);
42
+ form.append('email', email);
43
+ const headerConfig = {
44
+ headers: Object.assign(Object.assign({}, form.getHeaders()), { 'DD-API-KEY': apiKey }),
45
+ };
46
+ try {
47
+ yield axios_1.default.post(endpointUrl, form, headerConfig);
48
+ }
49
+ catch (err) {
50
+ // Ensure the root folder is deleted if the request fails
51
+ fs_2.deleteFolder(rootFolderPath);
52
+ if (axios_1.default.isAxiosError(err)) {
53
+ const errResponse = (_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data.error) !== null && _b !== void 0 ? _b : '';
54
+ const errorMessage = (_c = err.message) !== null && _c !== void 0 ? _c : '';
55
+ throw Error(`Failed to send flare file to Datadog Support: ${errorMessage}. ${errResponse}\n`);
56
+ }
57
+ throw err;
58
+ }
59
+ });
60
+ exports.sendToDatadog = sendToDatadog;
61
+ /**
62
+ * Calculates the full endpoint URL
63
+ * @throws Error if the site is invalid
64
+ * @returns the full endpoint URL
65
+ */
66
+ const getEndpointUrl = () => {
67
+ var _a, _b;
68
+ const baseUrl = (_b = (_a = process.env[constants_1.CI_SITE_ENV_VAR]) !== null && _a !== void 0 ? _a : process.env[constants_1.SITE_ENV_VAR]) !== null && _b !== void 0 ? _b : constants_1.DATADOG_SITE_US1;
69
+ // The DNS doesn't redirect to the proper endpoint when a subdomain is not present in the baseUrl.
70
+ // There is a DNS inconsistency
71
+ let endpointUrl = baseUrl;
72
+ if ([constants_1.DATADOG_SITE_US1, constants_1.DATADOG_SITE_EU1, constants_1.DATADOG_SITE_GOV].includes(baseUrl)) {
73
+ endpointUrl = 'app.' + baseUrl;
74
+ }
75
+ if (!validation_1.isValidDatadogSite(baseUrl)) {
76
+ throw Error(`Invalid site: ${baseUrl}. Must be one of: ${constants_1.DATADOG_SITES.join(', ')}`);
77
+ }
78
+ return 'https://' + endpointUrl + constants_1.FLARE_ENDPOINT_PATH;
79
+ };
80
+ exports.getEndpointUrl = getEndpointUrl;
81
+ //# sourceMappingURL=flare.js.map
@@ -0,0 +1 @@
1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AI,EAAE,CAAA;YAEtC,MAAM,KAAK,CAAC,iDAAiD,YAAY,KAAK,WAAW,IAAI,CAAC,CAAA;SAC/F;QAED,MAAM,GAAG,CAAA;KACV;AACH,CAAC,CAAA,CAAA;AAnCY,QAAA,aAAa,iBAmCzB;AAED;;;;GAIG;AACI,MAAM,cAAc,GAAG,GAAG,EAAE;;IACjC,MAAM,OAAO,GAAG,MAAA,MAAA,OAAO,CAAC,GAAG,CAAC,2BAAe,CAAC,mCAAI,OAAO,CAAC,GAAG,CAAC,wBAAY,CAAC,mCAAI,4BAAgB,CAAA;IAC7F,kGAAkG;IAClG,+BAA+B;IAC/B,IAAI,WAAW,GAAG,OAAO,CAAA;IACzB,IAAI,CAAC,4BAAgB,EAAE,4BAAgB,EAAE,4BAAgB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC5E,WAAW,GAAG,MAAM,GAAG,OAAO,CAAA;KAC/B;IAED,IAAI,CAAC,+BAAkB,CAAC,OAAO,CAAC,EAAE;QAChC,MAAM,KAAK,CAAC,iBAAiB,OAAO,qBAAqB,yBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;KACrF;IAED,OAAO,UAAU,GAAG,WAAW,GAAG,+BAAmB,CAAA;AACvD,CAAC,CAAA;AAdY,QAAA,cAAc,kBAc1B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @file Functions that interact with the file system.
3
+ * Functions have built-in error handling for more descriptive error messages.
4
+ */
5
+ /**
6
+ * Delete a folder and all its contents
7
+ * @param folderPath the folder to delete
8
+ * @throws Error if the deletion fails
9
+ */
10
+ export declare const deleteFolder: (folderPath: string) => void;
11
+ /**
12
+ * Write the data to a file
13
+ * @param filePath path to the file
14
+ * @param data the data to write
15
+ * @throws Error if the file cannot be written
16
+ */
17
+ export declare const writeFile: (filePath: string, data: string) => void;
18
+ /**
19
+ * Zip the entire contents of a folder
20
+ * @param rootFolderPath path to the root folder to zip
21
+ * @param zipPath path to save the zip file
22
+ * @throws Error if the zip fails
23
+ */
24
+ export declare const zipContents: (rootFolderPath: string, zipPath: string) => Promise<void>;
25
+ /**
26
+ * Creates the root folder and any subfolders
27
+ * @param rootFolderPath path to the root folder
28
+ * @param subFolders paths to any subfolders to be created
29
+ * @throws Error if the root folder cannot be deleted or folders cannot be created
30
+ */
31
+ export declare const createDirectories: (rootFolderPath: string, subFolders: string[]) => void;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ /**
3
+ * @file Functions that interact with the file system.
4
+ * Functions have built-in error handling for more descriptive error messages.
5
+ */
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.createDirectories = exports.zipContents = exports.writeFile = exports.deleteFolder = void 0;
20
+ const fs_1 = __importDefault(require("fs"));
21
+ const path_1 = __importDefault(require("path"));
22
+ const jszip_1 = __importDefault(require("jszip"));
23
+ /**
24
+ * Delete a folder and all its contents
25
+ * @param folderPath the folder to delete
26
+ * @throws Error if the deletion fails
27
+ */
28
+ const deleteFolder = (folderPath) => {
29
+ try {
30
+ fs_1.default.rmSync(folderPath, { recursive: true, force: true });
31
+ }
32
+ catch (err) {
33
+ if (err instanceof Error) {
34
+ throw Error(`Failed to delete files located at ${folderPath}: ${err.message}`);
35
+ }
36
+ }
37
+ };
38
+ exports.deleteFolder = deleteFolder;
39
+ /**
40
+ * Write the data to a file
41
+ * @param filePath path to the file
42
+ * @param data the data to write
43
+ * @throws Error if the file cannot be written
44
+ */
45
+ const writeFile = (filePath, data) => {
46
+ try {
47
+ fs_1.default.writeFileSync(filePath, data);
48
+ }
49
+ catch (err) {
50
+ if (err instanceof Error) {
51
+ throw Error(`Unable to write file: ${err.message}`);
52
+ }
53
+ }
54
+ };
55
+ exports.writeFile = writeFile;
56
+ /**
57
+ * Zip the entire contents of a folder
58
+ * @param rootFolderPath path to the root folder to zip
59
+ * @param zipPath path to save the zip file
60
+ * @throws Error if the zip fails
61
+ */
62
+ const zipContents = (rootFolderPath, zipPath) => __awaiter(void 0, void 0, void 0, function* () {
63
+ const zip = new jszip_1.default();
64
+ const addFolderToZip = (folderPath) => {
65
+ if (!fs_1.default.existsSync(folderPath)) {
66
+ throw Error(`Folder does not exist: ${folderPath}`);
67
+ }
68
+ const folder = fs_1.default.statSync(folderPath);
69
+ if (!folder.isDirectory()) {
70
+ throw Error(`Path is not a directory: ${folderPath}`);
71
+ }
72
+ const contents = fs_1.default.readdirSync(folderPath);
73
+ for (const item of contents) {
74
+ const fullPath = path_1.default.join(folderPath, item);
75
+ const file = fs_1.default.statSync(fullPath);
76
+ if (file.isDirectory()) {
77
+ addFolderToZip(fullPath);
78
+ }
79
+ else {
80
+ const data = fs_1.default.readFileSync(fullPath);
81
+ zip.file(path_1.default.relative(rootFolderPath, fullPath), data);
82
+ }
83
+ }
84
+ };
85
+ try {
86
+ addFolderToZip(rootFolderPath);
87
+ const zipContent = yield zip.generateAsync({ type: 'nodebuffer' });
88
+ fs_1.default.writeFileSync(zipPath, zipContent);
89
+ }
90
+ catch (err) {
91
+ if (err instanceof Error) {
92
+ throw Error(`Unable to zip files: ${err.message}`);
93
+ }
94
+ }
95
+ });
96
+ exports.zipContents = zipContents;
97
+ /**
98
+ * Creates the root folder and any subfolders
99
+ * @param rootFolderPath path to the root folder
100
+ * @param subFolders paths to any subfolders to be created
101
+ * @throws Error if the root folder cannot be deleted or folders cannot be created
102
+ */
103
+ const createDirectories = (rootFolderPath, subFolders) => {
104
+ try {
105
+ fs_1.default.mkdirSync(rootFolderPath);
106
+ for (const subFolder of subFolders) {
107
+ fs_1.default.mkdirSync(subFolder);
108
+ }
109
+ }
110
+ catch (err) {
111
+ if (err instanceof Error) {
112
+ throw Error(`Unable to create directories: ${err.message}`);
113
+ }
114
+ }
115
+ };
116
+ exports.createDirectories = createDirectories;
117
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/helpers/fs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,4CAAmB;AACnB,gDAAuB;AAEvB,kDAAyB;AAEzB;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;IACjD,IAAI;QACF,YAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;KACtD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,MAAM,KAAK,CAAC,qCAAqC,UAAU,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;SAC/E;KACF;AACH,CAAC,CAAA;AARY,QAAA,YAAY,gBAQxB;AAED;;;;;GAKG;AACI,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,EAAE;IAC1D,IAAI;QACF,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,MAAM,KAAK,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;SACpD;KACF;AACH,CAAC,CAAA;AARY,QAAA,SAAS,aAQrB;AAED;;;;;GAKG;AACI,MAAM,WAAW,GAAG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Z,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,MAAM,KAAK,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;SACnD;KACF;AACH,CAAC,CAAA,CAAA;AApCY,QAAA,WAAW,eAoCvB;AAED;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,cAAsB,EAAE,UAAoB,EAAE,EAAE;IAChF,IAAI;QACF,YAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;QAC5B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,YAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;SACxB;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,MAAM,KAAK,CAAC,iCAAiC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;SAC5D;KACF;AACH,CAAC,CAAA;AAXY,QAAA,iBAAiB,qBAW7B"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file Functions used to prompt the user for input.
3
+ */
4
+ import inquirer from 'inquirer';
5
+ export declare const confirmationQuestion: (message: string, defaultValue?: boolean) => inquirer.ConfirmQuestion;
6
+ export declare const requestConfirmation: (message: string, defaultValue?: boolean) => Promise<any>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * @file Functions used to prompt the user for input.
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.requestConfirmation = exports.confirmationQuestion = void 0;
19
+ const inquirer_1 = __importDefault(require("inquirer"));
20
+ const confirmationQuestion = (message, defaultValue = true) => ({
21
+ message,
22
+ name: 'confirmation',
23
+ type: 'confirm',
24
+ default: defaultValue,
25
+ });
26
+ exports.confirmationQuestion = confirmationQuestion;
27
+ const requestConfirmation = (message, defaultValue = true) => __awaiter(void 0, void 0, void 0, function* () {
28
+ try {
29
+ const confirmationAnswer = yield inquirer_1.default.prompt(exports.confirmationQuestion(message, defaultValue));
30
+ return confirmationAnswer.confirmation;
31
+ }
32
+ catch (e) {
33
+ if (e instanceof Error) {
34
+ throw Error(`Couldn't receive confirmation. ${e.message}`);
35
+ }
36
+ }
37
+ });
38
+ exports.requestConfirmation = requestConfirmation;
39
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/helpers/prompt.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;AAEH,wDAA+B;AAExB,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,YAAY,GAAG,IAAI,EAA4B,EAAE,CAAC,CAAC;IACvG,OAAO;IACP,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;CACtB,CAAC,CAAA;AALW,QAAA,oBAAoB,wBAK/B;AAEK,MAAM,mBAAmB,GAAG,CAAO,OAAe,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE;IAChF,IAAI;QACF,MAAM,kBAAkB,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC,4BAAoB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;QAE7F,OAAO,kBAAkB,CAAC,YAAY,CAAA;KACvC;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,YAAY,KAAK,EAAE;YACtB,MAAM,KAAK,CAAC,kCAAkC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;SAC3D;KACF;AACH,CAAC,CAAA,CAAA;AAVY,QAAA,mBAAmB,uBAU/B"}
@@ -0,0 +1,36 @@
1
+ export declare const dryRunTag: string;
2
+ export declare const errorTag: string;
3
+ export declare const warningTag: string;
4
+ export declare const warningExclamationSignTag: string;
5
+ export declare const successCheckmarkTag: string;
6
+ export declare const failCrossTag: string;
7
+ /**
8
+ * @param error an error message or an object of type `unknown`*.
9
+ * @returns the provided error prefixed by {@link errorTag}.
10
+ *
11
+ * * Using unknown since we're not type guarding.
12
+ *
13
+ * ```txt
14
+ * [Error] The provided error goes here!
15
+ * ```
16
+ */
17
+ export declare const renderError: (error: unknown) => string;
18
+ /**
19
+ * @param warning the message to warn about.
20
+ * @returns the provided warning prefixed by {@link warningExclamationSignTag}.
21
+ *
22
+ * ```txt
23
+ * [!] The provided warning goes here!
24
+ * ```
25
+ */
26
+ export declare const renderSoftWarning: (warning: string) => string;
27
+ /**
28
+ * @returns a header indicating on which platform the 'flare' command is being run.
29
+ * @param platformName the name of the platform. E.g. 'Cloud Run' or 'Lambda'.
30
+ * @param isDryRun whether or not the command is a dry run.
31
+ *
32
+ * ```txt
33
+ * [Dry Run] 🐶 Instrumenting Lambda function
34
+ * ```
35
+ */
36
+ export declare const renderFlareHeader: (platformName: string, isDryRun: boolean) => string;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderFlareHeader = exports.renderSoftWarning = exports.renderError = exports.failCrossTag = exports.successCheckmarkTag = exports.warningExclamationSignTag = exports.warningTag = exports.errorTag = exports.dryRunTag = void 0;
4
+ const chalk_1 = require("chalk");
5
+ exports.dryRunTag = chalk_1.bold(chalk_1.cyan('[Dry Run]'));
6
+ exports.errorTag = chalk_1.bold(chalk_1.red('[Error]'));
7
+ exports.warningTag = chalk_1.bold(chalk_1.yellow('[Warning]'));
8
+ exports.warningExclamationSignTag = chalk_1.bold(chalk_1.yellow('[!]'));
9
+ exports.successCheckmarkTag = chalk_1.bold(chalk_1.green('✔'));
10
+ exports.failCrossTag = chalk_1.bold(chalk_1.red('✖'));
11
+ /**
12
+ * @param error an error message or an object of type `unknown`*.
13
+ * @returns the provided error prefixed by {@link errorTag}.
14
+ *
15
+ * * Using unknown since we're not type guarding.
16
+ *
17
+ * ```txt
18
+ * [Error] The provided error goes here!
19
+ * ```
20
+ */
21
+ const renderError = (error) => `${exports.errorTag} ${error}\n`;
22
+ exports.renderError = renderError;
23
+ /**
24
+ * @param warning the message to warn about.
25
+ * @returns the provided warning prefixed by {@link warningExclamationSignTag}.
26
+ *
27
+ * ```txt
28
+ * [!] The provided warning goes here!
29
+ * ```
30
+ */
31
+ const renderSoftWarning = (warning) => `${exports.warningExclamationSignTag} ${warning}\n`;
32
+ exports.renderSoftWarning = renderSoftWarning;
33
+ /**
34
+ * @returns a header indicating on which platform the 'flare' command is being run.
35
+ * @param platformName the name of the platform. E.g. 'Cloud Run' or 'Lambda'.
36
+ * @param isDryRun whether or not the command is a dry run.
37
+ *
38
+ * ```txt
39
+ * [Dry Run] 🐶 Instrumenting Lambda function
40
+ * ```
41
+ */
42
+ const renderFlareHeader = (platformName, isDryRun) => {
43
+ const prefix = isDryRun ? `${exports.dryRunTag} ` : '';
44
+ return chalk_1.bold(`\n${prefix}🐶 Generating ${platformName} flare to send your configuration to Datadog...\n`);
45
+ };
46
+ exports.renderFlareHeader = renderFlareHeader;
47
+ //# sourceMappingURL=renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/helpers/renderer.ts"],"names":[],"mappings":";;;AAAA,iCAAoD;AAEvC,QAAA,SAAS,GAAG,YAAI,CAAC,YAAI,CAAC,WAAW,CAAC,CAAC,CAAA;AACnC,QAAA,QAAQ,GAAG,YAAI,CAAC,WAAG,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/B,QAAA,UAAU,GAAG,YAAI,CAAC,cAAM,CAAC,WAAW,CAAC,CAAC,CAAA;AAEtC,QAAA,yBAAyB,GAAG,YAAI,CAAC,cAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/C,QAAA,mBAAmB,GAAG,YAAI,CAAC,aAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AACtC,QAAA,YAAY,GAAG,YAAI,CAAC,WAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AAE1C;;;;;;;;;GASG;AACI,MAAM,WAAW,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,GAAG,gBAAQ,IAAI,KAAK,IAAI,CAAA;AAA1D,QAAA,WAAW,eAA+C;AAEvE;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,iCAAyB,IAAI,OAAO,IAAI,CAAA;AAApF,QAAA,iBAAiB,qBAAmE;AAEjG;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAAC,YAAoB,EAAE,QAAiB,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,iBAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE9C,OAAO,YAAI,CAAC,KAAK,MAAM,iBAAiB,YAAY,mDAAmD,CAAC,CAAA;AAC1G,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B"}
@@ -56,4 +56,12 @@ export declare const performSubCommand: (command: CommandClass<BaseContext>, com
56
56
  export declare const filterSensitiveInfoFromRepository: (repositoryUrl: string | undefined) => string | undefined;
57
57
  export declare const filterAndFormatGithubRemote: (rawRemote: string | undefined) => string | undefined;
58
58
  export declare const timedExecAsync: <I, O>(f: (input: I) => Promise<O>, input: I) => Promise<number>;
59
+ /**
60
+ * Convert bytes to a formatted string in KB, MB, GB, etc.
61
+ * Note: Lambda documentation uses MB (instead of Mib) to refer to 1024 KB, so we follow that style here
62
+ * @param bytes
63
+ * @param decimals
64
+ */
65
+ export declare const formatBytes: (bytes: number, decimals?: number) => string;
66
+ export declare const maskString: (value: string) => string;
59
67
  export {};
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.timedExecAsync = exports.filterAndFormatGithubRemote = exports.filterSensitiveInfoFromRepository = exports.performSubCommand = exports.pluralize = exports.normalizeRef = exports.removeUndefinedValues = exports.removeEmptyValues = exports.buildPath = exports.getApiHostForSite = exports.getProxyAgent = exports.getRequestBuilder = exports.getProxyUrl = exports.parseConfigFile = exports.resolveConfigFromFile = exports.resolveConfigFromFileAndEnvironment = exports.parseOptionalInteger = exports.getConfig = exports.pick = exports.DEFAULT_CONFIG_PATHS = void 0;
34
+ exports.maskString = exports.formatBytes = exports.timedExecAsync = exports.filterAndFormatGithubRemote = exports.filterSensitiveInfoFromRepository = exports.performSubCommand = exports.pluralize = exports.normalizeRef = exports.removeUndefinedValues = exports.removeEmptyValues = exports.buildPath = exports.getApiHostForSite = exports.getProxyAgent = exports.getRequestBuilder = exports.getProxyUrl = exports.parseConfigFile = exports.resolveConfigFromFile = exports.resolveConfigFromFileAndEnvironment = exports.parseOptionalInteger = exports.getConfig = exports.pick = exports.DEFAULT_CONFIG_PATHS = void 0;
35
35
  const fs_1 = __importStar(require("fs"));
36
36
  const util_1 = require("util");
37
37
  const axios_1 = __importDefault(require("axios"));
@@ -287,4 +287,43 @@ const timedExecAsync = (f, input) => __awaiter(void 0, void 0, void 0, function*
287
287
  return (Date.now() - initialTime) / 1000;
288
288
  });
289
289
  exports.timedExecAsync = timedExecAsync;
290
+ /**
291
+ * Convert bytes to a formatted string in KB, MB, GB, etc.
292
+ * Note: Lambda documentation uses MB (instead of Mib) to refer to 1024 KB, so we follow that style here
293
+ * @param bytes
294
+ * @param decimals
295
+ */
296
+ const formatBytes = (bytes, decimals = 2) => {
297
+ if (!bytes) {
298
+ return '0 Bytes';
299
+ }
300
+ if (bytes < 0) {
301
+ throw Error("'bytes' can't be negative.");
302
+ }
303
+ const bytesPerKB = 1024;
304
+ const numDecimals = decimals < 0 ? 0 : decimals;
305
+ const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
306
+ const i = Math.floor(Math.log(bytes) / Math.log(bytesPerKB));
307
+ const formattedBytes = parseFloat((bytes / Math.pow(bytesPerKB, i)).toFixed(numDecimals));
308
+ return `${formattedBytes} ${units[i]}`;
309
+ };
310
+ exports.formatBytes = formatBytes;
311
+ // Mask a string to hide sensitive values
312
+ const maskString = (value) => {
313
+ // Don't mask booleans
314
+ if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
315
+ return value;
316
+ }
317
+ // Dont mask numbers
318
+ if (!isNaN(Number(value))) {
319
+ return value;
320
+ }
321
+ // Mask entire string if it's short
322
+ if (value.length < 12) {
323
+ return '*'.repeat(16);
324
+ }
325
+ // Keep first two and last four characters if it's long
326
+ return value.slice(0, 2) + '*'.repeat(10) + value.slice(-4);
327
+ };
328
+ exports.maskString = maskString;
290
329
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,+BAA8B;AAI9B,kDAA0D;AAC1D,yCAAwD;AACxD,8DAAoC;AACpC,6CAAsC;AAEzB,QAAA,oBAAoB,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAEhD,MAAM,IAAI,GAAG,CAAgD,IAAO,EAAE,IAAS,EAAE,EAAE;IACxF,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACrD,MAAM,YAAY,GAAe,EAAE,CAAA;IAEnC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O,KAAK,CAAA;KACb;IAED,oBAAoB;IACpB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;QACzB,OAAO,KAAK,CAAA;KACb;IAED,mCAAmC;IACnC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QACrB,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;KACtB;IAED,uDAAuD;IACvD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7D,CAAC,CAAA;AAlBY,QAAA,UAAU,cAkBtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/datadog-ci",
3
- "version": "2.17.2",
3
+ "version": "2.18.1",
4
4
  "description": "Run datadog actions from the CI.",
5
5
  "repository": "https://github.com/DataDog/datadog-ci",
6
6
  "license": "Apache-2.0",
@@ -53,6 +53,8 @@
53
53
  "test": "jest --colors",
54
54
  "test:debug": "node --inspect-brk node_modules/jest/bin/jest --runInBand",
55
55
  "test:lambda": "jest src/commands/lambda --colors",
56
+ "test:cloud-run": "jest src/commands/cloud-run --colors",
57
+ "test:helpers": "jest src/helpers --colors",
56
58
  "eslint": "eslint --quiet 'src/**/*.ts'",
57
59
  "typecheck": "bash bin/typecheck.sh",
58
60
  "watch": "tsc -w"
@@ -64,6 +66,8 @@
64
66
  "@aws-sdk/client-sfn": "^3.358.0",
65
67
  "@aws-sdk/credential-providers": "^3.358.0",
66
68
  "@aws-sdk/property-provider": "^3.357.0",
69
+ "@google-cloud/logging": "^10.5.0",
70
+ "@google-cloud/run": "^0.6.0",
67
71
  "@types/datadog-metrics": "0.6.1",
68
72
  "ajv": "^8.12.0",
69
73
  "ajv-formats": "^2.1.1",
@@ -78,6 +82,8 @@
78
82
  "form-data": "3.0.0",
79
83
  "fuzzy": "^0.1.3",
80
84
  "glob": "7.1.4",
85
+ "google-auth-library": "^8.9.0",
86
+ "http-proxy-agent": "^7.0.0",
81
87
  "inquirer": "^8.2.5",
82
88
  "inquirer-checkbox-plus-prompt": "^1.4.2",
83
89
  "js-yaml": "3.13.1",
@@ -122,7 +128,7 @@
122
128
  "@typescript-eslint/parser": "^4.33.0",
123
129
  "aws-sdk-client-mock": "^2.1.1",
124
130
  "aws-sdk-client-mock-jest": "^2.1.1",
125
- "dd-trace": "3.20.0",
131
+ "dd-trace": "3.29.1",
126
132
  "eslint": "^7.32.0",
127
133
  "eslint-config-prettier": "^8.5.0",
128
134
  "eslint-import-resolver-typescript": "2.7.0",
@@ -1,9 +0,0 @@
1
- /**
2
- * @returns a header indicating which `lambda` subcommand is running.
3
- * @param isDryRun whether or not the command is a dry run.
4
- *
5
- * ```txt
6
- * [Dry Run] 🐶 Instrumenting Lambda function
7
- * ```
8
- */
9
- export declare const renderLambdaFlareHeader: (isDryRun: boolean) => string;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderLambdaFlareHeader = void 0;
4
- const common_renderer_1 = require("./common-renderer");
5
- /**
6
- * @returns a header indicating which `lambda` subcommand is running.
7
- * @param isDryRun whether or not the command is a dry run.
8
- *
9
- * ```txt
10
- * [Dry Run] 🐶 Instrumenting Lambda function
11
- * ```
12
- */
13
- const renderLambdaFlareHeader = (isDryRun) => {
14
- const prefix = isDryRun ? `${common_renderer_1.dryRunTag} ` : '';
15
- return `\n${prefix}🐶 Generating Lambda flare to send your configuration to Datadog...\n`;
16
- };
17
- exports.renderLambdaFlareHeader = renderLambdaFlareHeader;
18
- //# sourceMappingURL=flare-renderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flare-renderer.js","sourceRoot":"","sources":["../../../../src/commands/lambda/renderers/flare-renderer.ts"],"names":[],"mappings":";;;AAAA,uDAA2C;AAE3C;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAG,CAAC,QAAiB,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,2BAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE9C,OAAO,KAAK,MAAM,uEAAuE,CAAA;AAC3F,CAAC,CAAA;AAJY,QAAA,uBAAuB,2BAInC"}
@@ -1 +0,0 @@
1
- export declare const getSafeFilename: (unsafeFileName: string) => string;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSafeFilename = void 0;
4
- // We need a unique file name so we use span tags like the pipeline URL,
5
- // which can contain dots and other unsafe characters for filenames.
6
- // We filter them out here.
7
- const getSafeFilename = (unsafeFileName) => unsafeFileName.replace(/[^a-z0-9]/gi, '_');
8
- exports.getSafeFilename = getSafeFilename;
9
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/helpers/file.ts"],"names":[],"mappings":";;;AAAA,wEAAwE;AACxE,oEAAoE;AACpE,2BAA2B;AACpB,MAAM,eAAe,GAAG,CAAC,cAAsB,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;AAAxF,QAAA,eAAe,mBAAyE"}