@datadog/datadog-ci 2.22.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sbom/api.d.ts +2 -2
- package/dist/commands/sbom/api.js +14 -9
- package/dist/commands/sbom/api.js.map +1 -1
- package/dist/commands/sbom/constants.d.ts +1 -2
- package/dist/commands/sbom/constants.js +2 -3
- package/dist/commands/sbom/constants.js.map +1 -1
- package/dist/commands/sbom/language.d.ts +2 -0
- package/dist/commands/sbom/language.js +33 -0
- package/dist/commands/sbom/language.js.map +1 -0
- package/dist/commands/sbom/license.d.ts +3 -0
- package/dist/commands/sbom/license.js +98 -0
- package/dist/commands/sbom/license.js.map +1 -0
- package/dist/commands/sbom/payload.d.ts +2 -3
- package/dist/commands/sbom/payload.js +53 -19
- package/dist/commands/sbom/payload.js.map +1 -1
- package/dist/commands/sbom/types.d.ts +68 -3
- package/dist/commands/sbom/types.js +51 -0
- package/dist/commands/sbom/types.js.map +1 -1
- package/dist/commands/sbom/upload.js +16 -17
- package/dist/commands/sbom/upload.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/helpers/ci.js +9 -0
- package/dist/helpers/ci.js.map +1 -1
- package/package.json +1 -3
- package/dist/commands/sbom/protobuf/bom-1.4.d.ts +0 -11788
- package/dist/commands/sbom/protobuf/bom-1.4.js +0 -5170
- package/dist/commands/sbom/protobuf/bom-1.4.js.map +0 -1
- package/dist/commands/sbom/protobuf/custom_message.d.ts +0 -11
- package/dist/commands/sbom/protobuf/custom_message.js +0 -3
- package/dist/commands/sbom/protobuf/custom_message.js.map +0 -1
- package/dist/commands/sbom/protobuf/google/protobuf/duration.d.ts +0 -110
- package/dist/commands/sbom/protobuf/google/protobuf/duration.js +0 -126
- package/dist/commands/sbom/protobuf/google/protobuf/duration.js.map +0 -1
- package/dist/commands/sbom/protobuf/google/protobuf/timestamp.d.ts +0 -139
- package/dist/commands/sbom/protobuf/google/protobuf/timestamp.js +0 -126
- package/dist/commands/sbom/protobuf/google/protobuf/timestamp.js.map +0 -1
- package/dist/commands/sbom/protobuf/sbom_intake.d.ts +0 -53
- package/dist/commands/sbom/protobuf/sbom_intake.js +0 -383
- package/dist/commands/sbom/protobuf/sbom_intake.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosPromise, AxiosResponse } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import { ScaRequest } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Get the function to upload our results to the intake.
|
|
5
5
|
* @param apiKey
|
|
6
6
|
*/
|
|
7
|
-
export declare const getApiHelper: (apiKey: string) => (
|
|
7
|
+
export declare const getApiHelper: (apiKey: string, appKey: string) => (scaRequest: ScaRequest) => AxiosPromise<AxiosResponse>;
|
|
@@ -11,26 +11,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getApiHelper = void 0;
|
|
13
13
|
const constants_1 = require("../../constants");
|
|
14
|
-
const api_1 = require("../../helpers/api");
|
|
15
14
|
const utils_1 = require("../../helpers/utils");
|
|
15
|
+
const utils_2 = require("../junit/utils");
|
|
16
16
|
const constants_2 = require("./constants");
|
|
17
|
-
const sbom_intake_1 = require("./protobuf/sbom_intake");
|
|
18
17
|
const maxBodyLength = Infinity;
|
|
19
18
|
/**
|
|
20
19
|
* Get the function to upload our results to the intake.
|
|
21
20
|
* @param apiKey
|
|
22
21
|
*/
|
|
23
|
-
const getApiHelper = (apiKey) => {
|
|
22
|
+
const getApiHelper = (apiKey, appKey) => {
|
|
24
23
|
/**
|
|
25
24
|
* function used to marshall and send the data
|
|
26
25
|
* @param request - the AXIOS element used to send the request
|
|
27
26
|
*/
|
|
28
|
-
const uploadSBomPayload = (request) => (
|
|
29
|
-
|
|
27
|
+
const uploadSBomPayload = (request) => (scaPayload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
// Make sure we follow the API signature
|
|
29
|
+
const payload = {
|
|
30
|
+
data: {
|
|
31
|
+
type: 'scarequests',
|
|
32
|
+
attributes: scaPayload,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
30
35
|
return request({
|
|
31
|
-
data:
|
|
36
|
+
data: JSON.stringify(payload),
|
|
32
37
|
headers: {
|
|
33
|
-
[constants_1.CONTENT_TYPE_HEADER]: constants_1.
|
|
38
|
+
[constants_1.CONTENT_TYPE_HEADER]: constants_1.CONTENT_TYPE_VALUE_JSON,
|
|
34
39
|
'DD-EVP-ORIGIN': 'datadog-ci',
|
|
35
40
|
'DD-EVP-ORIGIN-VERSION': '0.0.1',
|
|
36
41
|
},
|
|
@@ -40,9 +45,9 @@ const getApiHelper = (apiKey) => {
|
|
|
40
45
|
});
|
|
41
46
|
});
|
|
42
47
|
// Get the intake name
|
|
43
|
-
const
|
|
48
|
+
const url = (0, utils_2.getBaseUrl)();
|
|
44
49
|
// Get the AXIOS request/response function
|
|
45
|
-
const requestIntake = (0, utils_1.getRequestBuilder)({ baseUrl:
|
|
50
|
+
const requestIntake = (0, utils_1.getRequestBuilder)({ baseUrl: url, apiKey, appKey });
|
|
46
51
|
return uploadSBomPayload(requestIntake);
|
|
47
52
|
};
|
|
48
53
|
exports.getApiHelper = getApiHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/commands/sbom/api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/commands/sbom/api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAAsH;AACtH,+CAAqD;AAErD,0CAAyC;AAEzC,2CAAwC;AAGxC,MAAM,aAAa,GAAG,QAAQ,CAAA;AAE9B;;;GAGG;AACI,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,MAAc,EAC6C,EAAE;IAC7D;;;OAGG;IACH,MAAM,iBAAiB,GAAG,CAAC,OAAkE,EAAE,EAAE,CAAC,CAChG,UAAsB,EACtB,EAAE;QACF,wCAAwC;QACxC,MAAM,OAAO,GAAG;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,aAAa;gBACnB,UAAU,EAAE,UAAU;aACvB;SACF,CAAA;QAED,OAAO,OAAO,CAAC;YACb,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7B,OAAO,EAAE;gBACP,CAAC,+BAAmB,CAAC,EAAE,mCAAuB;gBAC9C,eAAe,EAAE,YAAY;gBAC7B,uBAAuB,EAAE,OAAO;aACjC;YACD,aAAa;YACb,MAAM,EAAE,uBAAW;YACnB,GAAG,EAAE,wBAAY;SAClB,CAAC,CAAA;IACJ,CAAC,CAAA,CAAA;IAED,sBAAsB;IACtB,MAAM,GAAG,GAAG,IAAA,kBAAU,GAAE,CAAA;IACxB,0CAA0C;IAC1C,MAAM,aAAa,GAAG,IAAA,yBAAiB,EAAC,EAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC,CAAA;IAEvE,OAAO,iBAAiB,CAAC,aAAa,CAAC,CAAA;AACzC,CAAC,CAAA;AAtCY,QAAA,YAAY,gBAsCxB"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare const API_ENDPOINT = "api/v2/
|
|
2
|
-
export declare const INTAKE_NAME = "sbom-intake";
|
|
1
|
+
export declare const API_ENDPOINT = "api/v2/static-analysis-sca/dependencies";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.API_ENDPOINT = 'api/v2/
|
|
5
|
-
exports.INTAKE_NAME = 'sbom-intake';
|
|
3
|
+
exports.API_ENDPOINT = void 0;
|
|
4
|
+
exports.API_ENDPOINT = 'api/v2/static-analysis-sca/dependencies';
|
|
6
5
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/commands/sbom/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/commands/sbom/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,yCAAyC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLanguageFromComponent = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
// Attempt to find the language from a SBOM component. For now, we get the source either from
|
|
6
|
+
// the bom-ref or the purl property of the SBOM.
|
|
7
|
+
const getLanguageFromComponent = (component) => {
|
|
8
|
+
const componentName = component['name'];
|
|
9
|
+
if (component['bom-ref']) {
|
|
10
|
+
if (component['bom-ref'].includes('pkg:npm')) {
|
|
11
|
+
return types_1.DependencyLanguage.NPM;
|
|
12
|
+
}
|
|
13
|
+
if (component['purl'].includes('pkg:composer')) {
|
|
14
|
+
return types_1.DependencyLanguage.PHP;
|
|
15
|
+
}
|
|
16
|
+
if (component['purl'].includes('pkg:cargo')) {
|
|
17
|
+
return types_1.DependencyLanguage.RUST;
|
|
18
|
+
}
|
|
19
|
+
if (component['purl'].includes('pkg:gem')) {
|
|
20
|
+
return types_1.DependencyLanguage.RUBY;
|
|
21
|
+
}
|
|
22
|
+
if (component['purl'].includes('pkg:maven')) {
|
|
23
|
+
return types_1.DependencyLanguage.JVM;
|
|
24
|
+
}
|
|
25
|
+
if (component['purl'].includes('pkg:golang')) {
|
|
26
|
+
return types_1.DependencyLanguage.GO;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
console.debug(`language for component ${componentName} not found`);
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
exports.getLanguageFromComponent = getLanguageFromComponent;
|
|
33
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../../src/commands/sbom/language.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE1C,6FAA6F;AAC7F,gDAAgD;AACzC,MAAM,wBAAwB,GAAG,CAAC,SAAc,EAAkC,EAAE;IACzF,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAEvC,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE;QACxB,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YAC5C,OAAO,0BAAkB,CAAC,GAAG,CAAA;SAC9B;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YAC9C,OAAO,0BAAkB,CAAC,GAAG,CAAA;SAC9B;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAC3C,OAAO,0BAAkB,CAAC,IAAI,CAAA;SAC/B;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACzC,OAAO,0BAAkB,CAAC,IAAI,CAAA;SAC/B;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAC3C,OAAO,0BAAkB,CAAC,GAAG,CAAA;SAC9B;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YAC5C,OAAO,0BAAkB,CAAC,EAAE,CAAA;SAC7B;KACF;IAED,OAAO,CAAC,KAAK,CAAC,0BAA0B,aAAa,YAAY,CAAC,CAAA;IAElE,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AA3BY,QAAA,wBAAwB,4BA2BpC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLicensesFromComponent = exports.getLicensesFromString = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
// Get the license from a string. If the license is valid, we return it. Otherwise, we return undefined
|
|
6
|
+
// List of licenses: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository
|
|
7
|
+
const getLicenseFromString = (s) => {
|
|
8
|
+
if (!s) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
switch (s.toLowerCase()) {
|
|
12
|
+
case '0bsd':
|
|
13
|
+
return types_1.DependencyLicense.ZEROBSD;
|
|
14
|
+
case 'apache-2.0':
|
|
15
|
+
case 'apache license, version 2.0':
|
|
16
|
+
case 'the apache software license, version 2.0':
|
|
17
|
+
return types_1.DependencyLicense.APACHE2;
|
|
18
|
+
case 'bsd-2-clause':
|
|
19
|
+
return types_1.DependencyLicense.BSD2CLAUSE;
|
|
20
|
+
case 'bsd-3-clause':
|
|
21
|
+
return types_1.DependencyLicense.BSD3CLAUSE;
|
|
22
|
+
case 'bsl-1.0':
|
|
23
|
+
return types_1.DependencyLicense.BSL1;
|
|
24
|
+
case 'gpl v2':
|
|
25
|
+
return types_1.DependencyLicense.GPL2_0;
|
|
26
|
+
case 'gpl v3':
|
|
27
|
+
return types_1.DependencyLicense.GPL3_0;
|
|
28
|
+
case 'isc':
|
|
29
|
+
return types_1.DependencyLicense.ISC;
|
|
30
|
+
case 'mit':
|
|
31
|
+
case 'the mit license':
|
|
32
|
+
return types_1.DependencyLicense.MIT;
|
|
33
|
+
case 'unlicense':
|
|
34
|
+
return types_1.DependencyLicense.UNLICENSE;
|
|
35
|
+
case 'zlib':
|
|
36
|
+
return types_1.DependencyLicense.ZLIB;
|
|
37
|
+
}
|
|
38
|
+
console.debug(`license ${s} not recognized`);
|
|
39
|
+
return undefined;
|
|
40
|
+
};
|
|
41
|
+
// Get all the licenses from a string. Sometimes, there are two licenses in one string
|
|
42
|
+
// such as "MIT OR Apache-2.0". In this case, we return all the licenses in this condition.
|
|
43
|
+
const getLicensesFromString = (s) => {
|
|
44
|
+
if (!s) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
const licenses = [];
|
|
48
|
+
if (s.toLowerCase().includes('or')) {
|
|
49
|
+
for (const lic of s.toLowerCase().split(' or ')) {
|
|
50
|
+
const l = getLicenseFromString(lic.trim());
|
|
51
|
+
if (l) {
|
|
52
|
+
licenses.push(l);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const lic = getLicenseFromString(s);
|
|
58
|
+
if (lic) {
|
|
59
|
+
licenses.push(lic);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return licenses;
|
|
63
|
+
};
|
|
64
|
+
exports.getLicensesFromString = getLicensesFromString;
|
|
65
|
+
// Get all the licenses of this component. We extract the "licenses" element from the SBOM component.
|
|
66
|
+
// Unfortunately, depending on the SBOM generator, the licenses are generated in a different manner.
|
|
67
|
+
// We attempt to get as much as possible.
|
|
68
|
+
const getLicensesFromComponent = (component) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const elementsForLicense = ['id', 'name'];
|
|
71
|
+
const componentName = component['name'];
|
|
72
|
+
const licenses = [];
|
|
73
|
+
// Get the "licenses" attribute of the SBOM component.
|
|
74
|
+
if (component['licenses']) {
|
|
75
|
+
for (const license of component['licenses']) {
|
|
76
|
+
for (const el of elementsForLicense) {
|
|
77
|
+
// Handle "license": [ {"license": {"id": <license>}} ]
|
|
78
|
+
if ((_a = license['license']) === null || _a === void 0 ? void 0 : _a[el]) {
|
|
79
|
+
for (const l of (0, exports.getLicensesFromString)(license['license'][el])) {
|
|
80
|
+
licenses.push(l);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Handle "license": [ {"expression": "MIT"} ]
|
|
84
|
+
if (license['expression']) {
|
|
85
|
+
for (const l of (0, exports.getLicensesFromString)(license['expression'])) {
|
|
86
|
+
licenses.push(l);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (licenses.length === 0) {
|
|
93
|
+
console.log(`license for component ${componentName} not found`);
|
|
94
|
+
}
|
|
95
|
+
return licenses;
|
|
96
|
+
};
|
|
97
|
+
exports.getLicensesFromComponent = getLicensesFromComponent;
|
|
98
|
+
//# sourceMappingURL=license.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/commands/sbom/license.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AAEzC,uGAAuG;AACvG,+JAA+J;AAC/J,MAAM,oBAAoB,GAAG,CAAC,CAAS,EAAiC,EAAE;IACxE,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,SAAS,CAAA;KACjB;IAED,QAAQ,CAAC,CAAC,WAAW,EAAE,EAAE;QACvB,KAAK,MAAM;YACT,OAAO,yBAAiB,CAAC,OAAO,CAAA;QAClC,KAAK,YAAY,CAAC;QAClB,KAAK,6BAA6B,CAAC;QACnC,KAAK,0CAA0C;YAC7C,OAAO,yBAAiB,CAAC,OAAO,CAAA;QAClC,KAAK,cAAc;YACjB,OAAO,yBAAiB,CAAC,UAAU,CAAA;QACrC,KAAK,cAAc;YACjB,OAAO,yBAAiB,CAAC,UAAU,CAAA;QACrC,KAAK,SAAS;YACZ,OAAO,yBAAiB,CAAC,IAAI,CAAA;QAC/B,KAAK,QAAQ;YACX,OAAO,yBAAiB,CAAC,MAAM,CAAA;QACjC,KAAK,QAAQ;YACX,OAAO,yBAAiB,CAAC,MAAM,CAAA;QACjC,KAAK,KAAK;YACR,OAAO,yBAAiB,CAAC,GAAG,CAAA;QAC9B,KAAK,KAAK,CAAC;QACX,KAAK,iBAAiB;YACpB,OAAO,yBAAiB,CAAC,GAAG,CAAA;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C,UAAU,CAAC,EAAE;QACzB,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE;YAC3C,KAAK,MAAM,EAAE,IAAI,kBAAkB,EAAE;gBACnC,uDAAuD;gBACvD,IAAI,MAAA,OAAO,CAAC,SAAS,CAAC,0CAAG,EAAE,CAAC,EAAE;oBAC5B,KAAK,MAAM,CAAC,IAAI,IAAA,6BAAqB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;wBAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;qBACjB;iBACF;gBAED,8CAA8C;gBAC9C,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE;oBACzB,KAAK,MAAM,CAAC,IAAI,IAAA,6BAAqB,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE;wBAC5D,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;qBACjB;iBACF;aACF;SACF;KACF;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,yBAAyB,aAAa,YAAY,CAAC,CAAA;KAChE;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAhCY,QAAA,wBAAwB,4BAgCpC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { SpanTags } from '../../helpers/interfaces';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const generatePayload: (payloadData: SbomPayloadData, service: string, tags: SpanTags) => SBOMPayload;
|
|
2
|
+
import { ScaRequest } from './types';
|
|
3
|
+
export declare const generatePayload: (jsonContent: any, tags: SpanTags) => ScaRequest | undefined;
|
|
@@ -4,25 +4,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generatePayload = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
25
|
-
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const tags_1 = require("../../helpers/tags");
|
|
9
|
+
const language_1 = require("./language");
|
|
10
|
+
const license_1 = require("./license");
|
|
11
|
+
// Generate the payload we send to the API
|
|
12
|
+
// jsonContent is the SBOM file content read from disk
|
|
13
|
+
// tags are the list of tags we retrieved
|
|
14
|
+
const generatePayload = (jsonContent, tags) => {
|
|
15
|
+
if (!tags[tags_1.GIT_COMMIT_AUTHOR_EMAIL] ||
|
|
16
|
+
!tags[tags_1.GIT_COMMIT_AUTHOR_NAME] ||
|
|
17
|
+
!tags[tags_1.GIT_SHA] ||
|
|
18
|
+
!tags[tags_1.GIT_BRANCH] ||
|
|
19
|
+
!tags[tags_1.GIT_REPOSITORY_URL]) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const dependencies = [];
|
|
23
|
+
if (jsonContent) {
|
|
24
|
+
if (jsonContent['components']) {
|
|
25
|
+
for (const component of jsonContent['components']) {
|
|
26
|
+
if (!component['type'] || !component['name'] || !component['version']) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (component['type'] !== 'library') {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const lang = (0, language_1.getLanguageFromComponent)(component);
|
|
33
|
+
if (!lang) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const dependency = {
|
|
37
|
+
name: component['name'],
|
|
38
|
+
version: component['version'],
|
|
39
|
+
language: lang,
|
|
40
|
+
licenses: (0, license_1.getLicensesFromComponent)(component),
|
|
41
|
+
};
|
|
42
|
+
dependencies.push(dependency);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
id: crypto_1.default.randomUUID(),
|
|
48
|
+
commit: {
|
|
49
|
+
author_name: tags[tags_1.GIT_COMMIT_AUTHOR_NAME],
|
|
50
|
+
author_email: tags[tags_1.GIT_COMMIT_AUTHOR_EMAIL],
|
|
51
|
+
sha: tags[tags_1.GIT_SHA],
|
|
52
|
+
branch: tags[tags_1.GIT_BRANCH],
|
|
53
|
+
},
|
|
54
|
+
repository: {
|
|
55
|
+
url: tags[tags_1.GIT_REPOSITORY_URL],
|
|
56
|
+
},
|
|
57
|
+
tags,
|
|
58
|
+
dependencies,
|
|
59
|
+
};
|
|
26
60
|
};
|
|
27
61
|
exports.generatePayload = generatePayload;
|
|
28
62
|
//# sourceMappingURL=payload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../src/commands/sbom/payload.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../src/commands/sbom/payload.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAG3B,6CAM2B;AAE3B,yCAAmD;AACnD,uCAAkD;AAGlD,0CAA0C;AAC1C,sDAAsD;AACtD,yCAAyC;AAClC,MAAM,eAAe,GAAG,CAAC,WAAgB,EAAE,IAAc,EAA0B,EAAE;IAC1F,IACE,CAAC,IAAI,CAAC,8BAAuB,CAAC;QAC9B,CAAC,IAAI,CAAC,6BAAsB,CAAC;QAC7B,CAAC,IAAI,CAAC,cAAO,CAAC;QACd,CAAC,IAAI,CAAC,iBAAU,CAAC;QACjB,CAAC,IAAI,CAAC,yBAAkB,CAAC,EACzB;QACA,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,YAAY,GAAiB,EAAE,CAAA;IAErC,IAAI,WAAW,EAAE;QACf,IAAI,WAAW,CAAC,YAAY,CAAC,EAAE;YAC7B,KAAK,MAAM,SA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
6
|
+
RUBY = "ruby",
|
|
7
|
+
GO = "go",
|
|
8
|
+
JVM = "jvm"
|
|
9
|
+
}
|
|
10
|
+
export declare enum DependencyLicense {
|
|
11
|
+
AFL3 = "AFL-3.0",
|
|
12
|
+
APACHE2 = "Apache-2.0",
|
|
13
|
+
ARTISTIC2 = "Artistic-2.0",
|
|
14
|
+
BSL1 = "BSL-1.0",
|
|
15
|
+
BSD2CLAUSE = "BSD-2-Clause",
|
|
16
|
+
BSD3CLAUSE = "BSD-3-Clause",
|
|
17
|
+
BSD3CLAUSECLEAR = "BSD-3-Clause-Clear",
|
|
18
|
+
BSD4CLAUSE = "BSD-4-Clause",
|
|
19
|
+
ZEROBSD = "0BSD",
|
|
20
|
+
CC = "CC",
|
|
21
|
+
CC0_1_0 = "CC0-1.0",
|
|
22
|
+
CC_BY_4_0 = "CC-BY-4.0",
|
|
23
|
+
CC_BY_SA_4_0 = "CC-BY-SA-4.0",
|
|
24
|
+
WTFPL = "WTFPL",
|
|
25
|
+
ECL2_0 = "ECL-2.0",
|
|
26
|
+
EPL1_0 = "EPL-1.0",
|
|
27
|
+
EPL2_0 = "EPL-2.0",
|
|
28
|
+
EUPL1_1 = "EUPL-1.1",
|
|
29
|
+
AGPL3_0 = "AGPL-3.0",
|
|
30
|
+
GPL = "GPL",
|
|
31
|
+
GPL2_0 = "GPL-2.0",
|
|
32
|
+
GPL3_0 = "GPL-3.0",
|
|
33
|
+
LGPL = "LGPL",
|
|
34
|
+
LGPL2_1 = "LGPL-2.1",
|
|
35
|
+
LGPL3_0 = "LGPL-3.0",
|
|
36
|
+
ISC = "ISC",
|
|
37
|
+
LPPL_1_3C = "LPPL-1.3c",
|
|
38
|
+
MS_PL = "MS-PL",
|
|
39
|
+
MIT = "MIT",
|
|
40
|
+
MPL_2_0 = "MPL-2.0",
|
|
41
|
+
OSL_3_0 = "OSL-3.0",
|
|
42
|
+
POSTGRESQL = "PostgreSQL",
|
|
43
|
+
OFL_1_1 = "OFL-1.1",
|
|
44
|
+
NCSA = "NCSA",
|
|
45
|
+
UNLICENSE = "Unlicense",
|
|
46
|
+
ZLIB = "Zlib"
|
|
47
|
+
}
|
|
48
|
+
export interface Dependency {
|
|
49
|
+
name: string;
|
|
50
|
+
version: string;
|
|
51
|
+
language: DependencyLanguage;
|
|
52
|
+
licenses: DependencyLicense[];
|
|
53
|
+
}
|
|
54
|
+
export interface CommitInformation {
|
|
55
|
+
author_name: string;
|
|
56
|
+
author_email: string;
|
|
57
|
+
sha: string;
|
|
58
|
+
branch: string;
|
|
59
|
+
}
|
|
60
|
+
export interface RepositoryInformation {
|
|
61
|
+
url: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ScaRequest {
|
|
64
|
+
id: string;
|
|
65
|
+
commit: CommitInformation;
|
|
66
|
+
repository: RepositoryInformation;
|
|
67
|
+
dependencies: Dependency[];
|
|
68
|
+
tags: Record<string, string>;
|
|
4
69
|
}
|
|
@@ -1,3 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DependencyLicense = exports.DependencyLanguage = void 0;
|
|
4
|
+
var DependencyLanguage;
|
|
5
|
+
(function (DependencyLanguage) {
|
|
6
|
+
DependencyLanguage["NPM"] = "node";
|
|
7
|
+
DependencyLanguage["PYPI"] = "pypi";
|
|
8
|
+
DependencyLanguage["PHP"] = "php";
|
|
9
|
+
DependencyLanguage["RUST"] = "rust";
|
|
10
|
+
DependencyLanguage["RUBY"] = "ruby";
|
|
11
|
+
DependencyLanguage["GO"] = "go";
|
|
12
|
+
DependencyLanguage["JVM"] = "jvm";
|
|
13
|
+
})(DependencyLanguage || (exports.DependencyLanguage = DependencyLanguage = {}));
|
|
14
|
+
// List from https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository
|
|
15
|
+
var DependencyLicense;
|
|
16
|
+
(function (DependencyLicense) {
|
|
17
|
+
DependencyLicense["AFL3"] = "AFL-3.0";
|
|
18
|
+
DependencyLicense["APACHE2"] = "Apache-2.0";
|
|
19
|
+
DependencyLicense["ARTISTIC2"] = "Artistic-2.0";
|
|
20
|
+
DependencyLicense["BSL1"] = "BSL-1.0";
|
|
21
|
+
DependencyLicense["BSD2CLAUSE"] = "BSD-2-Clause";
|
|
22
|
+
DependencyLicense["BSD3CLAUSE"] = "BSD-3-Clause";
|
|
23
|
+
DependencyLicense["BSD3CLAUSECLEAR"] = "BSD-3-Clause-Clear";
|
|
24
|
+
DependencyLicense["BSD4CLAUSE"] = "BSD-4-Clause";
|
|
25
|
+
DependencyLicense["ZEROBSD"] = "0BSD";
|
|
26
|
+
DependencyLicense["CC"] = "CC";
|
|
27
|
+
DependencyLicense["CC0_1_0"] = "CC0-1.0";
|
|
28
|
+
DependencyLicense["CC_BY_4_0"] = "CC-BY-4.0";
|
|
29
|
+
DependencyLicense["CC_BY_SA_4_0"] = "CC-BY-SA-4.0";
|
|
30
|
+
DependencyLicense["WTFPL"] = "WTFPL";
|
|
31
|
+
DependencyLicense["ECL2_0"] = "ECL-2.0";
|
|
32
|
+
DependencyLicense["EPL1_0"] = "EPL-1.0";
|
|
33
|
+
DependencyLicense["EPL2_0"] = "EPL-2.0";
|
|
34
|
+
DependencyLicense["EUPL1_1"] = "EUPL-1.1";
|
|
35
|
+
DependencyLicense["AGPL3_0"] = "AGPL-3.0";
|
|
36
|
+
DependencyLicense["GPL"] = "GPL";
|
|
37
|
+
DependencyLicense["GPL2_0"] = "GPL-2.0";
|
|
38
|
+
DependencyLicense["GPL3_0"] = "GPL-3.0";
|
|
39
|
+
DependencyLicense["LGPL"] = "LGPL";
|
|
40
|
+
DependencyLicense["LGPL2_1"] = "LGPL-2.1";
|
|
41
|
+
DependencyLicense["LGPL3_0"] = "LGPL-3.0";
|
|
42
|
+
DependencyLicense["ISC"] = "ISC";
|
|
43
|
+
DependencyLicense["LPPL_1_3C"] = "LPPL-1.3c";
|
|
44
|
+
DependencyLicense["MS_PL"] = "MS-PL";
|
|
45
|
+
DependencyLicense["MIT"] = "MIT";
|
|
46
|
+
DependencyLicense["MPL_2_0"] = "MPL-2.0";
|
|
47
|
+
DependencyLicense["OSL_3_0"] = "OSL-3.0";
|
|
48
|
+
DependencyLicense["POSTGRESQL"] = "PostgreSQL";
|
|
49
|
+
DependencyLicense["OFL_1_1"] = "OFL-1.1";
|
|
50
|
+
DependencyLicense["NCSA"] = "NCSA";
|
|
51
|
+
DependencyLicense["UNLICENSE"] = "Unlicense";
|
|
52
|
+
DependencyLicense["ZLIB"] = "Zlib";
|
|
53
|
+
})(DependencyLicense || (exports.DependencyLicense = DependencyLicense = {}));
|
|
3
54
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/sbom/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/sbom/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,kCAAY,CAAA;IACZ,mCAAa,CAAA;IACb,iCAAW,CAAA;IACX,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,+BAAS,CAAA;IACT,iCAAW,CAAA;AACb,CAAC,EARW,kBAAkB,kCAAlB,kBAAkB,QAQ7B;AAED,uJAAuJ;AACvJ,IAAY,iBAqCX;AArCD,WAAY,iBAAiB;IAC3B,qCAAgB,CAAA;IAChB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,qCAAgB,CAAA;IAChB,gDAA2B,CAAA;IAC3B,gDAA2B,CAAA;IAC3B,2DAAsC,CAAA;IACtC,gDAA2B,CAAA;IAC3B,qCAAgB,CAAA;IAChB,8BAAS,CAAA;IACT,wCAAmB,CAAA;IACnB,4CAAuB,CAAA;IACvB,kDAA6B,CAAA;IAC7B,oCAAe,CAAA;IACf,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,yCAAoB,CAAA;IACpB,gCAAW,CAAA;IACX,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,kCAAa,CAAA;IACb,yCAAoB,CAAA;IACpB,yCAAoB,CAAA;IACpB,gCAAW,CAAA;IACX,4CAAuB,CAAA;IACvB,oCAAe,CAAA;IACf,gCAAW,CAAA;IACX,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;IACnB,8CAAyB,CAAA;IACzB,wCAAmB,CAAA;IACnB,kCAAa,CAAA;IACb,4CAAuB,CAAA;IACvB,kCAAa,CAAA;AACf,CAAC,EArCW,iBAAiB,iCAAjB,iBAAiB,QAqC5B"}
|
|
@@ -20,7 +20,6 @@ const clipanion_1 = require("clipanion");
|
|
|
20
20
|
const tags_1 = require("../../helpers/tags");
|
|
21
21
|
const api_1 = require("./api");
|
|
22
22
|
const payload_1 = require("./payload");
|
|
23
|
-
const sbom_intake_1 = require("./protobuf/sbom_intake");
|
|
24
23
|
const validation_1 = require("./validation");
|
|
25
24
|
class UploadSbomCommand extends clipanion_1.Command {
|
|
26
25
|
constructor() {
|
|
@@ -32,6 +31,7 @@ class UploadSbomCommand extends clipanion_1.Command {
|
|
|
32
31
|
this.debug = clipanion_1.Option.Boolean('--debug');
|
|
33
32
|
this.config = {
|
|
34
33
|
apiKey: process_1.default.env.DATADOG_API_KEY || process_1.default.env.DD_API_KEY,
|
|
34
|
+
appKey: process_1.default.env.DATADOG_APP_KEY || process_1.default.env.DD_APP_KEY || '',
|
|
35
35
|
env: process_1.default.env.DD_ENV,
|
|
36
36
|
envVarTags: process_1.default.env.DD_TAGS,
|
|
37
37
|
};
|
|
@@ -60,33 +60,32 @@ class UploadSbomCommand extends clipanion_1.Command {
|
|
|
60
60
|
this.context.stderr.write('API key not defined\n');
|
|
61
61
|
return 1;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
const
|
|
63
|
+
// Get the API helper to send the payload
|
|
64
|
+
const api = (0, api_1.getApiHelper)(this.config.apiKey, this.config.appKey);
|
|
65
|
+
const tags = yield (0, tags_1.getSpanTags)(this.config, this.tags);
|
|
65
66
|
const validator = (0, validation_1.getValidator)();
|
|
66
67
|
for (const basePath of this.basePaths) {
|
|
67
68
|
if (this.debug) {
|
|
68
69
|
this.context.stdout.write(`Processing file ${basePath}\n`);
|
|
69
70
|
}
|
|
70
71
|
if ((0, validation_1.validateSbomFile)(basePath, validator, !!this.debug)) {
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
filePath: basePath,
|
|
74
|
-
content: JSON.parse(fs_1.default.readFileSync(basePath).toString('utf8')),
|
|
75
|
-
};
|
|
76
|
-
// If debug mode is activated, we write the payload in a file
|
|
77
|
-
if (this.debug) {
|
|
78
|
-
const debugFilePath = `${basePath}.payload.pbytes`;
|
|
79
|
-
this.context.stdout.write(`Writing payload for debugging in: ${debugFilePath}\n`);
|
|
80
|
-
const payloadBytes = sbom_intake_1.SBOMPayload.toJSON((0, payload_1.generatePayload)(payloadData, service, spanTags));
|
|
81
|
-
fs_1.default.writeFileSync(debugFilePath, JSON.stringify(payloadBytes));
|
|
82
|
-
}
|
|
72
|
+
const filePath = basePath;
|
|
73
|
+
const jsonContent = JSON.parse(fs_1.default.readFileSync(basePath).toString('utf8'));
|
|
83
74
|
// Upload content
|
|
84
75
|
try {
|
|
85
|
-
const
|
|
76
|
+
const scaPayload = (0, payload_1.generatePayload)(jsonContent, tags);
|
|
77
|
+
if (!scaPayload) {
|
|
78
|
+
console.log(`Cannot generate payload for file ${filePath}`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const startTimeMs = Date.now();
|
|
82
|
+
const response = yield api(scaPayload);
|
|
83
|
+
const endTimeMs = Date.now();
|
|
86
84
|
if (this.debug) {
|
|
87
85
|
this.context.stdout.write(`Upload done, status: ${response.status}\n`);
|
|
88
86
|
}
|
|
89
|
-
|
|
87
|
+
const apiTimeMs = endTimeMs - startTimeMs;
|
|
88
|
+
this.context.stdout.write(`File ${basePath} successfully uploaded in ${apiTimeMs} ms\n`);
|
|
90
89
|
}
|
|
91
90
|
catch (error) {
|
|
92
91
|
process_1.default.stderr.write(`Error while writing the payload: ${error.message}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/sbom/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,sDAA6B;AAI7B,kDAAyB;AACzB,yCAAyC;AAEzC,6CAA8C;AAE9C,+BAAkC;AAClC,uCAAyC;
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/sbom/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,sDAA6B;AAI7B,kDAAyB;AACzB,yCAAyC;AAEzC,6CAA8C;AAE9C,+BAAkC;AAClC,uCAAyC;AAEzC,6CAA2D;AAE3D,MAAa,iBAAkB,SAAQ,mBAAO;IAA9C;;QAWU,cAAS,GAAG,kBAAM,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAE,CAAC,EAAC,CAAC,CAAA;QACtC,YAAO,GAAG,kBAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACpC,QAAG,GAAG,kBAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC5B,SAAI,GAAG,kBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC7B,UAAK,GAAG,kBAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAEjC,WAAM,GAAG;YACf,MAAM,EAAE,iBAAO,CAAC,GAAG,CAAC,eAAe,IAAI,iBAAO,CAAC,GAAG,CAAC,UAAU;YAC7D,MAAM,EAAE,iBAAO,CAAC,GAAG,CAAC,eAAe,IAAI,iBAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE;YACnE,GAAG,EAAE,iBAAO,CAAC,GAAG,CAAC,MAAM;YACvB,UAAU,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O,IAAI,CAAC,CAAA;wBAC3E,IAAI,KAAK,CAAC,QAAQ,EAAE;4BAClB,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAA;yBAC/D;qBACF;iBACF;qBAAM;oBACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAA;iBAC1F;aACF;YAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;YAE9C,OAAO,CAAC,CAAA;QACV,CAAC;KAAA;;AA1GH,8CA2GC;AA1Ge,uBAAK,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,AAAvB,CAAuB;AAE5B,uBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,WAAW,EAAE,+BAA+B;IAC5C,OAAO,EAAE;;KAER;IACD,QAAQ,EAAE,CAAC,CAAC,gCAAgC,EAAE,uDAAuD,CAAC,CAAC;CACxG,CAAC,AANiB,CAMjB"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const DATADOG_SITE_GOV = "ddog-gov.com";
|
|
|
7
7
|
export declare const DATADOG_SITES: string[];
|
|
8
8
|
export declare const CONTENT_TYPE_HEADER = "Content-Type";
|
|
9
9
|
export declare const CONTENT_TYPE_VALUE_PROTOBUF = "application/x-protobuf";
|
|
10
|
+
export declare const CONTENT_TYPE_VALUE_JSON = "application/json";
|
|
10
11
|
export declare const METHOD_POST = "post";
|
|
11
12
|
export declare const SERVICE_ENV_VAR = "DD_SERVICE";
|
|
12
13
|
export declare const ENVIRONMENT_ENV_VAR = "DD_ENV";
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FLARE_PROJECT_FILES = exports.FLARE_ENDPOINT_PATH = exports.INSIGHTS_FILE_NAME = exports.ADDITIONAL_FILES_DIRECTORY = exports.PROJECT_FILES_DIRECTORY = exports.LOGS_DIRECTORY = exports.FLARE_OUTPUT_DIRECTORY = exports.SITE_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.API_KEY_ENV_VAR = exports.VERSION_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.SERVICE_ENV_VAR = exports.METHOD_POST = exports.CONTENT_TYPE_VALUE_PROTOBUF = exports.CONTENT_TYPE_HEADER = exports.DATADOG_SITES = exports.DATADOG_SITE_GOV = exports.DATADOG_SITE_AP1 = exports.DATADOG_SITE_US5 = exports.DATADOG_SITE_US3 = exports.DATADOG_SITE_EU1 = exports.DATADOG_SITE_US1 = void 0;
|
|
3
|
+
exports.FLARE_PROJECT_FILES = exports.FLARE_ENDPOINT_PATH = exports.INSIGHTS_FILE_NAME = exports.ADDITIONAL_FILES_DIRECTORY = exports.PROJECT_FILES_DIRECTORY = exports.LOGS_DIRECTORY = exports.FLARE_OUTPUT_DIRECTORY = exports.SITE_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.API_KEY_ENV_VAR = exports.VERSION_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.SERVICE_ENV_VAR = exports.METHOD_POST = exports.CONTENT_TYPE_VALUE_JSON = exports.CONTENT_TYPE_VALUE_PROTOBUF = exports.CONTENT_TYPE_HEADER = exports.DATADOG_SITES = exports.DATADOG_SITE_GOV = exports.DATADOG_SITE_AP1 = exports.DATADOG_SITE_US5 = exports.DATADOG_SITE_US3 = exports.DATADOG_SITE_EU1 = exports.DATADOG_SITE_US1 = void 0;
|
|
4
4
|
exports.DATADOG_SITE_US1 = 'datadoghq.com';
|
|
5
5
|
exports.DATADOG_SITE_EU1 = 'datadoghq.eu';
|
|
6
6
|
exports.DATADOG_SITE_US3 = 'us3.datadoghq.com';
|
|
@@ -17,6 +17,7 @@ exports.DATADOG_SITES = [
|
|
|
17
17
|
];
|
|
18
18
|
exports.CONTENT_TYPE_HEADER = 'Content-Type';
|
|
19
19
|
exports.CONTENT_TYPE_VALUE_PROTOBUF = 'application/x-protobuf';
|
|
20
|
+
exports.CONTENT_TYPE_VALUE_JSON = 'application/json';
|
|
20
21
|
exports.METHOD_POST = 'post';
|
|
21
22
|
// Tagging env vars
|
|
22
23
|
exports.SERVICE_ENV_VAR = 'DD_SERVICE';
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,eAAe,CAAA;AAClC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AACjC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AAEjC,QAAA,aAAa,GAAa;IACrC,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;CACjB,CAAA;AAEY,QAAA,mBAAmB,GAAG,cAAc,CAAA;AACpC,QAAA,2BAA2B,GAAG,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,eAAe,CAAA;AAClC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AACjC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AAEjC,QAA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BAAkB;IAClB,aAAa;IACb,SAAS;IACT,YAAY;IACZ,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,mBAAmB;CACpB,CAAA"}
|
package/dist/helpers/ci.js
CHANGED
|
@@ -50,6 +50,7 @@ const resolveTilde = (filePath) => {
|
|
|
50
50
|
return filePath;
|
|
51
51
|
};
|
|
52
52
|
const getCISpanTags = () => {
|
|
53
|
+
var _a;
|
|
53
54
|
const env = process.env;
|
|
54
55
|
let tags = {};
|
|
55
56
|
if (env.CIRCLECI) {
|
|
@@ -355,6 +356,14 @@ const getCISpanTags = () => {
|
|
|
355
356
|
const ref = (0, utils_1.normalizeRef)(CF_BRANCH);
|
|
356
357
|
tags[refKey] = ref;
|
|
357
358
|
}
|
|
359
|
+
if ((_a = env.CODEBUILD_INITIATOR) === null || _a === void 0 ? void 0 : _a.startsWith('codepipeline')) {
|
|
360
|
+
const { CODEBUILD_BUILD_ARN, DD_ACTION_EXECUTION_ID, DD_PIPELINE_EXECUTION_ID } = env;
|
|
361
|
+
tags = {
|
|
362
|
+
[tags_1.CI_PROVIDER_NAME]: 'awscodepipeline',
|
|
363
|
+
[tags_1.CI_PIPELINE_ID]: DD_PIPELINE_EXECUTION_ID,
|
|
364
|
+
[tags_1.CI_ENV_VARS]: JSON.stringify({ CODEBUILD_BUILD_ARN, DD_PIPELINE_EXECUTION_ID, DD_ACTION_EXECUTION_ID }),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
358
367
|
if (tags[tags_1.CI_WORKSPACE_PATH]) {
|
|
359
368
|
tags[tags_1.CI_WORKSPACE_PATH] = resolveTilde(tags[tags_1.CI_WORKSPACE_PATH]);
|
|
360
369
|
}
|