@datadog/datadog-ci-plugin-ecs-fargate 5.28.0 → 5.29.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/bundle.js CHANGED
@@ -33,13 +33,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  }) : target, mod));
34
34
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
  //#endregion
36
+ let util = require("util");
37
+ let os = require("os");
38
+ os = __toESM(os);
36
39
  let node_child_process = require("node:child_process");
37
40
  let node_path = require("node:path");
38
41
  node_path = __toESM(node_path);
39
42
  let node_util = require("node:util");
40
- let os = require("os");
41
- os = __toESM(os);
42
- let util = require("util");
43
43
  let node_async_hooks = require("node:async_hooks");
44
44
  let node_process = require("node:process");
45
45
  node_process = __toESM(node_process);
@@ -3066,6 +3066,419 @@ var require_advanced = /* @__PURE__ */ __commonJSMin(((exports) => {
3066
3066
  exports.Option = advanced_options_index;
3067
3067
  }));
3068
3068
  //#endregion
3069
+ //#region ../../node_modules/ansi-escapes/index.js
3070
+ var require_ansi_escapes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3071
+ const ansiEscapes = module.exports;
3072
+ module.exports.default = ansiEscapes;
3073
+ const ESC = "\x1B[";
3074
+ const OSC = "\x1B]";
3075
+ const BEL = "\x07";
3076
+ const SEP = ";";
3077
+ const isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
3078
+ ansiEscapes.cursorTo = (x, y) => {
3079
+ if (typeof x !== "number") throw new TypeError("The `x` argument is required");
3080
+ if (typeof y !== "number") return ESC + (x + 1) + "G";
3081
+ return ESC + (y + 1) + ";" + (x + 1) + "H";
3082
+ };
3083
+ ansiEscapes.cursorMove = (x, y) => {
3084
+ if (typeof x !== "number") throw new TypeError("The `x` argument is required");
3085
+ let ret = "";
3086
+ if (x < 0) ret += ESC + -x + "D";
3087
+ else if (x > 0) ret += ESC + x + "C";
3088
+ if (y < 0) ret += ESC + -y + "A";
3089
+ else if (y > 0) ret += ESC + y + "B";
3090
+ return ret;
3091
+ };
3092
+ ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
3093
+ ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
3094
+ ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
3095
+ ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
3096
+ ansiEscapes.cursorLeft = ESC + "G";
3097
+ ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
3098
+ ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
3099
+ ansiEscapes.cursorGetPosition = ESC + "6n";
3100
+ ansiEscapes.cursorNextLine = ESC + "E";
3101
+ ansiEscapes.cursorPrevLine = ESC + "F";
3102
+ ansiEscapes.cursorHide = ESC + "?25l";
3103
+ ansiEscapes.cursorShow = ESC + "?25h";
3104
+ ansiEscapes.eraseLines = (count) => {
3105
+ let clear = "";
3106
+ for (let i = 0; i < count; i++) clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
3107
+ if (count) clear += ansiEscapes.cursorLeft;
3108
+ return clear;
3109
+ };
3110
+ ansiEscapes.eraseEndLine = ESC + "K";
3111
+ ansiEscapes.eraseStartLine = ESC + "1K";
3112
+ ansiEscapes.eraseLine = ESC + "2K";
3113
+ ansiEscapes.eraseDown = ESC + "J";
3114
+ ansiEscapes.eraseUp = ESC + "1J";
3115
+ ansiEscapes.eraseScreen = ESC + "2J";
3116
+ ansiEscapes.scrollUp = ESC + "S";
3117
+ ansiEscapes.scrollDown = ESC + "T";
3118
+ ansiEscapes.clearScreen = "\x1Bc";
3119
+ ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
3120
+ ansiEscapes.beep = BEL;
3121
+ ansiEscapes.link = (text, url) => {
3122
+ return [
3123
+ OSC,
3124
+ "8",
3125
+ SEP,
3126
+ SEP,
3127
+ url,
3128
+ BEL,
3129
+ text,
3130
+ OSC,
3131
+ "8",
3132
+ SEP,
3133
+ SEP,
3134
+ BEL
3135
+ ].join("");
3136
+ };
3137
+ ansiEscapes.image = (buffer, options = {}) => {
3138
+ let ret = `${OSC}1337;File=inline=1`;
3139
+ if (options.width) ret += `;width=${options.width}`;
3140
+ if (options.height) ret += `;height=${options.height}`;
3141
+ if (options.preserveAspectRatio === false) ret += ";preserveAspectRatio=0";
3142
+ return ret + ":" + buffer.toString("base64") + BEL;
3143
+ };
3144
+ ansiEscapes.iTerm = {
3145
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
3146
+ annotation: (message, options = {}) => {
3147
+ let ret = `${OSC}1337;`;
3148
+ const hasX = typeof options.x !== "undefined";
3149
+ const hasY = typeof options.y !== "undefined";
3150
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
3151
+ message = message.replace(/\|/g, "");
3152
+ ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
3153
+ if (options.length > 0) ret += (hasX ? [
3154
+ message,
3155
+ options.length,
3156
+ options.x,
3157
+ options.y
3158
+ ] : [options.length, message]).join("|");
3159
+ else ret += message;
3160
+ return ret + BEL;
3161
+ }
3162
+ };
3163
+ }));
3164
+ //#endregion
3165
+ //#region ../../node_modules/has-flag/index.js
3166
+ var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3167
+ module.exports = (flag, argv = process.argv) => {
3168
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
3169
+ const position = argv.indexOf(prefix + flag);
3170
+ const terminatorPosition = argv.indexOf("--");
3171
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
3172
+ };
3173
+ }));
3174
+ //#endregion
3175
+ //#region ../../node_modules/supports-color/index.js
3176
+ var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3177
+ const os$2 = require("os");
3178
+ const tty$2 = require("tty");
3179
+ const hasFlag = require_has_flag();
3180
+ const { env } = process;
3181
+ let forceColor;
3182
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
3183
+ else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
3184
+ if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
3185
+ else if (env.FORCE_COLOR === "false") forceColor = 0;
3186
+ else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
3187
+ function translateLevel(level) {
3188
+ if (level === 0) return false;
3189
+ return {
3190
+ level,
3191
+ hasBasic: true,
3192
+ has256: level >= 2,
3193
+ has16m: level >= 3
3194
+ };
3195
+ }
3196
+ function supportsColor(haveStream, streamIsTTY) {
3197
+ if (forceColor === 0) return 0;
3198
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
3199
+ if (hasFlag("color=256")) return 2;
3200
+ if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
3201
+ const min = forceColor || 0;
3202
+ if (env.TERM === "dumb") return min;
3203
+ if (process.platform === "win32") {
3204
+ const osRelease = os$2.release().split(".");
3205
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
3206
+ return 1;
3207
+ }
3208
+ if ("CI" in env) {
3209
+ if ([
3210
+ "TRAVIS",
3211
+ "CIRCLECI",
3212
+ "APPVEYOR",
3213
+ "GITLAB_CI",
3214
+ "GITHUB_ACTIONS",
3215
+ "BUILDKITE"
3216
+ ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
3217
+ return min;
3218
+ }
3219
+ if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3220
+ if (env.COLORTERM === "truecolor") return 3;
3221
+ if ("TERM_PROGRAM" in env) {
3222
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
3223
+ switch (env.TERM_PROGRAM) {
3224
+ case "iTerm.app": return version >= 3 ? 3 : 2;
3225
+ case "Apple_Terminal": return 2;
3226
+ }
3227
+ }
3228
+ if (/-256(color)?$/i.test(env.TERM)) return 2;
3229
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
3230
+ if ("COLORTERM" in env) return 1;
3231
+ return min;
3232
+ }
3233
+ function getSupportLevel(stream) {
3234
+ return translateLevel(supportsColor(stream, stream && stream.isTTY));
3235
+ }
3236
+ module.exports = {
3237
+ supportsColor: getSupportLevel,
3238
+ stdout: translateLevel(supportsColor(true, tty$2.isatty(1))),
3239
+ stderr: translateLevel(supportsColor(true, tty$2.isatty(2)))
3240
+ };
3241
+ }));
3242
+ //#endregion
3243
+ //#region ../../node_modules/supports-hyperlinks/index.js
3244
+ var require_supports_hyperlinks = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3245
+ const supportsColor = require_supports_color();
3246
+ const hasFlag = require_has_flag();
3247
+ function parseVersion(versionString) {
3248
+ if (/^\d{3,4}$/.test(versionString)) {
3249
+ const m = /(\d{1,2})(\d{2})/.exec(versionString);
3250
+ return {
3251
+ major: 0,
3252
+ minor: parseInt(m[1], 10),
3253
+ patch: parseInt(m[2], 10)
3254
+ };
3255
+ }
3256
+ const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
3257
+ return {
3258
+ major: versions[0],
3259
+ minor: versions[1],
3260
+ patch: versions[2]
3261
+ };
3262
+ }
3263
+ function supportsHyperlink(stream) {
3264
+ const { env } = process;
3265
+ if ("FORCE_HYPERLINK" in env) return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
3266
+ if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) return false;
3267
+ if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) return true;
3268
+ if ("NETLIFY" in env) return true;
3269
+ if (!supportsColor.supportsColor(stream)) return false;
3270
+ if (stream && !stream.isTTY) return false;
3271
+ if (process.platform === "win32") return false;
3272
+ if ("CI" in env) return false;
3273
+ if ("TEAMCITY_VERSION" in env) return false;
3274
+ if ("TERM_PROGRAM" in env) {
3275
+ const version = parseVersion(env.TERM_PROGRAM_VERSION);
3276
+ switch (env.TERM_PROGRAM) {
3277
+ case "iTerm.app":
3278
+ if (version.major === 3) return version.minor >= 1;
3279
+ return version.major > 3;
3280
+ case "WezTerm": return version.major >= 20200620;
3281
+ case "vscode": return version.major > 1 || version.major === 1 && version.minor >= 72;
3282
+ }
3283
+ }
3284
+ if ("VTE_VERSION" in env) {
3285
+ if (env.VTE_VERSION === "0.50.0") return false;
3286
+ const version = parseVersion(env.VTE_VERSION);
3287
+ return version.major > 0 || version.minor >= 50;
3288
+ }
3289
+ return false;
3290
+ }
3291
+ module.exports = {
3292
+ supportsHyperlink,
3293
+ stdout: supportsHyperlink(process.stdout),
3294
+ stderr: supportsHyperlink(process.stderr)
3295
+ };
3296
+ }));
3297
+ //#endregion
3298
+ //#region ../../node_modules/terminal-link/index.js
3299
+ var require_terminal_link$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3300
+ const ansiEscapes = require_ansi_escapes();
3301
+ const supportsHyperlinks = require_supports_hyperlinks();
3302
+ const terminalLink = (text, url, { target = "stdout", ...options } = {}) => {
3303
+ if (!supportsHyperlinks[target]) {
3304
+ if (options.fallback === false) return text;
3305
+ return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
3306
+ }
3307
+ return ansiEscapes.link(text, url);
3308
+ };
3309
+ module.exports = (text, url, options = {}) => terminalLink(text, url, options);
3310
+ module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {
3311
+ target: "stderr",
3312
+ ...options
3313
+ });
3314
+ module.exports.isSupported = supportsHyperlinks.stdout;
3315
+ module.exports.stderr.isSupported = supportsHyperlinks.stderr;
3316
+ }));
3317
+ //#endregion
3318
+ //#region ../base/dist/helpers/terminal-link.js
3319
+ var require_terminal_link = /* @__PURE__ */ __commonJSMin(((exports) => {
3320
+ var __importDefault = exports && exports.__importDefault || function(mod) {
3321
+ return mod && mod.__esModule ? mod : { "default": mod };
3322
+ };
3323
+ Object.defineProperty(exports, "__esModule", { value: true });
3324
+ exports.makeTerminalLink = void 0;
3325
+ const terminal_link_1 = __importDefault(require_terminal_link$1());
3326
+ const makeTerminalLink = (url) => {
3327
+ return ((strings) => (0, terminal_link_1.default)(strings[0], url));
3328
+ };
3329
+ exports.makeTerminalLink = makeTerminalLink;
3330
+ }));
3331
+ //#endregion
3332
+ //#region ../base/dist/helpers/auth.js
3333
+ var require_auth = /* @__PURE__ */ __commonJSMin(((exports) => {
3334
+ Object.defineProperty(exports, "__esModule", { value: true });
3335
+ exports.CliWithAuthHelp = exports.formatAuthHelp = exports.getAuthHelpForCommand = exports.getAuthRequirement = exports.getAuthHelp = exports.customAuth = exports.noAuth = exports.apiKeyAuth = exports.orgActionAuth = exports.getFlareAuthHelp = exports.getCloudCredentialsOnlyAuthHelp = exports.getServerlessInstrumentAuthHelp = exports.AUTH_HELP = exports.seeReadme = exports.wifLink = exports.WORKLOAD_IDENTITY_FEDERATION_DOCS_URL = exports.getMissingOrgCredentialsMessage = exports.hasOrgCredentials = exports.resolveOrgCredentials = exports.getAccessTokenFromEnv = exports.AUTHENTICATION_DOCS_URL = void 0;
3336
+ const util_1$2 = require("util");
3337
+ const clipanion_1 = require_advanced();
3338
+ const terminal_link_1 = require_terminal_link();
3339
+ /**
3340
+ * Shared Datadog credential handling.
3341
+ *
3342
+ * - "Data upload" commands only need an API key (DD_API_KEY). With Workload Identity Federation (WIF),
3343
+ * an intake mapping provides one.
3344
+ * - "Org action" commands act on behalf of a user or service account: they need an access token
3345
+ * (DD_ACCESS_TOKEN, sent as `Authorization: Bearer`) from a WIF identity mapping, or an API key and an
3346
+ * application key. An access token takes precedence over an application key.
3347
+ */
3348
+ exports.AUTHENTICATION_DOCS_URL = "https://github.com/DataDog/datadog-ci#authentication";
3349
+ /**
3350
+ * Read the access token from the environment, following the same `DATADOG_*` then `DD_*` order as the API and
3351
+ * application keys.
3352
+ */
3353
+ const getAccessTokenFromEnv = (env = process.env) => env.DATADOG_ACCESS_TOKEN || env.DD_ACCESS_TOKEN || void 0;
3354
+ exports.getAccessTokenFromEnv = getAccessTokenFromEnv;
3355
+ /**
3356
+ * Normalize org-action credentials: empty values are dropped, and an access token wins over an application key,
3357
+ * so the application key is dropped when a token is set. The API key is kept when provided.
3358
+ */
3359
+ const resolveOrgCredentials = ({ accessToken, apiKey, appKey }) => {
3360
+ if (accessToken) return {
3361
+ accessToken,
3362
+ apiKey: apiKey || void 0
3363
+ };
3364
+ return {
3365
+ apiKey: apiKey || void 0,
3366
+ appKey: appKey || void 0
3367
+ };
3368
+ };
3369
+ exports.resolveOrgCredentials = resolveOrgCredentials;
3370
+ const hasOrgCredentials = (credentials) => !!credentials.accessToken || !!credentials.apiKey && !!credentials.appKey;
3371
+ exports.hasOrgCredentials = hasOrgCredentials;
3372
+ /**
3373
+ * Explain which credentials an org-action command is missing, or return `undefined` when the credentials are enough:
3374
+ * an access token, or an API key and an application key.
3375
+ */
3376
+ const getMissingOrgCredentialsMessage = (commandName, credentials) => {
3377
+ if ((0, exports.hasOrgCredentials)(credentials)) return;
3378
+ const identityMappingHint = "With Workload Identity Federation, use an identity mapping to get an access token: an intake mapping only provides an API key.";
3379
+ if (credentials.apiKey) return `\`${commandName}\` needs an application key (DD_APP_KEY) or an access token (DD_ACCESS_TOKEN). An intake mapping only provides an API key: use a Workload Identity Federation identity mapping to get an access token. See ${exports.AUTHENTICATION_DOCS_URL}`;
3380
+ if (credentials.appKey) return `\`${commandName}\` needs an API key (DD_API_KEY) to go with the application key, or an access token (DD_ACCESS_TOKEN). ${identityMappingHint} See ${exports.AUTHENTICATION_DOCS_URL}`;
3381
+ return `\`${commandName}\` needs an access token (DD_ACCESS_TOKEN), or an API key (DD_API_KEY) and an application key (DD_APP_KEY). ${identityMappingHint} See ${exports.AUTHENTICATION_DOCS_URL}`;
3382
+ };
3383
+ exports.getMissingOrgCredentialsMessage = getMissingOrgCredentialsMessage;
3384
+ exports.WORKLOAD_IDENTITY_FEDERATION_DOCS_URL = "https://docs.datadoghq.com/account_management/workload_identity_federation/";
3385
+ /** "Workload Identity Federation" as a terminal link to its docs. */
3386
+ exports.wifLink = (0, terminal_link_1.makeTerminalLink)(exports.WORKLOAD_IDENTITY_FEDERATION_DOCS_URL)`Workload Identity Federation`;
3387
+ /** The last line of every authentication help text. */
3388
+ exports.seeReadme = `See ${exports.AUTHENTICATION_DOCS_URL}`;
3389
+ /**
3390
+ * Bodies of the "Authentication" section of `--help`. Paragraphs are separated by a blank line, and a single newline is
3391
+ * a hard line break. Each body ends with "See <README URL>" on its own short line, so the wrapper never splits it.
3392
+ */
3393
+ exports.AUTH_HELP = {
3394
+ apiKey: `This command sends telemetry to your org. As such, it requires an API key (DD_API_KEY), which a ${exports.wifLink} intake mapping can provide.\n\n${exports.seeReadme}`,
3395
+ orgAction: `This command calls Datadog API endpoints. As such, it requires either an API key (DD_API_KEY) and an application key (DD_APP_KEY), or an access token (DD_ACCESS_TOKEN) from a ${exports.wifLink} identity mapping.\n\n${exports.seeReadme}`,
3396
+ none: `This command does not need Datadog credentials.\n\n${exports.seeReadme}`
3397
+ };
3398
+ /**
3399
+ * Authentication help for Serverless `instrument` commands, which save the Datadog API key in the instrumented service.
3400
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
3401
+ * @param datadogCredentials - how the command reads the Datadog API key, for example "a Datadog API key (DD_API_KEY)".
3402
+ */
3403
+ const getServerlessInstrumentAuthHelp = (cloudCredentials, datadogCredentials) => `This command uses your ${cloudCredentials} and saves ${datadogCredentials} in the instrumented service, which uses it to send telemetry. As such, it requires a long-lived API key: a short-lived key from a ${exports.wifLink} intake mapping would expire.\n\n${exports.seeReadme}`;
3404
+ exports.getServerlessInstrumentAuthHelp = getServerlessInstrumentAuthHelp;
3405
+ /**
3406
+ * Authentication help for commands that only call the cloud provider, such as Serverless `uninstrument` commands.
3407
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
3408
+ */
3409
+ const getCloudCredentialsOnlyAuthHelp = (cloudCredentials) => `This command uses your ${cloudCredentials}. It does not need Datadog credentials.\n\n${exports.seeReadme}`;
3410
+ exports.getCloudCredentialsOnlyAuthHelp = getCloudCredentialsOnlyAuthHelp;
3411
+ /**
3412
+ * Authentication help for the Serverless `flare` commands, which read from the cloud provider and send a flare to Datadog.
3413
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
3414
+ */
3415
+ const getFlareAuthHelp = (cloudCredentials) => `This command uses your ${cloudCredentials} and sends a flare to Datadog support. As such, it requires an API key (DD_API_KEY), which a ${exports.wifLink} intake mapping can provide.\n\n${exports.seeReadme}`;
3416
+ exports.getFlareAuthHelp = getFlareAuthHelp;
3417
+ /** Calls Datadog API endpoints: an API key and an application key, or an access token. */
3418
+ exports.orgActionAuth = { kind: "orgAction" };
3419
+ /** Only sends telemetry: an API key. */
3420
+ exports.apiKeyAuth = { kind: "apiKey" };
3421
+ /** Does not need Datadog credentials. */
3422
+ exports.noAuth = { kind: "none" };
3423
+ /** A command-specific authentication help text. */
3424
+ const customAuth = (help) => ({
3425
+ kind: "custom",
3426
+ help
3427
+ });
3428
+ exports.customAuth = customAuth;
3429
+ const getAuthHelp = (requirement) => requirement.kind === "custom" ? requirement.help : exports.AUTH_HELP[requirement.kind];
3430
+ exports.getAuthHelp = getAuthHelp;
3431
+ /** The authentication requirement a command class declares, if any. */
3432
+ const getAuthRequirement = (commandClass) => commandClass.authRequirement;
3433
+ exports.getAuthRequirement = getAuthRequirement;
3434
+ /** The authentication help of a command, from the `authRequirement` its class declares. */
3435
+ const getAuthHelpForCommand = (commandClass) => {
3436
+ const requirement = (0, exports.getAuthRequirement)(commandClass);
3437
+ return requirement ? (0, exports.getAuthHelp)(requirement) : void 0;
3438
+ };
3439
+ exports.getAuthHelpForCommand = getAuthHelpForCommand;
3440
+ const HELP_WIDTH = 80;
3441
+ const WORD_REGEX = /\u001B\]8;;[^\u0007]*\u0007[^\u001B]*\u001B\]8;;\u0007\S*|\S+/g;
3442
+ /** Wrap a line at 80 visible characters, like Clipanion does for `Details`, without splitting terminal links. */
3443
+ const wrapLine = (line) => {
3444
+ var _a;
3445
+ const lines = [];
3446
+ let current = "";
3447
+ for (const word of (_a = line.match(WORD_REGEX)) !== null && _a !== void 0 ? _a : []) {
3448
+ const candidate = current ? `${current} ${word}` : word;
3449
+ if (current && (0, util_1$2.stripVTControlCharacters)(candidate).length > HELP_WIDTH) {
3450
+ lines.push(current);
3451
+ current = word;
3452
+ } else current = candidate;
3453
+ }
3454
+ lines.push(current);
3455
+ return lines.join("\n");
3456
+ };
3457
+ /** Format an authentication help text: paragraphs separated by a blank line, single newlines kept as line breaks. */
3458
+ const formatAuthHelp = (text) => `${text.split("\n\n").map((paragraph) => paragraph.split("\n").map(wrapLine).join("\n")).join("\n\n")}\n`;
3459
+ exports.formatAuthHelp = formatAuthHelp;
3460
+ /**
3461
+ * A Clipanion `Cli` whose detailed `--help` has an "Authentication" section, after "Details" and before "Examples",
3462
+ * for every command that declares an `authRequirement`. The section is rendered with Clipanion's own header style.
3463
+ *
3464
+ * Every help route goes through `Cli.usage()`: `<command> --help` and `-h` (through the builtin `HelpCommand`) and
3465
+ * `Cli.run` for a command with `help` set. The command's `usage.details` is left unchanged.
3466
+ */
3467
+ var CliWithAuthHelp = class extends clipanion_1.Cli {
3468
+ usage(command = null, opts = {}) {
3469
+ const result = super.usage(command, opts);
3470
+ const commandClass = command instanceof clipanion_1.Command ? command.constructor : command;
3471
+ const help = opts.detailed && commandClass ? (0, exports.getAuthHelpForCommand)(commandClass) : void 0;
3472
+ if (!help) return result;
3473
+ const format = this.format(opts.colored);
3474
+ const section = `\n${format.header("Authentication")}\n\n${(0, exports.formatAuthHelp)(help)}`;
3475
+ const examplesIndex = result.indexOf(`\n${format.header("Examples")}\n`);
3476
+ return examplesIndex === -1 ? `${result}${section}` : `${result.slice(0, examplesIndex)}${section}${result.slice(examplesIndex)}`;
3477
+ }
3478
+ };
3479
+ exports.CliWithAuthHelp = CliWithAuthHelp;
3480
+ }));
3481
+ //#endregion
3069
3482
  //#region ../../node_modules/color-name/index.js
