@datadog/datadog-ci-base 4.1.2 → 4.2.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/cli.d.ts +1 -0
- package/dist/cli.js +24 -22
- package/dist/cli.js.map +1 -1
- package/dist/commands/aas/common.d.ts +0 -8
- package/dist/commands/aas/common.js +7 -13
- package/dist/commands/aas/common.js.map +1 -1
- package/dist/commands/cloud-run/constants.d.ts +0 -2
- package/dist/commands/cloud-run/constants.js +4 -5
- package/dist/commands/cloud-run/constants.js.map +1 -1
- package/dist/commands/cloud-run/instrument.js +5 -7
- package/dist/commands/cloud-run/instrument.js.map +1 -1
- package/dist/commands/cloud-run/uninstrument.js +1 -1
- package/dist/commands/cloud-run/uninstrument.js.map +1 -1
- package/dist/commands/container-app/cli.d.ts +3 -0
- package/dist/commands/container-app/cli.js +12 -0
- package/dist/commands/container-app/cli.js.map +1 -0
- package/dist/commands/container-app/common.d.ts +42 -0
- package/dist/commands/container-app/common.js +127 -0
- package/dist/commands/container-app/common.js.map +1 -0
- package/dist/commands/container-app/instrument.d.ts +17 -0
- package/dist/commands/container-app/instrument.js +77 -0
- package/dist/commands/container-app/instrument.js.map +1 -0
- package/dist/commands/container-app/uninstrument.d.ts +10 -0
- package/dist/commands/container-app/uninstrument.js +59 -0
- package/dist/commands/container-app/uninstrument.js.map +1 -0
- package/dist/constants.d.ts +0 -25
- package/dist/constants.js +1 -79
- package/dist/constants.js.map +1 -1
- package/dist/helpers/serverless/azure.d.ts +24 -0
- package/dist/helpers/serverless/azure.js +55 -0
- package/dist/helpers/serverless/azure.js.map +1 -0
- package/dist/helpers/serverless/common.d.ts +75 -0
- package/dist/helpers/serverless/common.js +207 -0
- package/dist/helpers/serverless/common.js.map +1 -0
- package/dist/helpers/serverless/constants.d.ts +40 -0
- package/dist/helpers/serverless/constants.js +96 -0
- package/dist/helpers/serverless/constants.js.map +1 -0
- package/dist/helpers/{flare.js → serverless/flare.js} +8 -7
- package/dist/helpers/serverless/flare.js.map +1 -0
- package/dist/helpers/serverless/source-code-integration.js.map +1 -0
- package/package.json +16 -11
- package/dist/helpers/flare.js.map +0 -1
- package/dist/helpers/git/source-code-integration.js.map +0 -1
- /package/dist/helpers/{flare.d.ts → serverless/flare.d.ts} +0 -0
- /package/dist/helpers/{git → serverless}/source-code-integration.d.ts +0 -0
- /package/dist/helpers/{git → serverless}/source-code-integration.js +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
exports.ContainerAppUninstrumentCommand = void 0;
|
|
13
|
+
const clipanion_1 = require("clipanion");
|
|
14
|
+
const plugin_1 = require("../../helpers/plugin");
|
|
15
|
+
const constants_1 = require("../../helpers/serverless/constants");
|
|
16
|
+
const common_1 = require("./common");
|
|
17
|
+
class ContainerAppUninstrumentCommand extends common_1.ContainerAppCommand {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.sidecarName = clipanion_1.Option.String('--sidecar-name', constants_1.DEFAULT_SIDECAR_NAME, {
|
|
21
|
+
description: `The name of the sidecar container to remove. Specify if you have a different sidecar name. Defaults to '${constants_1.DEFAULT_SIDECAR_NAME}'`,
|
|
22
|
+
});
|
|
23
|
+
this.sharedVolumeName = clipanion_1.Option.String('--shared-volume-name', constants_1.DEFAULT_VOLUME_NAME, {
|
|
24
|
+
description: `The name of the shared volume to remove. Specify if you have a different shared volume name. Defaults to '${constants_1.DEFAULT_VOLUME_NAME}'`,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get additionalConfig() {
|
|
28
|
+
return {
|
|
29
|
+
sidecarName: this.sidecarName,
|
|
30
|
+
sharedVolumeName: this.sharedVolumeName,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
ensureConfig() {
|
|
34
|
+
const _super = Object.create(null, {
|
|
35
|
+
ensureConfig: { get: () => super.ensureConfig }
|
|
36
|
+
});
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const [containerApps, config, errors] = yield _super.ensureConfig.call(this);
|
|
39
|
+
// Remove errors that are specific to instrumentation
|
|
40
|
+
const filteredErrors = errors.filter((error) => !error.includes('DD_API_KEY') &&
|
|
41
|
+
!error.includes('logsPath') &&
|
|
42
|
+
!error.includes('sharedVolumePath') &&
|
|
43
|
+
!error.includes('Extra tags'));
|
|
44
|
+
return [containerApps, config, filteredErrors];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
execute() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return (0, plugin_1.executePluginCommand)(this);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ContainerAppUninstrumentCommand = ContainerAppUninstrumentCommand;
|
|
54
|
+
ContainerAppUninstrumentCommand.paths = [['container-app', 'uninstrument']];
|
|
55
|
+
ContainerAppUninstrumentCommand.usage = clipanion_1.Command.Usage({
|
|
56
|
+
category: 'Serverless',
|
|
57
|
+
description: 'Revert Datadog instrumentation in an Azure Container App.',
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=uninstrument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstrument.js","sourceRoot":"","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tC,CAAsC;AAC3C,qCAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,2DAA2D;CACzE,CAAC,AAHiB,CAGjB"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -12,28 +12,3 @@ export declare const CONTENT_TYPE_HEADER = "Content-Type";
|
|
|
12
12
|
export declare const CONTENT_TYPE_VALUE_PROTOBUF = "application/x-protobuf";
|
|
13
13
|
export declare const CONTENT_TYPE_VALUE_JSON = "application/json";
|
|
14
14
|
export declare const METHOD_POST = "post";
|
|
15
|
-
export declare const SERVICE_ENV_VAR = "DD_SERVICE";
|
|
16
|
-
export declare const ENVIRONMENT_ENV_VAR = "DD_ENV";
|
|
17
|
-
export declare const VERSION_ENV_VAR = "DD_VERSION";
|
|
18
|
-
export declare const API_KEY_ENV_VAR = "DD_API_KEY";
|
|
19
|
-
export declare const CI_API_KEY_ENV_VAR = "DATADOG_API_KEY";
|
|
20
|
-
export declare const CI_SITE_ENV_VAR = "DATADOG_SITE";
|
|
21
|
-
export declare const SITE_ENV_VAR = "DD_SITE";
|
|
22
|
-
export declare const LOGS_INJECTION_ENV_VAR = "DD_LOGS_INJECTION";
|
|
23
|
-
export declare const LOGS_PATH_ENV_VAR = "DD_SERVERLESS_LOG_PATH";
|
|
24
|
-
export declare const HEALTH_PORT_ENV_VAR = "DD_HEALTH_PORT";
|
|
25
|
-
export declare const DD_LOG_LEVEL_ENV_VAR = "DD_LOG_LEVEL";
|
|
26
|
-
export declare const DD_TRACE_ENABLED_ENV_VAR = "DD_TRACE_ENABLED";
|
|
27
|
-
export declare const DD_LLMOBS_ENABLED_ENV_VAR = "DD_LLMOBS_ENABLED";
|
|
28
|
-
export declare const DD_LLMOBS_ML_APP_ENV_VAR = "DD_LLMOBS_ML_APP";
|
|
29
|
-
export declare const DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR = "DD_LLMOBS_AGENTLESS_ENABLED";
|
|
30
|
-
export declare const DD_TAGS_ENV_VAR = "DD_TAGS";
|
|
31
|
-
export declare const DD_SOURCE_ENV_VAR = "DD_SOURCE";
|
|
32
|
-
export declare const EXTRA_TAGS_REG_EXP: RegExp;
|
|
33
|
-
export declare const FLARE_OUTPUT_DIRECTORY = ".datadog-ci";
|
|
34
|
-
export declare const LOGS_DIRECTORY = "logs";
|
|
35
|
-
export declare const PROJECT_FILES_DIRECTORY = "project_files";
|
|
36
|
-
export declare const ADDITIONAL_FILES_DIRECTORY = "additional_files";
|
|
37
|
-
export declare const INSIGHTS_FILE_NAME = "INSIGHTS.md";
|
|
38
|
-
export declare const FLARE_ENDPOINT_PATH = "/api/ui/support/serverless/flare";
|
|
39
|
-
export declare const FLARE_PROJECT_FILES: string[];
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.METHOD_POST = exports.CONTENT_TYPE_VALUE_JSON = exports.CONTENT_TYPE_VALUE_PROTOBUF = exports.CONTENT_TYPE_HEADER = exports.FIPS_IGNORE_ERROR_ENV_VAR = exports.FIPS_ENV_VAR = exports.DATADOG_SITES = exports.DATADOG_SITE_GOV = exports.DATADOG_SITE_AP2 = 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';
|
|
@@ -24,82 +24,4 @@ exports.CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
24
24
|
exports.CONTENT_TYPE_VALUE_PROTOBUF = 'application/x-protobuf';
|
|
25
25
|
exports.CONTENT_TYPE_VALUE_JSON = 'application/json';
|
|
26
26
|
exports.METHOD_POST = 'post';
|
|
27
|
-
// Tagging env vars
|
|
28
|
-
exports.SERVICE_ENV_VAR = 'DD_SERVICE';
|
|
29
|
-
exports.ENVIRONMENT_ENV_VAR = 'DD_ENV';
|
|
30
|
-
exports.VERSION_ENV_VAR = 'DD_VERSION';
|
|
31
|
-
// Environment variables for Lambda and Cloud Run
|
|
32
|
-
exports.API_KEY_ENV_VAR = 'DD_API_KEY';
|
|
33
|
-
exports.CI_API_KEY_ENV_VAR = 'DATADOG_API_KEY';
|
|
34
|
-
exports.CI_SITE_ENV_VAR = 'DATADOG_SITE';
|
|
35
|
-
exports.SITE_ENV_VAR = 'DD_SITE';
|
|
36
|
-
exports.LOGS_INJECTION_ENV_VAR = 'DD_LOGS_INJECTION';
|
|
37
|
-
exports.LOGS_PATH_ENV_VAR = 'DD_SERVERLESS_LOG_PATH';
|
|
38
|
-
exports.HEALTH_PORT_ENV_VAR = 'DD_HEALTH_PORT';
|
|
39
|
-
exports.DD_LOG_LEVEL_ENV_VAR = 'DD_LOG_LEVEL';
|
|
40
|
-
exports.DD_TRACE_ENABLED_ENV_VAR = 'DD_TRACE_ENABLED';
|
|
41
|
-
exports.DD_LLMOBS_ENABLED_ENV_VAR = 'DD_LLMOBS_ENABLED';
|
|
42
|
-
exports.DD_LLMOBS_ML_APP_ENV_VAR = 'DD_LLMOBS_ML_APP';
|
|
43
|
-
exports.DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR = 'DD_LLMOBS_AGENTLESS_ENABLED';
|
|
44
|
-
exports.DD_TAGS_ENV_VAR = 'DD_TAGS';
|
|
45
|
-
exports.DD_SOURCE_ENV_VAR = 'DD_SOURCE';
|
|
46
|
-
/*
|
|
47
|
-
* DD_TAGS Regular Expression
|
|
48
|
-
* This RegExp ensures that the --extra-tags string
|
|
49
|
-
* matches a list of <key>:<value> separated by commas
|
|
50
|
-
* such as layer:api,team:intake
|
|
51
|
-
*/
|
|
52
|
-
exports.EXTRA_TAGS_REG_EXP = /^(([a-zA-Z]+)[\w\-/.]*:[^,]+)+((,)([a-zA-Z]+)[\w\-/.]*:[^,]+)*$/g;
|
|
53
|
-
// Flare constants
|
|
54
|
-
exports.FLARE_OUTPUT_DIRECTORY = '.datadog-ci';
|
|
55
|
-
exports.LOGS_DIRECTORY = 'logs';
|
|
56
|
-
exports.PROJECT_FILES_DIRECTORY = 'project_files';
|
|
57
|
-
exports.ADDITIONAL_FILES_DIRECTORY = 'additional_files';
|
|
58
|
-
exports.INSIGHTS_FILE_NAME = 'INSIGHTS.md';
|
|
59
|
-
exports.FLARE_ENDPOINT_PATH = '/api/ui/support/serverless/flare';
|
|
60
|
-
// Project files to search for in Flare
|
|
61
|
-
exports.FLARE_PROJECT_FILES = [
|
|
62
|
-
// Datadog CloudFormation Template
|
|
63
|
-
'datadog-cloudfomation-macro.yaml',
|
|
64
|
-
'datadog-cloudfomation-macro.yml',
|
|
65
|
-
'datadog-cloudformation-macro.json',
|
|
66
|
-
// Node.js
|
|
67
|
-
'package.json',
|
|
68
|
-
'package-lock.json',
|
|
69
|
-
'yarn.lock',
|
|
70
|
-
'.nvmrc',
|
|
71
|
-
// Python
|
|
72
|
-
'requirements.txt',
|
|
73
|
-
'Pipfile',
|
|
74
|
-
'Pipfile.lock',
|
|
75
|
-
'pyproject.toml',
|
|
76
|
-
// Java
|
|
77
|
-
'pom.xml',
|
|
78
|
-
'build.gradle',
|
|
79
|
-
'gradlew',
|
|
80
|
-
'gradlew.bat',
|
|
81
|
-
// Go
|
|
82
|
-
'Makefile',
|
|
83
|
-
'go.mod',
|
|
84
|
-
'go.sum',
|
|
85
|
-
'Gopkg.toml',
|
|
86
|
-
'gomod.sh',
|
|
87
|
-
// Ruby
|
|
88
|
-
'Gemfile',
|
|
89
|
-
'Gemfile.lock',
|
|
90
|
-
// .NET
|
|
91
|
-
'project.json',
|
|
92
|
-
'packages.config',
|
|
93
|
-
'PackageReference',
|
|
94
|
-
'global.json',
|
|
95
|
-
// Docker
|
|
96
|
-
'Dockerfile',
|
|
97
|
-
'docker-compose.yaml',
|
|
98
|
-
'docker-compose.yml',
|
|
99
|
-
// Webpack, bundlers
|
|
100
|
-
'webpack.config.js',
|
|
101
|
-
'.babelrc',
|
|
102
|
-
'tsconfig.json',
|
|
103
|
-
'esbuild.config.js',
|
|
104
|
-
];
|
|
105
27
|
//# sourceMappingURL=constants.js.map
|
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,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AAEjC,QAAA,aAAa,GAAa;IACrC,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;CACjB,CAAA;AAED,kBAAkB;AACL,QAAA,YAAY,GAAG,cAAc,CAAA;AAC7B,QAAA,yBAAyB,GAAG,2BAA2B,CAAA;AAEvD,QAAA,mBAAmB,GAAG,cAAc,CAAA;AACpC,QAAA,2BAA2B,GAAG,wBAAwB,CAAA;AACtD,QAAA,uBAAuB,GAAG,kBAAkB,CAAA;AAE5C,QAAA,WAAW,GAAG,MAAM,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,mBAAmB,CAAA;AACtC,QAAA,gBAAgB,GAAG,cAAc,CAAA;AAEjC,QAAA,aAAa,GAAa;IACrC,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;IAChB,wBAAgB;CACjB,CAAA;AAED,kBAAkB;AACL,QAAA,YAAY,GAAG,cAAc,CAAA;AAC7B,QAAA,yBAAyB,GAAG,2BAA2B,CAAA;AAEvD,QAAA,mBAAmB,GAAG,cAAc,CAAA;AACpC,QAAA,2BAA2B,GAAG,wBAAwB,CAAA;AACtD,QAAA,uBAAuB,GAAG,kBAAkB,CAAA;AAE5C,QAAA,WAAW,GAAG,MAAM,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface Resource {
|
|
2
|
+
subscriptionId: string;
|
|
3
|
+
resourceGroup: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const parseResourceId: (resourceId: string) => Resource | undefined;
|
|
7
|
+
interface AzureCredential {
|
|
8
|
+
getToken(scopes: string | string[]): Promise<{
|
|
9
|
+
token: string;
|
|
10
|
+
} | null>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Ensures Azure authentication is working by attempting to get a token.
|
|
14
|
+
* @param print - Function to print messages
|
|
15
|
+
* @param cred - Azure credential object with getToken method
|
|
16
|
+
* @returns true if authentication succeeds, false otherwise
|
|
17
|
+
*/
|
|
18
|
+
export declare const ensureAzureAuth: (print: (arg: string) => void, cred: AzureCredential) => Promise<boolean>; /**
|
|
19
|
+
* Formats an error (usually an Azure RestError) object into a string for display.
|
|
20
|
+
* @param error - Error object to format
|
|
21
|
+
* @returns Formatted error string
|
|
22
|
+
*/
|
|
23
|
+
export declare const formatError: (error: any) => string;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
exports.formatError = exports.ensureAzureAuth = exports.parseResourceId = void 0;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const renderer_1 = require("../renderer");
|
|
18
|
+
const parseResourceId = (resourceId) => {
|
|
19
|
+
const match = resourceId.match(/^\/subscriptions\/([^/]+)\/resourceGroups\/([^/]+)\/providers\/Microsoft\.\w+\/\w+\/([^/]+)$/i);
|
|
20
|
+
if (match) {
|
|
21
|
+
const [, subscriptionId, resourceGroup, name] = match;
|
|
22
|
+
return { subscriptionId, resourceGroup, name };
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.parseResourceId = parseResourceId;
|
|
26
|
+
/**
|
|
27
|
+
* Ensures Azure authentication is working by attempting to get a token.
|
|
28
|
+
* @param print - Function to print messages
|
|
29
|
+
* @param cred - Azure credential object with getToken method
|
|
30
|
+
* @returns true if authentication succeeds, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
const ensureAzureAuth = (print, cred) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
try {
|
|
34
|
+
yield cred.getToken('https://management.azure.com/.default');
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
print((0, renderer_1.renderSoftWarning)(`Failed to authenticate with Azure: ${error.name}\n\nPlease ensure that you have the Azure CLI installed (https://aka.ms/azure-cli) and have run ${chalk_1.default.bold('az login')} to authenticate.\n`));
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}); /**
|
|
42
|
+
* Formats an error (usually an Azure RestError) object into a string for display.
|
|
43
|
+
* @param error - Error object to format
|
|
44
|
+
* @returns Formatted error string
|
|
45
|
+
*/
|
|
46
|
+
exports.ensureAzureAuth = ensureAzureAuth;
|
|
47
|
+
// no-dd-sa:typescript-best-practices/no-explicit-any
|
|
48
|
+
const formatError = (error) => {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const errorType = (_a = error.code) !== null && _a !== void 0 ? _a : error.name;
|
|
51
|
+
const errorMessage = (_c = (_b = error.details) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : error.message;
|
|
52
|
+
return `${errorType}: ${errorMessage}`;
|
|
53
|
+
};
|
|
54
|
+
exports.formatError = formatError;
|
|
55
|
+
//# sourceMappingURL=azure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure.js","sourceRoot":"","sources":["../../../src/helpers/serverless/azure.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,0CAA6C;AAQtC,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAwB,EAAE;IAC1E,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAC5B,+FAA+F,CAChG,CAAA;IACD,IAAI,KAAK,EAAE;QACT,MAAM,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC,GAAG,KAAK,CAAA;QAErD,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,IAAI,EAAC,CAAA;KAC7C;AACH,CAAC,CAAA;AATY,QAAA,eAAe,mBAS3B;AASD;;;;;GAKG;AAEI,MAAM,eAAe,GAAG,CAAO,KAA4B,EAAE,IAAqB,EAAoB,EAAE;IAC7G,IAAI;QACF,MAAM,IAAI,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAA;KAC7D;IAAC,OAAO,KAAK,EAAE;QACd,KAAK,CACH,IAAA,4BAAiB,EACf,sCAAuC,KAAoB,CAAC,IAAI,mGAAmG,eAAK,CAAC,IAAI,CAC3K,UAAU,CACX,qBAAqB,CACvB,CACF,CAAA;QAED,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA,CAAA,CAAC;;;;GAIC;AApBU,QAAA,eAAe,mBAgB3B;AAKD,qDAAqD;AAE9C,MAAM,WAAW,GAAG,CAAC,KAAU,EAAU,EAAE;;IAChD,MAAM,SAAS,GAAG,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,IAAI,CAAA;IAC1C,MAAM,YAAY,GAAG,MAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,OAAO,mCAAI,KAAK,CAAC,OAAO,CAAA;IAE5D,OAAO,GAAG,SAAS,KAAK,YAAY,EAAE,CAAA;AACxC,CAAC,CAAA;AALY,QAAA,WAAW,eAKvB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses environment variables from array format (KEY=VALUE) to object format.
|
|
3
|
+
* @param envVars - Array of environment variables in KEY=VALUE format
|
|
4
|
+
* @returns Object with parsed environment variables
|
|
5
|
+
*/
|
|
6
|
+
export declare const parseEnvVars: (envVars: string[] | undefined) => Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Collects all items from a paged async iterator into an array.
|
|
9
|
+
* @param it - Paged async iterator
|
|
10
|
+
* @returns Array of all items
|
|
11
|
+
*/
|
|
12
|
+
export declare const collectAsyncIterator: <T>(it: AsyncIterable<T>) => Promise<T[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Common configuration options for serverless resources
|
|
15
|
+
*/
|
|
16
|
+
export interface ServerlessConfigOptions {
|
|
17
|
+
service?: string;
|
|
18
|
+
environment?: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
logPath?: string;
|
|
21
|
+
extraTags?: string;
|
|
22
|
+
envVars?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Builds base environment variables for serverless instrumentation.
|
|
26
|
+
* @param config - Configuration options
|
|
27
|
+
* @returns Base environment variables object
|
|
28
|
+
*/
|
|
29
|
+
export declare const getBaseEnvVars: (config: ServerlessConfigOptions) => Record<string, string>;
|
|
30
|
+
export declare const sortedEqual: (a: any, b: any) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a git diff-style comparison between two configurations
|
|
33
|
+
* @param original The original configuration object
|
|
34
|
+
* @param updated The updated configuration object
|
|
35
|
+
* @returns A formatted diff string with colors
|
|
36
|
+
*/
|
|
37
|
+
export declare const generateConfigDiff: (original: any, updated: any) => string;
|
|
38
|
+
export declare const byName: <T extends FullyOptional<{
|
|
39
|
+
name: string;
|
|
40
|
+
}>>(xs: T[]) => Record<string, T>;
|
|
41
|
+
type FullyOptional<T> = {
|
|
42
|
+
[K in keyof T]?: T[K] extends any[] ? FullyOptional<T[K][number]>[] | null | undefined : T[K] extends object ? FullyOptional<T[K]> | null | undefined : T[K] | null | undefined;
|
|
43
|
+
};
|
|
44
|
+
type EnvVar = {
|
|
45
|
+
name: string;
|
|
46
|
+
value: string;
|
|
47
|
+
};
|
|
48
|
+
type VolumeMount = {
|
|
49
|
+
volumeName?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
mountPath: string;
|
|
52
|
+
};
|
|
53
|
+
type Container = {
|
|
54
|
+
name: string;
|
|
55
|
+
env: EnvVar[];
|
|
56
|
+
volumeMounts: VolumeMount[];
|
|
57
|
+
};
|
|
58
|
+
type Volume = {
|
|
59
|
+
name: string;
|
|
60
|
+
};
|
|
61
|
+
type AppTemplate = {
|
|
62
|
+
containers: Container[];
|
|
63
|
+
volumes: Volume[];
|
|
64
|
+
};
|
|
65
|
+
interface SharedVolumeOptions {
|
|
66
|
+
name: string;
|
|
67
|
+
mountPath: string;
|
|
68
|
+
mountOptions: any;
|
|
69
|
+
volumeMountNameKey: 'name' | 'volumeName';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Given the configuration, an app template, the base sidecar configuration, and base shared volume,
|
|
73
|
+
*/
|
|
74
|
+
export declare const createInstrumentedTemplate: (template: FullyOptional<AppTemplate>, baseSidecar: FullyOptional<Container>, sharedVolumeOptions: SharedVolumeOptions, envVarsByName: Record<string, FullyOptional<EnvVar>>) => AppTemplate;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
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 __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.createInstrumentedTemplate = exports.byName = exports.generateConfigDiff = exports.sortedEqual = exports.getBaseEnvVars = exports.collectAsyncIterator = exports.parseEnvVars = void 0;
|
|
23
|
+
const node_util_1 = require("node:util");
|
|
24
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
25
|
+
const jest_diff_1 = require("jest-diff");
|
|
26
|
+
const constants_1 = require("../../constants");
|
|
27
|
+
const constants_2 = require("./constants");
|
|
28
|
+
/**
|
|
29
|
+
* Parses environment variables from array format (KEY=VALUE) to object format.
|
|
30
|
+
* @param envVars - Array of environment variables in KEY=VALUE format
|
|
31
|
+
* @returns Object with parsed environment variables
|
|
32
|
+
*/
|
|
33
|
+
const parseEnvVars = (envVars) => {
|
|
34
|
+
const result = {};
|
|
35
|
+
envVars === null || envVars === void 0 ? void 0 : envVars.forEach((e) => {
|
|
36
|
+
const match = e.match(constants_2.ENV_VAR_REGEX);
|
|
37
|
+
if (match) {
|
|
38
|
+
const [, key, value] = match;
|
|
39
|
+
result[key] = value;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
exports.parseEnvVars = parseEnvVars;
|
|
45
|
+
/**
|
|
46
|
+
* Collects all items from a paged async iterator into an array.
|
|
47
|
+
* @param it - Paged async iterator
|
|
48
|
+
* @returns Array of all items
|
|
49
|
+
*/
|
|
50
|
+
const collectAsyncIterator = (it) => { var _a, it_1, it_1_1; return __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var _b, e_1, _c, _d;
|
|
52
|
+
const arr = [];
|
|
53
|
+
try {
|
|
54
|
+
for (_a = true, it_1 = __asyncValues(it); it_1_1 = yield it_1.next(), _b = it_1_1.done, !_b; _a = true) {
|
|
55
|
+
_d = it_1_1.value;
|
|
56
|
+
_a = false;
|
|
57
|
+
const x = _d;
|
|
58
|
+
arr.push(x);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
62
|
+
finally {
|
|
63
|
+
try {
|
|
64
|
+
if (!_a && !_b && (_c = it_1.return)) yield _c.call(it_1);
|
|
65
|
+
}
|
|
66
|
+
finally { if (e_1) throw e_1.error; }
|
|
67
|
+
}
|
|
68
|
+
return arr;
|
|
69
|
+
}); };
|
|
70
|
+
exports.collectAsyncIterator = collectAsyncIterator;
|
|
71
|
+
/**
|
|
72
|
+
* Builds base environment variables for serverless instrumentation.
|
|
73
|
+
* @param config - Configuration options
|
|
74
|
+
* @returns Base environment variables object
|
|
75
|
+
*/
|
|
76
|
+
const getBaseEnvVars = (config) => {
|
|
77
|
+
var _a;
|
|
78
|
+
const envVars = Object.assign({ DD_API_KEY: process.env.DD_API_KEY, DD_SITE: (_a = process.env.DD_SITE) !== null && _a !== void 0 ? _a : constants_1.DATADOG_SITE_US1, DD_SERVICE: config.service }, (0, exports.parseEnvVars)(config.envVars));
|
|
79
|
+
if (config.environment) {
|
|
80
|
+
envVars.DD_ENV = config.environment;
|
|
81
|
+
}
|
|
82
|
+
if (config.version) {
|
|
83
|
+
envVars.DD_VERSION = config.version;
|
|
84
|
+
}
|
|
85
|
+
if (config.logPath) {
|
|
86
|
+
envVars[constants_2.LOGS_PATH_ENV_VAR] = config.logPath;
|
|
87
|
+
}
|
|
88
|
+
if (config.extraTags) {
|
|
89
|
+
envVars.DD_TAGS = config.extraTags;
|
|
90
|
+
}
|
|
91
|
+
return envVars;
|
|
92
|
+
};
|
|
93
|
+
exports.getBaseEnvVars = getBaseEnvVars;
|
|
94
|
+
/**
|
|
95
|
+
* Recursively sort object keys to ensure consistent ordering
|
|
96
|
+
*/
|
|
97
|
+
const sortObject = (obj) => {
|
|
98
|
+
if (!obj) {
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(obj)) {
|
|
102
|
+
return obj.map(sortObject).sort((a, b) => {
|
|
103
|
+
return JSON.stringify(a).localeCompare(JSON.stringify(b));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (typeof obj === 'object') {
|
|
107
|
+
const sorted = {};
|
|
108
|
+
Object.keys(obj)
|
|
109
|
+
.sort()
|
|
110
|
+
.forEach((key) => {
|
|
111
|
+
sorted[key] = sortObject(obj[key]);
|
|
112
|
+
});
|
|
113
|
+
return sorted;
|
|
114
|
+
}
|
|
115
|
+
return obj;
|
|
116
|
+
};
|
|
117
|
+
const sortedEqual = (a, b) => {
|
|
118
|
+
const sortedA = sortObject(a);
|
|
119
|
+
const sortedB = sortObject(b);
|
|
120
|
+
return (0, node_util_1.isDeepStrictEqual)(sortedA, sortedB);
|
|
121
|
+
};
|
|
122
|
+
exports.sortedEqual = sortedEqual;
|
|
123
|
+
/**
|
|
124
|
+
* Obfuscate sensitive values in a line if it contains a key-like pattern
|
|
125
|
+
*/
|
|
126
|
+
const obfuscateSensitiveValues = (line) => {
|
|
127
|
+
// Match hex strings of 16, 32, or 64 characters (common API key/token lengths)
|
|
128
|
+
return line
|
|
129
|
+
.replace(/("[0-9a-fA-F]{16}"|"[0-9a-fA-F]{32}"|"[0-9a-fA-F]{64}")/g, '"***"')
|
|
130
|
+
.replace(/('[0-9a-fA-F]{16}'|'[0-9a-fA-F]{32}'|'[0-9a-fA-F]{64}')/g, "'***'");
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Generate a git diff-style comparison between two configurations
|
|
134
|
+
* @param original The original configuration object
|
|
135
|
+
* @param updated The updated configuration object
|
|
136
|
+
* @returns A formatted diff string with colors
|
|
137
|
+
*/
|
|
138
|
+
const generateConfigDiff = (original, updated) => {
|
|
139
|
+
// Sort keys consistently before comparison
|
|
140
|
+
const sortedOriginal = sortObject(original);
|
|
141
|
+
const sortedUpdated = sortObject(updated);
|
|
142
|
+
const originalJson = JSON.stringify(sortedOriginal, undefined, 2);
|
|
143
|
+
const updatedJson = JSON.stringify(sortedUpdated, undefined, 2);
|
|
144
|
+
const configDiff = (0, jest_diff_1.diff)(originalJson, updatedJson, {
|
|
145
|
+
aColor: chalk_1.default.red,
|
|
146
|
+
bColor: chalk_1.default.green,
|
|
147
|
+
omitAnnotationLines: true,
|
|
148
|
+
expand: false,
|
|
149
|
+
});
|
|
150
|
+
if (!configDiff || configDiff.includes('no visual difference')) {
|
|
151
|
+
return chalk_1.default.gray('No changes detected.');
|
|
152
|
+
}
|
|
153
|
+
return configDiff.split('\n').map(obfuscateSensitiveValues).join('\n');
|
|
154
|
+
};
|
|
155
|
+
exports.generateConfigDiff = generateConfigDiff;
|
|
156
|
+
const byName = (xs) => {
|
|
157
|
+
return Object.fromEntries(xs.filter((x) => x.name).map((x) => [x.name, x]));
|
|
158
|
+
};
|
|
159
|
+
exports.byName = byName;
|
|
160
|
+
const DEFAULT_ENV_VARS_BY_NAME = (0, exports.byName)([
|
|
161
|
+
{ name: constants_2.SITE_ENV_VAR, value: constants_1.DATADOG_SITE_US1 },
|
|
162
|
+
{ name: constants_2.LOGS_INJECTION_ENV_VAR, value: 'true' },
|
|
163
|
+
{ name: constants_2.DD_TRACE_ENABLED_ENV_VAR, value: 'true' },
|
|
164
|
+
{ name: constants_2.HEALTH_PORT_ENV_VAR, value: constants_2.DEFAULT_HEALTH_CHECK_PORT.toString() },
|
|
165
|
+
]);
|
|
166
|
+
/**
|
|
167
|
+
* Given the configuration, an app template, the base sidecar configuration, and base shared volume,
|
|
168
|
+
*/
|
|
169
|
+
const createInstrumentedTemplate = (template, baseSidecar, sharedVolumeOptions, envVarsByName) => {
|
|
170
|
+
var _a;
|
|
171
|
+
const sharedVolumeMount = {
|
|
172
|
+
[sharedVolumeOptions.volumeMountNameKey]: sharedVolumeOptions.name,
|
|
173
|
+
mountPath: sharedVolumeOptions.mountPath,
|
|
174
|
+
};
|
|
175
|
+
const containers = template.containers || [];
|
|
176
|
+
const hasSidecarContainer = containers.some((c) => c.name === baseSidecar.name);
|
|
177
|
+
const newSidecarContainer = Object.assign(Object.assign({}, baseSidecar), { env: Object.values(Object.assign(Object.assign(Object.assign({}, DEFAULT_ENV_VARS_BY_NAME), (0, exports.byName)((_a = baseSidecar.env) !== null && _a !== void 0 ? _a : [])), envVarsByName)), volumeMounts: [sharedVolumeMount] });
|
|
178
|
+
// Update all app containers to add volume mounts and env vars if they don't have them
|
|
179
|
+
const updatedContainers = containers.map((container) => {
|
|
180
|
+
var _a;
|
|
181
|
+
if (container.name === baseSidecar.name) {
|
|
182
|
+
return newSidecarContainer;
|
|
183
|
+
}
|
|
184
|
+
const existingVolumeMounts = container.volumeMounts || [];
|
|
185
|
+
const hasSharedVolumeMount = existingVolumeMounts.some((mount) => mount[sharedVolumeOptions.volumeMountNameKey] === sharedVolumeOptions.name);
|
|
186
|
+
const updatedVolumeMounts = existingVolumeMounts.map((mount) => mount[sharedVolumeOptions.volumeMountNameKey] === sharedVolumeOptions.name ? sharedVolumeMount : mount);
|
|
187
|
+
if (!hasSharedVolumeMount) {
|
|
188
|
+
updatedVolumeMounts.push(sharedVolumeMount);
|
|
189
|
+
}
|
|
190
|
+
return Object.assign(Object.assign({}, container), { volumeMounts: updatedVolumeMounts, env: Object.values(Object.assign(Object.assign(Object.assign({}, DEFAULT_ENV_VARS_BY_NAME), (0, exports.byName)((_a = container.env) !== null && _a !== void 0 ? _a : [])), envVarsByName)) });
|
|
191
|
+
});
|
|
192
|
+
// Add sidecar if it doesn't exist
|
|
193
|
+
if (!hasSidecarContainer) {
|
|
194
|
+
updatedContainers.push(newSidecarContainer);
|
|
195
|
+
}
|
|
196
|
+
const volumes = template.volumes || [];
|
|
197
|
+
// Add shared volume if it doesn't exist
|
|
198
|
+
const sharedVolume = Object.assign(Object.assign({}, sharedVolumeOptions.mountOptions), { name: sharedVolumeOptions.name });
|
|
199
|
+
const hasSharedVolume = volumes.some((volume) => volume.name === sharedVolumeOptions.name);
|
|
200
|
+
const updatedVolumes = volumes.map((volume) => (volume.name === sharedVolumeOptions.name ? sharedVolume : volume));
|
|
201
|
+
if (!hasSharedVolume) {
|
|
202
|
+
updatedVolumes.push(sharedVolume);
|
|
203
|
+
}
|
|
204
|
+
return Object.assign(Object.assign({}, template), { containers: updatedContainers, volumes: updatedVolumes });
|
|
205
|
+
};
|
|
206
|
+
exports.createInstrumentedTemplate = createInstrumentedTemplate;
|
|
207
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/helpers/serverless/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2C;AAE3C,kDAAyB;AACzB,yCAA8B;AAE9B,+CAAgD;AAEhD,2CAQoB;AACpB;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,OAA6B,EAA0B,EAAE;IACpF,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,yBAAa,CAAC,CAAA;QACpC,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB;AAED;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAU,EAAoB,EAAgB,EAAE;;IAClF,MAAM,GAAG,GAAG,EAAE,CAAA;;QACd,gBAAsB,O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B,IACpC;AACH,CAAC,CAAA;AAzEY,QAAA,0BAA0B,8BAyEtC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const API_KEY_ENV_VAR = "DD_API_KEY";
|
|
2
|
+
export declare const CI_API_KEY_ENV_VAR = "DATADOG_API_KEY";
|
|
3
|
+
export declare const CI_SITE_ENV_VAR = "DATADOG_SITE";
|
|
4
|
+
export declare const SITE_ENV_VAR = "DD_SITE";
|
|
5
|
+
export declare const LOGS_INJECTION_ENV_VAR = "DD_LOGS_INJECTION";
|
|
6
|
+
export declare const LOGS_PATH_ENV_VAR = "DD_SERVERLESS_LOG_PATH";
|
|
7
|
+
export declare const HEALTH_PORT_ENV_VAR = "DD_HEALTH_PORT";
|
|
8
|
+
export declare const DD_LOG_LEVEL_ENV_VAR = "DD_LOG_LEVEL";
|
|
9
|
+
export declare const DD_TRACE_ENABLED_ENV_VAR = "DD_TRACE_ENABLED";
|
|
10
|
+
export declare const DD_LLMOBS_ENABLED_ENV_VAR = "DD_LLMOBS_ENABLED";
|
|
11
|
+
export declare const DD_LLMOBS_ML_APP_ENV_VAR = "DD_LLMOBS_ML_APP";
|
|
12
|
+
export declare const DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR = "DD_LLMOBS_AGENTLESS_ENABLED";
|
|
13
|
+
export declare const DD_TAGS_ENV_VAR = "DD_TAGS";
|
|
14
|
+
export declare const DD_SOURCE_ENV_VAR = "DD_SOURCE";
|
|
15
|
+
export declare const SERVICE_ENV_VAR = "DD_SERVICE";
|
|
16
|
+
export declare const ENVIRONMENT_ENV_VAR = "DD_ENV";
|
|
17
|
+
export declare const VERSION_ENV_VAR = "DD_VERSION";
|
|
18
|
+
export declare const EXTRA_TAGS_REG_EXP: RegExp;
|
|
19
|
+
export declare const FLARE_OUTPUT_DIRECTORY = ".datadog-ci";
|
|
20
|
+
export declare const LOGS_DIRECTORY = "logs";
|
|
21
|
+
export declare const PROJECT_FILES_DIRECTORY = "project_files";
|
|
22
|
+
export declare const ADDITIONAL_FILES_DIRECTORY = "additional_files";
|
|
23
|
+
export declare const INSIGHTS_FILE_NAME = "INSIGHTS.md";
|
|
24
|
+
export declare const FLARE_ENDPOINT_PATH = "/api/ui/support/serverless/flare";
|
|
25
|
+
export declare const FLARE_PROJECT_FILES: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Shared constants for serverless instrumentation
|
|
28
|
+
*/
|
|
29
|
+
export declare const SIDECAR_CONTAINER_NAME = "datadog-sidecar";
|
|
30
|
+
export declare const SIDECAR_IMAGE = "index.docker.io/datadog/serverless-init:latest";
|
|
31
|
+
export declare const SIDECAR_PORT = 8126;
|
|
32
|
+
export declare const DEFAULT_SIDECAR_NAME = "datadog-sidecar";
|
|
33
|
+
export declare const DEFAULT_VOLUME_NAME = "shared-volume";
|
|
34
|
+
export declare const DEFAULT_VOLUME_PATH = "/shared-volume";
|
|
35
|
+
export declare const DEFAULT_LOGS_PATH = "/shared-volume/logs/*.log";
|
|
36
|
+
export declare const DEFAULT_HEALTH_CHECK_PORT = 5555;
|
|
37
|
+
/**
|
|
38
|
+
* Regular expression for parsing environment variables in KEY=VALUE format
|
|
39
|
+
*/
|
|
40
|
+
export declare const ENV_VAR_REGEX: RegExp;
|