@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.
- package/dist/commands/cloud-run/cli.d.ts +1 -0
- package/dist/commands/cloud-run/cli.js +5 -0
- package/dist/commands/cloud-run/cli.js.map +1 -0
- package/dist/commands/cloud-run/constants.d.ts +1 -0
- package/dist/commands/cloud-run/constants.js +22 -0
- package/dist/commands/cloud-run/constants.js.map +1 -0
- package/dist/commands/cloud-run/flare.d.ts +60 -0
- package/dist/commands/cloud-run/flare.js +369 -0
- package/dist/commands/cloud-run/flare.js.map +1 -0
- package/dist/commands/cloud-run/interfaces.d.ts +27 -0
- package/dist/commands/cloud-run/interfaces.js +3 -0
- package/dist/commands/cloud-run/interfaces.js.map +1 -0
- package/dist/commands/cloud-run/renderer.d.ts +4 -0
- package/dist/commands/cloud-run/renderer.js +38 -0
- package/dist/commands/cloud-run/renderer.js.map +1 -0
- package/dist/commands/flutter-symbols/renderer.js +2 -0
- package/dist/commands/flutter-symbols/renderer.js.map +1 -1
- package/dist/commands/gate/api.js +4 -0
- package/dist/commands/gate/api.js.map +1 -1
- package/dist/commands/gate/evaluate.js +5 -4
- package/dist/commands/gate/evaluate.js.map +1 -1
- package/dist/commands/gate/interfaces.d.ts +5 -0
- package/dist/commands/gate/renderer.d.ts +1 -1
- package/dist/commands/gate/renderer.js +16 -2
- package/dist/commands/gate/renderer.js.map +1 -1
- package/dist/commands/junit/utils.js +6 -13
- package/dist/commands/junit/utils.js.map +1 -1
- package/dist/commands/lambda/constants.d.ts +11 -8
- package/dist/commands/lambda/constants.js +85 -15
- package/dist/commands/lambda/constants.js.map +1 -1
- package/dist/commands/lambda/flare.d.ts +26 -40
- package/dist/commands/lambda/flare.js +275 -202
- package/dist/commands/lambda/flare.js.map +1 -1
- package/dist/commands/lambda/functions/commons.d.ts +7 -13
- package/dist/commands/lambda/functions/commons.js +39 -56
- package/dist/commands/lambda/functions/commons.js.map +1 -1
- package/dist/commands/lambda/functions/instrument.js +46 -45
- package/dist/commands/lambda/functions/instrument.js.map +1 -1
- package/dist/commands/lambda/functions/uninstrument.js +29 -28
- package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
- package/dist/commands/lambda/instrument.js +20 -17
- package/dist/commands/lambda/instrument.js.map +1 -1
- package/dist/commands/lambda/prompt.d.ts +1 -2
- package/dist/commands/lambda/prompt.js +32 -32
- package/dist/commands/lambda/prompt.js.map +1 -1
- package/dist/commands/lambda/renderers/common-renderer.d.ts +0 -26
- package/dist/commands/lambda/renderers/common-renderer.js +4 -32
- package/dist/commands/lambda/renderers/common-renderer.js.map +1 -1
- package/dist/commands/lambda/renderers/instrument-uninstrument-renderer.js +27 -27
- package/dist/commands/lambda/renderers/instrument-uninstrument-renderer.js.map +1 -1
- package/dist/commands/lambda/uninstrument.js +10 -8
- package/dist/commands/lambda/uninstrument.js.map +1 -1
- package/dist/commands/sarif/api.js +2 -18
- package/dist/commands/sarif/api.js.map +1 -1
- package/dist/commands/stepfunctions/awsCommands.d.ts +2 -0
- package/dist/commands/stepfunctions/awsCommands.js +26 -2
- package/dist/commands/stepfunctions/awsCommands.js.map +1 -1
- package/dist/commands/stepfunctions/constants.d.ts +1 -0
- package/dist/commands/stepfunctions/constants.js +2 -1
- package/dist/commands/stepfunctions/constants.js.map +1 -1
- package/dist/commands/stepfunctions/helpers.d.ts +22 -0
- package/dist/commands/stepfunctions/helpers.js +62 -4
- package/dist/commands/stepfunctions/helpers.js.map +1 -1
- package/dist/commands/stepfunctions/instrument.d.ts +1 -0
- package/dist/commands/stepfunctions/instrument.js +15 -4
- package/dist/commands/stepfunctions/instrument.js.map +1 -1
- package/dist/commands/synthetics/interfaces.d.ts +2 -1
- package/dist/commands/synthetics/interfaces.js.map +1 -1
- package/dist/commands/synthetics/reporters/default.js +3 -5
- package/dist/commands/synthetics/reporters/default.js.map +1 -1
- package/dist/commands/synthetics/utils.js +3 -9
- package/dist/commands/synthetics/utils.js.map +1 -1
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +14 -1
- package/dist/constants.js.map +1 -1
- package/dist/helpers/app.d.ts +2 -0
- package/dist/helpers/app.js +17 -0
- package/dist/helpers/app.js.map +1 -0
- package/dist/helpers/flare.d.ts +19 -0
- package/dist/helpers/flare.js +81 -0
- package/dist/helpers/flare.js.map +1 -0
- package/dist/helpers/fs.d.ts +31 -0
- package/dist/helpers/fs.js +117 -0
- package/dist/helpers/fs.js.map +1 -0
- package/dist/helpers/prompt.d.ts +6 -0
- package/dist/helpers/prompt.js +39 -0
- package/dist/helpers/prompt.js.map +1 -0
- package/dist/helpers/renderer.d.ts +36 -0
- package/dist/helpers/renderer.js +47 -0
- package/dist/helpers/renderer.js.map +1 -0
- package/dist/helpers/utils.d.ts +8 -0
- package/dist/helpers/utils.js +40 -1
- package/dist/helpers/utils.js.map +1 -1
- package/package.json +8 -2
- package/dist/commands/lambda/renderers/flare-renderer.d.ts +0 -9
- package/dist/commands/lambda/renderers/flare-renderer.js +0 -18
- package/dist/commands/lambda/renderers/flare-renderer.js.map +0 -1
- package/dist/helpers/file.d.ts +0 -1
- package/dist/helpers/file.js +0 -9
- package/dist/helpers/file.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/cli.ts"],"names":[],"mappings":";;AAAA,mCAA4C;AAE5C,MAAM,CAAC,OAAO,GAAG,CAAC,4BAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SKIP_MASKING_CLOUDRUN_ENV_VARS: Set<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SKIP_MASKING_CLOUDRUN_ENV_VARS = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const NODE_OPTIONS_ENV_VAR = 'NODE_OPTIONS';
|
|
6
|
+
const DD_TRACE_PROPAGATION_STYLE_ENV_VAR = 'DD_TRACE_PROPAGATION_STYLE';
|
|
7
|
+
const DD_SOURCE_ENV_VAR = 'DD_SOURCE';
|
|
8
|
+
const DD_TAGS_ENV_VAR = 'DD_TAGS';
|
|
9
|
+
const DD_OLTP_HTTPS_ENV_VAR = 'DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT';
|
|
10
|
+
const DD_OLTP_GRPC_ENV_VAR = 'DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT';
|
|
11
|
+
exports.SKIP_MASKING_CLOUDRUN_ENV_VARS = new Set([
|
|
12
|
+
constants_1.SITE_ENV_VAR,
|
|
13
|
+
constants_1.SERVICE_ENV_VAR,
|
|
14
|
+
constants_1.ENVIRONMENT_ENV_VAR,
|
|
15
|
+
NODE_OPTIONS_ENV_VAR,
|
|
16
|
+
DD_TRACE_PROPAGATION_STYLE_ENV_VAR,
|
|
17
|
+
DD_SOURCE_ENV_VAR,
|
|
18
|
+
DD_TAGS_ENV_VAR,
|
|
19
|
+
DD_OLTP_HTTPS_ENV_VAR,
|
|
20
|
+
DD_OLTP_GRPC_ENV_VAR,
|
|
21
|
+
]);
|
|
22
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/constants.ts"],"names":[],"mappings":";;;AAAA,+CAAkF;AAElF,MAAM,oBAAoB,GAAG,cAAc,CAAA;AAC3C,MAAM,kCAAkC,GAAG,4BAA4B,CAAA;AACvE,MAAM,iBAAiB,GAAG,WAAW,CAAA;AACrC,MAAM,eAAe,GAAG,SAAS,CAAA;AACjC,MAAM,qBAAqB,GAAG,iDAAiD,CAAA;AAC/E,MAAM,oBAAoB,GAAG,iDAAiD,CAAA;AAEjE,QAAA,8BAA8B,GAAG,IAAI,GAAG,CAAC;IACpD,wBAAY;IACZ,2BAAe;IACf,+BAAmB;IACnB,oBAAoB;IACpB,kCAAkC;IAClC,iBAAiB;IACjB,eAAe;IACf,qBAAqB;IACrB,oBAAoB;CACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import IService = google.cloud.run.v2.IService;
|
|
2
|
+
import { Logging } from '@google-cloud/logging';
|
|
3
|
+
import { ServicesClient } from '@google-cloud/run';
|
|
4
|
+
import { google } from '@google-cloud/run/build/protos/protos';
|
|
5
|
+
import { Command } from 'clipanion';
|
|
6
|
+
import { CloudRunLog } from './interfaces';
|
|
7
|
+
export declare const MAX_LOGS = 1000;
|
|
8
|
+
export declare class CloudRunFlareCommand extends Command {
|
|
9
|
+
private isDryRun;
|
|
10
|
+
private withLogs;
|
|
11
|
+
private service?;
|
|
12
|
+
private project?;
|
|
13
|
+
private region?;
|
|
14
|
+
private caseId?;
|
|
15
|
+
private email?;
|
|
16
|
+
private apiKey?;
|
|
17
|
+
/**
|
|
18
|
+
* Entry point for the `cloud-run flare` command.
|
|
19
|
+
* Gathers Cloud Run service configuration and sends it to Datadog.
|
|
20
|
+
* @returns 0 if the command ran successfully, 1 otherwise.
|
|
21
|
+
*/
|
|
22
|
+
execute(): Promise<1 | 0>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if the user is authenticated with GCP.
|
|
26
|
+
* @returns true if the user is authenticated, false otherwise
|
|
27
|
+
*/
|
|
28
|
+
export declare const checkAuthentication: () => Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Call the google-cloud run sdk to get the configuration
|
|
31
|
+
* for the given service.
|
|
32
|
+
* @param runClient the google-cloud run sdk client
|
|
33
|
+
* @param serviceName the name of the service
|
|
34
|
+
* @param projectName the project where the service is deployed
|
|
35
|
+
* @param region the region where the service is deployed
|
|
36
|
+
* @returns the configuration for the given service
|
|
37
|
+
*/
|
|
38
|
+
export declare const getCloudRunServiceConfig: (runClient: ServicesClient, serviceName: string, projectName: string, region: string) => Promise<IService>;
|
|
39
|
+
/**
|
|
40
|
+
* Masks environment variables in a Cloud Run service configuration.
|
|
41
|
+
* Makes a copy as to not modify the config in place.
|
|
42
|
+
* @param config
|
|
43
|
+
* @returns masked config
|
|
44
|
+
*/
|
|
45
|
+
export declare const maskConfig: (config: any) => IService;
|
|
46
|
+
/**
|
|
47
|
+
* Gets recent logs
|
|
48
|
+
* @param logClient Logging client
|
|
49
|
+
* @param serviceId
|
|
50
|
+
* @param location
|
|
51
|
+
* @param severityFilter if included, adds the string to the filter
|
|
52
|
+
* @returns array of logs as CloudRunLog interfaces
|
|
53
|
+
*/
|
|
54
|
+
export declare const getLogs: (logClient: Logging, serviceId: string, location: string, severityFilter?: string | undefined) => Promise<CloudRunLog[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Save logs in a CSV format
|
|
57
|
+
* @param logs array of logs stored as CloudRunLog interfaces
|
|
58
|
+
* @param filePath path to save the CSV file
|
|
59
|
+
*/
|
|
60
|
+
export declare const saveLogsFile: (logs: CloudRunLog[], filePath: string) => void;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.saveLogsFile = exports.getLogs = exports.maskConfig = exports.getCloudRunServiceConfig = exports.checkAuthentication = exports.CloudRunFlareCommand = exports.MAX_LOGS = void 0;
|
|
35
|
+
const fs_1 = __importDefault(require("fs"));
|
|
36
|
+
const path_1 = __importDefault(require("path"));
|
|
37
|
+
const process_1 = __importDefault(require("process"));
|
|
38
|
+
const util_1 = __importDefault(require("util"));
|
|
39
|
+
const logging_1 = require("@google-cloud/logging");
|
|
40
|
+
const run_1 = require("@google-cloud/run");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const clipanion_1 = require("clipanion");
|
|
43
|
+
const google_auth_library_1 = require("google-auth-library");
|
|
44
|
+
const constants_1 = require("../../constants");
|
|
45
|
+
const flare_1 = require("../../helpers/flare");
|
|
46
|
+
const fs_2 = require("../../helpers/fs");
|
|
47
|
+
const prompt_1 = require("../../helpers/prompt");
|
|
48
|
+
const helpersRenderer = __importStar(require("../../helpers/renderer"));
|
|
49
|
+
const utils_1 = require("../../helpers/utils");
|
|
50
|
+
const constants_2 = require("./constants");
|
|
51
|
+
const renderer_1 = require("./renderer");
|
|
52
|
+
const SERVICE_CONFIG_FILE_NAME = 'service_config.json';
|
|
53
|
+
const FLARE_ZIP_FILE_NAME = 'cloudrun-flare-output.zip';
|
|
54
|
+
const ALL_LOGS_FILE_NAME = 'all_logs.csv';
|
|
55
|
+
const WARNING_LOGS_FILE_NAME = 'warning_logs.csv';
|
|
56
|
+
const ERRORS_LOGS_FILE_NAME = 'error_logs.csv';
|
|
57
|
+
const DEBUG_LOGS_FILE_NAME = 'debug_logs.csv';
|
|
58
|
+
// Must be in range 0 - 1000. If more logs are needed, pagination must be implemented
|
|
59
|
+
exports.MAX_LOGS = 1000;
|
|
60
|
+
// How old the logs can be in minutes. Skip older logs
|
|
61
|
+
const MAX_LOG_AGE_MINUTES = 1440;
|
|
62
|
+
const FILTER_ORDER = 'timestamp asc';
|
|
63
|
+
// Types of log files to create
|
|
64
|
+
const LOG_CONFIGS = [
|
|
65
|
+
{ type: 'total', fileName: ALL_LOGS_FILE_NAME },
|
|
66
|
+
{ type: 'warning', severityFilter: ' AND severity>="WARNING"', fileName: WARNING_LOGS_FILE_NAME },
|
|
67
|
+
{ type: 'error', severityFilter: ' AND severity>="ERROR"', fileName: ERRORS_LOGS_FILE_NAME },
|
|
68
|
+
{ type: 'debug', severityFilter: ' AND severity="DEBUG"', fileName: DEBUG_LOGS_FILE_NAME },
|
|
69
|
+
];
|
|
70
|
+
class CloudRunFlareCommand extends clipanion_1.Command {
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
this.isDryRun = false;
|
|
74
|
+
this.withLogs = false;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Entry point for the `cloud-run flare` command.
|
|
78
|
+
* Gathers Cloud Run service configuration and sends it to Datadog.
|
|
79
|
+
* @returns 0 if the command ran successfully, 1 otherwise.
|
|
80
|
+
*/
|
|
81
|
+
execute() {
|
|
82
|
+
var _a;
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
this.context.stdout.write(helpersRenderer.renderFlareHeader('Cloud Run', this.isDryRun));
|
|
85
|
+
const errorMessages = [];
|
|
86
|
+
// Validate service
|
|
87
|
+
if (this.service === undefined) {
|
|
88
|
+
errorMessages.push(helpersRenderer.renderError('No service specified. [-s,--service]'));
|
|
89
|
+
}
|
|
90
|
+
// Validate project
|
|
91
|
+
if (this.project === undefined) {
|
|
92
|
+
errorMessages.push(helpersRenderer.renderError('No project specified. [-p,--project]'));
|
|
93
|
+
}
|
|
94
|
+
// Validate region
|
|
95
|
+
if (this.region === undefined) {
|
|
96
|
+
errorMessages.push(helpersRenderer.renderError('No region specified. [-r,--region]'));
|
|
97
|
+
}
|
|
98
|
+
// Validate Datadog API key
|
|
99
|
+
this.apiKey = (_a = process_1.default.env[constants_1.CI_API_KEY_ENV_VAR]) !== null && _a !== void 0 ? _a : process_1.default.env[constants_1.API_KEY_ENV_VAR];
|
|
100
|
+
if (this.apiKey === undefined) {
|
|
101
|
+
errorMessages.push(helpersRenderer.renderError('No Datadog API key specified. Set an API key with the DATADOG_API_KEY environment variable.'));
|
|
102
|
+
}
|
|
103
|
+
// Validate case ID
|
|
104
|
+
if (this.caseId === undefined) {
|
|
105
|
+
errorMessages.push(helpersRenderer.renderError('No case ID specified. [-c,--case-id]'));
|
|
106
|
+
}
|
|
107
|
+
// Validate email
|
|
108
|
+
if (this.email === undefined) {
|
|
109
|
+
errorMessages.push(helpersRenderer.renderError('No email specified. [-e,--email]'));
|
|
110
|
+
}
|
|
111
|
+
// If there are errors, print them and exit
|
|
112
|
+
if (errorMessages.length > 0) {
|
|
113
|
+
for (const message of errorMessages) {
|
|
114
|
+
this.context.stderr.write(message);
|
|
115
|
+
}
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
// Verify GCP credentials
|
|
119
|
+
this.context.stdout.write(chalk_1.default.bold('\n🔑 Verifying GCP credentials...\n'));
|
|
120
|
+
const authenticated = yield exports.checkAuthentication();
|
|
121
|
+
if (!authenticated) {
|
|
122
|
+
this.context.stderr.write(renderer_1.renderAuthenticationInstructions());
|
|
123
|
+
return 1;
|
|
124
|
+
}
|
|
125
|
+
this.context.stdout.write('GCP credentials verified!\n');
|
|
126
|
+
// Get and print service configuration
|
|
127
|
+
this.context.stdout.write(chalk_1.default.bold('\n🔍 Fetching service configuration...\n'));
|
|
128
|
+
const runClient = new run_1.ServicesClient();
|
|
129
|
+
let config;
|
|
130
|
+
try {
|
|
131
|
+
config = yield exports.getCloudRunServiceConfig(runClient, this.service, this.project, this.region);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
if (err instanceof Error) {
|
|
135
|
+
this.context.stderr.write(helpersRenderer.renderError(`Unable to fetch service configuration: ${err.message}`));
|
|
136
|
+
}
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
config = exports.maskConfig(config);
|
|
140
|
+
// 10 is the depth when inspecting the config file. Cloud-run configs have high depth, so
|
|
141
|
+
// we must raise the depth from the default depth of 2.
|
|
142
|
+
const configStr = util_1.default.inspect(config, false, 10, true);
|
|
143
|
+
this.context.stdout.write(`\n${configStr}\n`);
|
|
144
|
+
// Get logs
|
|
145
|
+
const logFileMappings = new Map();
|
|
146
|
+
if (this.withLogs) {
|
|
147
|
+
this.context.stdout.write(chalk_1.default.bold('\n📖 Getting logs...\n'));
|
|
148
|
+
const logClient = new logging_1.Logging({ projectId: this.project });
|
|
149
|
+
for (const logConfig of LOG_CONFIGS) {
|
|
150
|
+
try {
|
|
151
|
+
const logs = yield exports.getLogs(logClient, this.service, this.region, logConfig.severityFilter);
|
|
152
|
+
if (logs.length === 0) {
|
|
153
|
+
this.context.stdout.write(`• No ${logConfig.type} logs were found\n`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
this.context.stdout.write(`• Found ${logs.length} ${logConfig.type} logs\n`);
|
|
157
|
+
logFileMappings.set(logConfig.fileName, logs);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
const msg = err instanceof Error ? err.message : '';
|
|
162
|
+
this.context.stderr.write(`• Unable to get ${logConfig.type} logs: ${msg}\n`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
// Create folders
|
|
168
|
+
const rootFolderPath = path_1.default.join(process_1.default.cwd(), constants_1.FLARE_OUTPUT_DIRECTORY);
|
|
169
|
+
const logsFolderPath = path_1.default.join(rootFolderPath, constants_1.LOGS_DIRECTORY);
|
|
170
|
+
this.context.stdout.write(chalk_1.default.bold(`\n💾 Saving files to ${rootFolderPath}...\n`));
|
|
171
|
+
if (fs_1.default.existsSync(rootFolderPath)) {
|
|
172
|
+
fs_2.deleteFolder(rootFolderPath);
|
|
173
|
+
}
|
|
174
|
+
const subFolders = [];
|
|
175
|
+
if (logFileMappings.size > 0) {
|
|
176
|
+
subFolders.push(logsFolderPath);
|
|
177
|
+
}
|
|
178
|
+
fs_2.createDirectories(rootFolderPath, subFolders);
|
|
179
|
+
// Write config file
|
|
180
|
+
const configFilePath = path_1.default.join(rootFolderPath, SERVICE_CONFIG_FILE_NAME);
|
|
181
|
+
fs_2.writeFile(configFilePath, JSON.stringify(config, undefined, 2));
|
|
182
|
+
this.context.stdout.write(`• Saved function config to ./${SERVICE_CONFIG_FILE_NAME}\n`);
|
|
183
|
+
// Write logs
|
|
184
|
+
for (const [fileName, logs] of logFileMappings) {
|
|
185
|
+
const logFilePath = path_1.default.join(logsFolderPath, fileName);
|
|
186
|
+
exports.saveLogsFile(logs, logFilePath);
|
|
187
|
+
this.context.stdout.write(`• Saved logs to ./${constants_1.LOGS_DIRECTORY}/${fileName}\n`);
|
|
188
|
+
}
|
|
189
|
+
// Exit if dry run
|
|
190
|
+
const outputMsg = `\nℹ️ Your output files are located at: ${rootFolderPath}\n\n`;
|
|
191
|
+
if (this.isDryRun) {
|
|
192
|
+
this.context.stdout.write('\n🚫 The flare files were not sent as it was executed in dry run mode.');
|
|
193
|
+
this.context.stdout.write(outputMsg);
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
// Confirm before sending
|
|
197
|
+
this.context.stdout.write('\n');
|
|
198
|
+
const confirmSendFiles = yield prompt_1.requestConfirmation('Are you sure you want to send the flare file to Datadog Support?', false);
|
|
199
|
+
if (!confirmSendFiles) {
|
|
200
|
+
this.context.stdout.write('\n🚫 The flare files were not sent based on your selection.');
|
|
201
|
+
this.context.stdout.write(outputMsg);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
// Zip folder
|
|
205
|
+
const zipPath = path_1.default.join(rootFolderPath, FLARE_ZIP_FILE_NAME);
|
|
206
|
+
yield fs_2.zipContents(rootFolderPath, zipPath);
|
|
207
|
+
// Send to Datadog
|
|
208
|
+
this.context.stdout.write(chalk_1.default.bold('\n🚀 Sending to Datadog Support...\n'));
|
|
209
|
+
yield flare_1.sendToDatadog(zipPath, this.caseId, this.email, this.apiKey, rootFolderPath);
|
|
210
|
+
this.context.stdout.write(chalk_1.default.bold('\n✅ Successfully sent flare file to Datadog Support!\n'));
|
|
211
|
+
// Delete contents
|
|
212
|
+
fs_2.deleteFolder(rootFolderPath);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
if (err instanceof Error) {
|
|
216
|
+
this.context.stderr.write(helpersRenderer.renderError(err.message));
|
|
217
|
+
}
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
return 0;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.CloudRunFlareCommand = CloudRunFlareCommand;
|
|
225
|
+
/**
|
|
226
|
+
* Check if the user is authenticated with GCP.
|
|
227
|
+
* @returns true if the user is authenticated, false otherwise
|
|
228
|
+
*/
|
|
229
|
+
const checkAuthentication = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
230
|
+
const auth = new google_auth_library_1.GoogleAuth();
|
|
231
|
+
try {
|
|
232
|
+
yield auth.getApplicationDefault();
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
catch (_) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
exports.checkAuthentication = checkAuthentication;
|
|
240
|
+
/**
|
|
241
|
+
* Call the google-cloud run sdk to get the configuration
|
|
242
|
+
* for the given service.
|
|
243
|
+
* @param runClient the google-cloud run sdk client
|
|
244
|
+
* @param serviceName the name of the service
|
|
245
|
+
* @param projectName the project where the service is deployed
|
|
246
|
+
* @param region the region where the service is deployed
|
|
247
|
+
* @returns the configuration for the given service
|
|
248
|
+
*/
|
|
249
|
+
const getCloudRunServiceConfig = (runClient, serviceName, projectName, region) => __awaiter(void 0, void 0, void 0, function* () {
|
|
250
|
+
const request = {
|
|
251
|
+
name: runClient.servicePath(projectName, region, serviceName),
|
|
252
|
+
};
|
|
253
|
+
const [response] = yield runClient.getService(request);
|
|
254
|
+
return response;
|
|
255
|
+
});
|
|
256
|
+
exports.getCloudRunServiceConfig = getCloudRunServiceConfig;
|
|
257
|
+
/**
|
|
258
|
+
* Masks environment variables in a Cloud Run service configuration.
|
|
259
|
+
* Makes a copy as to not modify the config in place.
|
|
260
|
+
* @param config
|
|
261
|
+
* @returns masked config
|
|
262
|
+
*/
|
|
263
|
+
const maskConfig = (config) => {
|
|
264
|
+
var _a, _b;
|
|
265
|
+
// We stringify and parse again to make a deep copy
|
|
266
|
+
const configCopy = JSON.parse(JSON.stringify(config));
|
|
267
|
+
const containers = (_a = configCopy.template) === null || _a === void 0 ? void 0 : _a.containers;
|
|
268
|
+
if (!containers) {
|
|
269
|
+
return configCopy;
|
|
270
|
+
}
|
|
271
|
+
for (const container of containers) {
|
|
272
|
+
const env = (_b = container.env) !== null && _b !== void 0 ? _b : [];
|
|
273
|
+
for (const envVar of env) {
|
|
274
|
+
const name = envVar.name;
|
|
275
|
+
const val = envVar.value;
|
|
276
|
+
if (!name || !val) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (!constants_2.SKIP_MASKING_CLOUDRUN_ENV_VARS.has(name)) {
|
|
280
|
+
envVar.value = utils_1.maskString(val);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return configCopy;
|
|
285
|
+
};
|
|
286
|
+
exports.maskConfig = maskConfig;
|
|
287
|
+
/**
|
|
288
|
+
* Gets recent logs
|
|
289
|
+
* @param logClient Logging client
|
|
290
|
+
* @param serviceId
|
|
291
|
+
* @param location
|
|
292
|
+
* @param severityFilter if included, adds the string to the filter
|
|
293
|
+
* @returns array of logs as CloudRunLog interfaces
|
|
294
|
+
*/
|
|
295
|
+
const getLogs = (logClient, serviceId, location, severityFilter) => __awaiter(void 0, void 0, void 0, function* () {
|
|
296
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
297
|
+
const logs = [];
|
|
298
|
+
// Only get recent logs
|
|
299
|
+
const date = new Date();
|
|
300
|
+
date.setMinutes(date.getMinutes() - MAX_LOG_AGE_MINUTES);
|
|
301
|
+
const formattedDate = date.toISOString();
|
|
302
|
+
// Query options
|
|
303
|
+
let filter = `resource.labels.service_name="${serviceId}" AND resource.labels.location="${location}" AND timestamp>="${formattedDate}" AND (textPayload:* OR httpRequest:*)`;
|
|
304
|
+
// We only want to get logs from the last `MAX_LOG_AGE_MINUTES` to make sure they are relevant.
|
|
305
|
+
// We also only want to include logs with a textPayload or logs that were an HTTP request.
|
|
306
|
+
// Any other logs are just audit logs which are spammy and don't have any relevant information.
|
|
307
|
+
filter += severityFilter !== null && severityFilter !== void 0 ? severityFilter : '';
|
|
308
|
+
const options = {
|
|
309
|
+
filter,
|
|
310
|
+
orderBy: FILTER_ORDER,
|
|
311
|
+
pageSize: exports.MAX_LOGS,
|
|
312
|
+
};
|
|
313
|
+
const [entries] = yield logClient.getEntries(options);
|
|
314
|
+
for (const entry of entries) {
|
|
315
|
+
let msg = '';
|
|
316
|
+
if (entry.metadata.textPayload) {
|
|
317
|
+
msg = entry.metadata.textPayload;
|
|
318
|
+
}
|
|
319
|
+
if (entry.metadata.httpRequest) {
|
|
320
|
+
const request = entry.metadata.httpRequest;
|
|
321
|
+
const status = (_a = request.status) !== null && _a !== void 0 ? _a : '';
|
|
322
|
+
let ms = 'unknown';
|
|
323
|
+
const latency = request.latency;
|
|
324
|
+
if (latency) {
|
|
325
|
+
ms = (Number(latency.seconds) * 1000 + Math.round(Number(latency.nanos) / 1000000)).toString();
|
|
326
|
+
}
|
|
327
|
+
const bytes = utils_1.formatBytes(Number(request.responseSize));
|
|
328
|
+
const method = (_b = request.requestMethod) !== null && _b !== void 0 ? _b : '';
|
|
329
|
+
const requestUrl = (_c = request.requestUrl) !== null && _c !== void 0 ? _c : '';
|
|
330
|
+
msg += `${method} ${status}. responseSize: ${bytes}. latency: ${ms} ms. requestUrl: ${requestUrl}`;
|
|
331
|
+
}
|
|
332
|
+
const log = {
|
|
333
|
+
severity: (_e = (_d = entry.metadata.severity) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : '',
|
|
334
|
+
timestamp: (_g = (_f = entry.metadata.timestamp) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _g !== void 0 ? _g : '',
|
|
335
|
+
logName: (_h = entry.metadata.logName) !== null && _h !== void 0 ? _h : '',
|
|
336
|
+
message: `"${msg}"`,
|
|
337
|
+
};
|
|
338
|
+
logs.push(log);
|
|
339
|
+
}
|
|
340
|
+
return logs;
|
|
341
|
+
});
|
|
342
|
+
exports.getLogs = getLogs;
|
|
343
|
+
/**
|
|
344
|
+
* Save logs in a CSV format
|
|
345
|
+
* @param logs array of logs stored as CloudRunLog interfaces
|
|
346
|
+
* @param filePath path to save the CSV file
|
|
347
|
+
*/
|
|
348
|
+
const saveLogsFile = (logs, filePath) => {
|
|
349
|
+
const rows = [['severity', 'timestamp', 'logName', 'message']];
|
|
350
|
+
logs.forEach((log) => {
|
|
351
|
+
const severity = `"${log.severity}"`;
|
|
352
|
+
const timestamp = `"${log.timestamp}"`;
|
|
353
|
+
const logName = `"${log.logName}"`;
|
|
354
|
+
const logMessage = `"${log.message}"`;
|
|
355
|
+
rows.push([severity, timestamp, logName, logMessage]);
|
|
356
|
+
});
|
|
357
|
+
const data = rows.join('\n');
|
|
358
|
+
fs_2.writeFile(filePath, data);
|
|
359
|
+
};
|
|
360
|
+
exports.saveLogsFile = saveLogsFile;
|
|
361
|
+
CloudRunFlareCommand.addPath('cloud-run', 'flare');
|
|
362
|
+
CloudRunFlareCommand.addOption('isDryRun', clipanion_1.Command.Boolean('-d,--dry'));
|
|
363
|
+
CloudRunFlareCommand.addOption('withLogs', clipanion_1.Command.Boolean('--with-logs'));
|
|
364
|
+
CloudRunFlareCommand.addOption('service', clipanion_1.Command.String('-s,--service'));
|
|
365
|
+
CloudRunFlareCommand.addOption('project', clipanion_1.Command.String('-p,--project'));
|
|
366
|
+
CloudRunFlareCommand.addOption('region', clipanion_1.Command.String('-r,--region,-l,--location'));
|
|
367
|
+
CloudRunFlareCommand.addOption('caseId', clipanion_1.Command.String('-c,--case-id'));
|
|
368
|
+
CloudRunFlareCommand.addOption('email', clipanion_1.Command.String('-e,--email'));
|
|
369
|
+
//# sourceMappingURL=flare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flare.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/flare.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAAmB;AACnB,gDAAuB;AACvB,sDAA6B;AAC7B,gDAAuB;AAEvB,mDAA6C;AAC7C,2CAAgD;AAEhD,kDAAyB;AACzB,yCAAiC;AACjC,6DAA8C;AAE9C,+CAA2G;AAC3G,+CAAiD;AAC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AAA;AACzE,oBAAoB,CAAC,SAAS,CAAC,SAAS,EAAE,mBAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;AACzE,oBAAoB,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAA;AACrF,oBAAoB,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;AACxE,oBAAoB,CAAC,SAAS,CAAC,OAAO,EAAE,mBAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summarize relevant information about a Cloud Run log.
|
|
3
|
+
* Also used to build CSV log files.
|
|
4
|
+
* @typedef {Object} CloudRunLog
|
|
5
|
+
* @property {string} severity - The level of severity of the log. It can be values such as 'DEBUG', 'INFO', 'ERROR', etc.
|
|
6
|
+
* @property {string} timestamp - The timestamp of when the log was generated.
|
|
7
|
+
* @property {string} logName - The name of the log
|
|
8
|
+
* @property {string} message - The actual log message detailing what event occurred.
|
|
9
|
+
*/
|
|
10
|
+
export interface CloudRunLog {
|
|
11
|
+
severity: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
logName: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Contains all the information used to create a log file.
|
|
18
|
+
* @typedef {Object} LogConfig
|
|
19
|
+
* @property {string} type - string name of the type of log. Used when printing CLI messages.
|
|
20
|
+
* @property {string} fileName - The name of the log file (such as 'all_logs.csv' or 'error_logs.csv')
|
|
21
|
+
* @property {string} [severityFilter] - Optional filter to modify the Logging query. Example: ' AND severity="DEBUG"'
|
|
22
|
+
*/
|
|
23
|
+
export interface LogConfig {
|
|
24
|
+
type: string;
|
|
25
|
+
fileName: string;
|
|
26
|
+
severityFilter?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.renderAuthenticationInstructions = void 0;
|
|
23
|
+
const helpersRenderer = __importStar(require("../../helpers/renderer"));
|
|
24
|
+
const AUTHENTICATION_INSTRUCTIONS = [
|
|
25
|
+
'\n' + helpersRenderer.renderError('Unable to authenticate with GCP.'),
|
|
26
|
+
'To authenticate with GCP, please follow these steps:',
|
|
27
|
+
"1. If you haven't already, install the Google Cloud SDK: https://cloud.google.com/sdk/docs/install",
|
|
28
|
+
'2. Run "gcloud auth application-default login" and follow the prompts in your browser to log in.',
|
|
29
|
+
'3. After logging in, run the `datadog-ci cloud-run flare` command again.\n',
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* @returns instructions on how to authenticate with GCP.
|
|
33
|
+
*/
|
|
34
|
+
const renderAuthenticationInstructions = () => {
|
|
35
|
+
return AUTHENTICATION_INSTRUCTIONS.join('\n');
|
|
36
|
+
};
|
|
37
|
+
exports.renderAuthenticationInstructions = renderAuthenticationInstructions;
|
|
38
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/renderer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAyD;AAEzD,MAAM,2BAA2B,GAAG;IAClC,IAAI,GAAG,eAAe,CAAC,WAAW,CAAC,kCAAkC,CAAC;IACtE,sDAAsD;IACtD,oGAAoG;IACpG,kGAAkG;IAClG,4EAA4E;CAC7E,CAAA;AACD;;GAEG;AACI,MAAM,gCAAgC,GAAG,GAAG,EAAE;IACnD,OAAO,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC/C,CAAC,CAAA;AAFY,QAAA,gCAAgC,oCAE5C"}
|
|
@@ -20,6 +20,8 @@ const renderCommandInfo = (dryRun, version, service, flavor, uploadInfo) => {
|
|
|
20
20
|
});
|
|
21
21
|
const serviceVersionProjectPathStr = chalk_1.default.green(` version: ${version} service: ${service} flavor: ${flavor}\n`);
|
|
22
22
|
fullString += serviceVersionProjectPathStr;
|
|
23
|
+
fullString += chalk_1.default.green(`Please ensure you use the same values during SDK initialization to guarantee the success of the symbolication process.\n`);
|
|
24
|
+
fullString += chalk_1.default.green(`After upload is successful symbol files will be processed and ready to use within the next 5 minutes.\n`);
|
|
23
25
|
return fullString;
|
|
24
26
|
};
|
|
25
27
|
exports.renderCommandInfo = renderCommandInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/flutter-symbols/renderer.ts"],"names":[],"mappings":";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AAkB,sBAI9B;AAEM,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAE,YAAoB,EAAE,OAAe,EAAE,EAAE;IAC7F,MAAM,iBAAiB,GAAG,IAAI,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAA;IAEzD,OAAO,eAAK,CAAC,MAAM,CAAC,YAAY,OAAO,qBAAqB,iBAAiB,KAAK,YAAY,IAAI,CAAC,CAAA;AACrG,CAAC,CAAA;AAJY,QAAA,mBAAmB,uBAI/B;AAEM,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAU,EAAE,CAAC,aAAa,IAAI,IAAI,QAAQ,IAAI,CAAA;AAA5F,QAAA,YAAY,gBAAgF"}
|
|
@@ -14,10 +14,14 @@ const utils_1 = require("../../helpers/utils");
|
|
|
14
14
|
const evaluateGateRules = (request) => (evaluateRequest, write) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const payload = JSON.stringify({
|
|
16
16
|
data: {
|
|
17
|
+
id: evaluateRequest.requestId,
|
|
17
18
|
type: 'gate_evaluation',
|
|
18
19
|
attributes: {
|
|
19
20
|
tags: evaluateRequest.spanTags,
|
|
20
21
|
user_scope: evaluateRequest.userScope,
|
|
22
|
+
options: {
|
|
23
|
+
dry_run: evaluateRequest.options.dryRun,
|
|
24
|
+
},
|
|
21
25
|
},
|
|
22
26
|
},
|
|
23
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/commands/gate/api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,+CAAqD;AAI9C,MAAM,iBAAiB,GAAG,CAC/B,OAA8E,EAC9E,EAAE,CAAC,CAAO,eAAwB,EAAE,KAAwB,EAAE,EAAE;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,IAAI,EAAE;YACJ,IAAI,EAAE,iBAAiB;YACvB,UAAU,EAAE;gBACV,IA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