3070
3483
  var require_color_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3071
3484
  module.exports = {
@@ -4836,84 +5249,6 @@ var require_ansi_styles$1 = /* @__PURE__ */ __commonJSMin(((exports, module) =>
4836
5249
  });
4837
5250
  }));
4838
5251
  //#endregion
4839
- //#region ../../node_modules/has-flag/index.js
4840
- var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4841
- module.exports = (flag, argv = process.argv) => {
4842
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
4843
- const position = argv.indexOf(prefix + flag);
4844
- const terminatorPosition = argv.indexOf("--");
4845
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4846
- };
4847
- }));
4848
- //#endregion
4849
- //#region ../../node_modules/supports-color/index.js
4850
- var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4851
- const os$2 = require("os");
4852
- const tty$2 = require("tty");
4853
- const hasFlag = require_has_flag();
4854
- const { env } = process;
4855
- let forceColor;
4856
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
4857
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
4858
- if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
4859
- else if (env.FORCE_COLOR === "false") forceColor = 0;
4860
- else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
4861
- function translateLevel(level) {
4862
- if (level === 0) return false;
4863
- return {
4864
- level,
4865
- hasBasic: true,
4866
- has256: level >= 2,
4867
- has16m: level >= 3
4868
- };
4869
- }
4870
- function supportsColor(haveStream, streamIsTTY) {
4871
- if (forceColor === 0) return 0;
4872
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
4873
- if (hasFlag("color=256")) return 2;
4874
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
4875
- const min = forceColor || 0;
4876
- if (env.TERM === "dumb") return min;
4877
- if (process.platform === "win32") {
4878
- const osRelease = os$2.release().split(".");
4879
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
4880
- return 1;
4881
- }
4882
- if ("CI" in env) {
4883
- if ([
4884
- "TRAVIS",
4885
- "CIRCLECI",
4886
- "APPVEYOR",
4887
- "GITLAB_CI",
4888
- "GITHUB_ACTIONS",
4889
- "BUILDKITE"
4890
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
4891
- return min;
4892
- }
4893
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
4894
- if (env.COLORTERM === "truecolor") return 3;
4895
- if ("TERM_PROGRAM" in env) {
4896
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
4897
- switch (env.TERM_PROGRAM) {
4898
- case "iTerm.app": return version >= 3 ? 3 : 2;
4899
- case "Apple_Terminal": return 2;
4900
- }
4901
- }
4902
- if (/-256(color)?$/i.test(env.TERM)) return 2;
4903
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
4904
- if ("COLORTERM" in env) return 1;
4905
- return min;
4906
- }
4907
- function getSupportLevel(stream) {
4908
- return translateLevel(supportsColor(stream, stream && stream.isTTY));
4909
- }
4910
- module.exports = {
4911
- supportsColor: getSupportLevel,
4912
- stdout: translateLevel(supportsColor(true, tty$2.isatty(1))),
4913
- stderr: translateLevel(supportsColor(true, tty$2.isatty(2)))
4914
- };
4915
- }));
4916
- //#endregion
4917
5252
  //#region ../../node_modules/chalk/source/util.js
4918
5253
  var require_util$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4919
5254
  const stringReplaceAll = (string, substring, replacer) => {
@@ -5931,7 +6266,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5931
6266
  var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5932
6267
  module.exports = {
5933
6268
  "name": "@datadog/datadog-ci-base",
5934
- "version": "5.28.0",
6269
+ "version": "5.29.0",
5935
6270
  "description": "Base package for Datadog CI",
5936
6271
  "license": "Apache-2.0",
5937
6272
  "keywords": ["datadog", "datadog-ci"],
@@ -7499,7 +7834,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
7499
7834
  //#region ../base/dist/helpers/serverless/constants.js
7500
7835
  var require_constants$10 = /* @__PURE__ */ __commonJSMin(((exports) => {
7501
7836
  Object.defineProperty(exports, "__esModule", { value: true });
7502
- exports.ENV_VAR_REGEX = exports.DEFAULT_HEALTH_CHECK_PORT = exports.DEFAULT_LOGS_PATH = exports.DEFAULT_VOLUME_PATH = exports.DEFAULT_VOLUME_NAME = exports.DEFAULT_SIDECAR_NAME = exports.SIDECAR_PORT = exports.AGENT_IMAGE = exports.SIDECAR_IMAGE = exports.SIDECAR_CONTAINER_NAME = exports.FLARE_PROJECT_FILES = exports.INSIGHTS_FILE_NAME = exports.ADDITIONAL_FILES_DIRECTORY = exports.PROJECT_FILES_DIRECTORY = exports.LOGS_DIRECTORY = exports.FLARE_OUTPUT_DIRECTORY = exports.EXTRA_TAGS_REG_EXP = exports.VERSION_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.SERVICE_ENV_VAR = exports.DD_SOURCE_ENV_VAR = exports.DD_TAGS_ENV_VAR = exports.DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR = exports.DD_LLMOBS_ML_APP_ENV_VAR = exports.DD_LLMOBS_ENABLED_ENV_VAR = exports.DD_APPSEC_ENABLED_ENV_VAR = exports.DD_TRACE_ENABLED_ENV_VAR = exports.DD_LOG_LEVEL_ENV_VAR = exports.HEALTH_PORT_ENV_VAR = exports.LOGS_PATH_ENV_VAR = exports.LOGS_INJECTION_ENV_VAR = exports.SITE_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.API_KEY_ENV_VAR = void 0;
7837
+ exports.ENV_VAR_REGEX = exports.DEFAULT_HEALTH_CHECK_PORT = exports.DEFAULT_LOGS_PATH = exports.DEFAULT_VOLUME_PATH = exports.DEFAULT_VOLUME_NAME = exports.DEFAULT_SIDECAR_NAME = exports.DOGSTATSD_PORT = exports.SIDECAR_PORT = exports.AGENT_IMAGE = exports.SIDECAR_IMAGE = exports.SIDECAR_CONTAINER_NAME = exports.FLARE_PROJECT_FILES = exports.INSIGHTS_FILE_NAME = exports.ADDITIONAL_FILES_DIRECTORY = exports.PROJECT_FILES_DIRECTORY = exports.LOGS_DIRECTORY = exports.FLARE_OUTPUT_DIRECTORY = exports.EXTRA_TAGS_REG_EXP = exports.VERSION_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.SERVICE_ENV_VAR = exports.DD_SOURCE_ENV_VAR = exports.DD_TAGS_ENV_VAR = exports.DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR = exports.DD_LLMOBS_ML_APP_ENV_VAR = exports.DD_LLMOBS_ENABLED_ENV_VAR = exports.DD_APPSEC_ENABLED_ENV_VAR = exports.DD_TRACE_ENABLED_ENV_VAR = exports.DD_LOG_LEVEL_ENV_VAR = exports.HEALTH_PORT_ENV_VAR = exports.LOGS_PATH_ENV_VAR = exports.LOGS_INJECTION_ENV_VAR = exports.SITE_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.API_KEY_ENV_VAR = void 0;
7503
7838
  exports.API_KEY_ENV_VAR = "DD_API_KEY";
7504
7839
  exports.CI_API_KEY_ENV_VAR = "DATADOG_API_KEY";
7505
7840
  exports.CI_SITE_ENV_VAR = "DATADOG_SITE";
@@ -7566,6 +7901,7 @@ var require_constants$10 = /* @__PURE__ */ __commonJSMin(((exports) => {
7566
7901
  exports.SIDECAR_IMAGE = "index.docker.io/datadog/serverless-init:latest";
7567
7902
  exports.AGENT_IMAGE = "public.ecr.aws/datadog/agent:latest";
7568
7903
  exports.SIDECAR_PORT = 8126;
7904
+ exports.DOGSTATSD_PORT = 8125;
7569
7905
  exports.DEFAULT_SIDECAR_NAME = "datadog-sidecar";
7570
7906
  exports.DEFAULT_VOLUME_NAME = "shared-volume";
7571
7907
  exports.DEFAULT_VOLUME_PATH = "/shared-volume";
@@ -32323,7 +32659,8 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
32323
32659
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
32324
32660
  data,
32325
32661
  status: response.status,
32326
- statusText: response.statusText
32662
+ statusText: response.statusText,
32663
+ headers: responseHeaders
32327
32664
  });
32328
32665
  return {
32329
32666
  config,
@@ -57982,14 +58319,14 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
57982
58319
  };
57983
58320
  exports.getProxyUrl = getProxyUrl;
57984
58321
  const getRequestBuilder = (options) => {
57985
- const { apiKey, appKey, baseUrl, overrideUrl, proxyOpts } = options;
58322
+ const { accessToken, apiKey, appKey, baseUrl, overrideUrl, proxyOpts } = options;
57986
58323
  const proxyUrlFromConfiguration = (0, exports.getProxyUrl)(proxyOpts);
57987
58324
  const dispatcher = (0, request_1.getProxyDispatcher)(proxyUrlFromConfiguration);
57988
58325
  const overrideArgs = (args) => {
57989
58326
  const newArguments = Object.assign(Object.assign({}, args), {
57990
58327
  baseURL: baseUrl,
57991
58328
  dispatcher,
57992
- headers: Object.assign(Object.assign({ "DD-API-KEY": apiKey }, appKey ? { "DD-APPLICATION-KEY": appKey } : {}), args.headers)
58329
+ headers: Object.assign(Object.assign(Object.assign({}, apiKey ? { "DD-API-KEY": apiKey } : {}), accessToken ? { Authorization: `Bearer ${accessToken}` } : appKey ? { "DD-APPLICATION-KEY": appKey } : {}), args.headers)
57993
58330
  });
57994
58331
  if (overrideUrl !== void 0) newArguments.url = overrideUrl;
57995
58332
  if (options.headers !== void 0) options.headers.forEach((value, key) => {
@@ -58508,6 +58845,7 @@ var require_instrument = /* @__PURE__ */ __commonJSMin(((exports) => {
58508
58845
  exports.EcsFargateInstrumentCommand = void 0;
58509
58846
  const clipanion_1 = require_advanced();
58510
58847
  const t = __importStar(require_lib$3());
58848
+ const auth_1 = require_auth();
58511
58849
  const plugin_1 = require_plugin();
58512
58850
  const constants_1 = require_constants$10();
58513
58851
  const injection_spec_1 = require_injection_spec();
@@ -58589,6 +58927,7 @@ var require_instrument = /* @__PURE__ */ __commonJSMin(((exports) => {
58589
58927
  category: "Serverless",
58590
58928
  description: "Apply Datadog instrumentation to an Amazon ECS Fargate task definition."
58591
58929
  });
58930
+ EcsFargateInstrumentCommand.authRequirement = (0, auth_1.customAuth)((0, auth_1.getServerlessInstrumentAuthHelp)("AWS credentials", "a Datadog API key (DD_API_KEY, or a secret passed with --api-key-secret-arn)"));
58592
58931
  }));
58593
58932
  //#endregion
58594
58933
  //#region ../base/dist/helpers/api.js
@@ -61661,7 +62000,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
61661
62000
  return mod && mod.__esModule ? mod : { "default": mod };
61662
62001
  };
61663
62002
  Object.defineProperty(exports, "__esModule", { value: true });
61664
- exports.createInstrumentedTemplate = exports.byName = exports.generateConfigDiff = exports.sortedEqual = exports.getBaseEnvVars = exports.collectAsyncIterator = exports.parseEnvVars = void 0;
62003
+ exports.assertAppPortsAvoidSidecarPorts = exports.AGENT_DOGSTATSD_PORT = exports.AGENT_TRACE_PORT = exports.createInstrumentedTemplate = exports.byName = exports.generateConfigDiff = exports.sortedEqual = exports.getBaseEnvVars = exports.collectAsyncIterator = exports.parseEnvVars = void 0;
61665
62004
  const node_util_1 = require("node:util");
61666
62005
  const chalk_1 = __importDefault(require_source$1());
61667
62006
  const jest_diff_1 = require_build();
@@ -61860,6 +62199,29 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
61860
62199
  });
61861
62200
  };
61862
62201
  exports.createInstrumentedTemplate = createInstrumentedTemplate;
62202
+ exports.AGENT_TRACE_PORT = {
62203
+ port: constants_2.SIDECAR_PORT,
62204
+ name: "Datadog Agent trace port"
62205
+ };
62206
+ exports.AGENT_DOGSTATSD_PORT = {
62207
+ port: constants_2.DOGSTATSD_PORT,
62208
+ protocol: "udp",
62209
+ name: "Datadog Agent DogStatsD UDP port"
62210
+ };
62211
+ /** Rejects an application port that a sidecar also binds, since only one of them can listen on it. */
62212
+ const assertAppPortsAvoidSidecarPorts = (appPorts, sidecarPorts) => {
62213
+ for (const { port, lastPort = port, protocol = "tcp", source } of appPorts) {
62214
+ const sidecarPort = sidecarPorts.find((candidate) => {
62215
+ var _a;
62216
+ return ((_a = candidate.protocol) !== null && _a !== void 0 ? _a : "tcp") === protocol && port <= candidate.port && candidate.port <= lastPort;
62217
+ });
62218
+ if (sidecarPort) {
62219
+ const isRange = lastPort !== port;
62220
+ throw new Error(`${isRange ? `Port range ${port}-${lastPort}` : `Port ${port}`} on ${source} conflicts with ${sidecarPort.name} ${sidecarPort.port}. Change the ${isRange ? "port range" : "port"} on ${source}${sidecarPort.flag ? ` or ${sidecarPort.flag}` : ""}.`);
62221
+ }
62222
+ }
62223
+ };
62224
+ exports.assertAppPortsAvoidSidecarPorts = assertAppPortsAvoidSidecarPorts;
61863
62225
  }));
61864
62226
  //#endregion
61865
62227
  //#region ../../node_modules/@simple-git/args-pathspec/dist/index.cjs
@@ -101386,6 +101748,7 @@ var require_upload = /* @__PURE__ */ __commonJSMin(((exports) => {
101386
101748
  const clipanion_1 = require_advanced();
101387
101749
  const constants_1 = require_constants$11();
101388
101750
  const apikey_1 = require_apikey();
101751
+ const auth_1 = require_auth();
101389
101752
  const env_1 = require_env$1();
101390
101753
  const errors_1 = require_errors$1();
101391
101754
  const fips_1 = require_fips();
@@ -101546,6 +101909,7 @@ var require_upload = /* @__PURE__ */ __commonJSMin(((exports) => {
101546
101909
  `,
101547
101910
  examples: [["Upload the current commit details", "datadog-ci report-commits upload"]]
101548
101911
  });
101912
+ GitMetadataUploadCommand.authRequirement = auth_1.apiKeyAuth;
101549
101913
  }));
101550
101914
  //#endregion
101551
101915
  //#region ../base/dist/helpers/serverless/source-code-integration.js
@@ -141555,6 +141919,15 @@ const instrumentTaskDefinition = (taskDefinition, settings, tags, ssiConfig) =>
141555
141919
  if (ssiConfig.kind === "single-language" && ssiConfig.language === "csharp" && isArm64Task(taskDefinition)) throw new import_config.SsiConfigError(`Task definition ${family} runs ARM64, which .NET automatic tracer injection does not support. Install the tracer in the application image and use --tracing manual, or use an X86_64 task.`);
141556
141920
  const source = removeSsiState(taskDefinition);
141557
141921
  const containers = source.containerDefinitions ?? [];
141922
+ (0, import_common.assertAppPortsAvoidSidecarPorts)(containers.filter((container) => !isSidecar(container)).flatMap((container) => (container.portMappings ?? []).flatMap(({ containerPort, containerPortRange, protocol }) => {
141923
+ const [port, lastPort] = containerPortRange?.split("-").map(Number) ?? [containerPort, containerPort];
141924
+ return port ? [{
141925
+ port,
141926
+ lastPort,
141927
+ protocol,
141928
+ source: `container '${container.name}'`
141929
+ }] : [];
141930
+ })), [import_common.AGENT_TRACE_PORT, import_common.AGENT_DOGSTATSD_PORT]);
141558
141931
  if ((0, import_config.isInjection)(ssiConfig)) assertInjectionEnvCanBeMerged(containers[selectApplicationContainer(containers, settings.containerName)], ssiConfig);
141559
141932
  const borrowed = borrowedLogConfiguration(containers);
141560
141933
  const sourceLanguage = ssiConfig.kind === "single-language" ? ssiConfig.language : settings.language;
@@ -141990,6 +142363,7 @@ var import_uninstrument = (/* @__PURE__ */ __commonJSMin(((exports) => {
141990
142363
  Object.defineProperty(exports, "__esModule", { value: true });
141991
142364
  exports.EcsFargateUninstrumentCommand = void 0;
141992
142365
  const clipanion_1 = require_advanced();
142366
+ const auth_1 = require_auth();
141993
142367
  const plugin_1 = require_plugin();
141994
142368
  const common_1 = require_common$1();
141995
142369
  var EcsFargateUninstrumentCommand = class extends common_1.EcsFargateCommand {
@@ -142012,6 +142386,7 @@ var import_uninstrument = (/* @__PURE__ */ __commonJSMin(((exports) => {
142012
142386
  category: "Serverless",
142013
142387
  description: "Revert Datadog instrumentation from an Amazon ECS Fargate task definition."
142014
142388
  });
142389
+ EcsFargateUninstrumentCommand.authRequirement = (0, auth_1.customAuth)((0, auth_1.getCloudCredentialsOnlyAuthHelp)("AWS credentials"));
142015
142390
  })))();
142016
142391
  var PluginCommand = class extends import_uninstrument.EcsFargateUninstrumentCommand {
142017
142392
  async execute() {