@datadog/datadog-ci-plugin-container-app 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.d.ts CHANGED
@@ -7256,6 +7256,19 @@ declare abstract class Command<Context extends BaseContext = BaseContext> {
7256
7256
  static Default: never[];
7257
7257
  }
7258
7258
  //#endregion
7259
+ //#region ../base/dist/helpers/auth.d.ts
7260
+ /**
7261
+ * The authentication requirement of a command, declared with `public static authRequirement` on its base command class
7262
+ * in `packages/base/src/commands/**`, next to the options it describes. A test checks that every registered command
7263
+ * declares one.
7264
+ */
7265
+ type AuthRequirement = {
7266
+ kind: 'orgAction' | 'apiKey' | 'none';
7267
+ } /** A command-specific text, for example the cloud credentials and Datadog variables a Serverless command reads. */ | {
7268
+ kind: 'custom';
7269
+ help: string;
7270
+ };
7271
+ //#endregion
7259
7272
  //#region ../base/dist/helpers/logger.d.ts
7260
7273
  declare enum LogLevel {
7261
7274
  DEBUG = 1,
@@ -7298,6 +7311,11 @@ type CommandContext = BaseContext & {
7298
7311
  * This command should be extended by **every** command in the monorepo.
7299
7312
  */
7300
7313
  declare abstract class BaseCommand<Context extends CommandContext = CommandContext> extends Command<Context> {
7314
+ /**
7315
+ * The credentials the command needs, shown in the "Authentication" section of its `--help`.
7316
+ * Every command declares one; plugin commands inherit it from their base command.
7317
+ */
7318
+ static authRequirement?: AuthRequirement;
7301
7319
  protected logFormat: "text" | "json";
7302
7320
  private _logger?;
7303
7321
  get logger(): Logger;
@@ -7358,6 +7376,7 @@ declare abstract class ContainerAppCommand extends BaseCommand {
7358
7376
  declare class ContainerAppInstrumentCommand extends ContainerAppCommand {
7359
7377
  static paths: string[][];
7360
7378
  static usage: Usage;
7379
+ static authRequirement: AuthRequirement;
7361
7380
  private service;
7362
7381
  private environment;
7363
7382
  private version;
@@ -7426,6 +7445,7 @@ declare class PluginCommand$1 extends ContainerAppInstrumentCommand {
7426
7445
  declare class ContainerAppUninstrumentCommand extends ContainerAppCommand {
7427
7446
  static paths: string[][];
7428
7447
  static usage: Usage;
7448
+ static authRequirement: AuthRequirement;
7429
7449
  private sidecarName;
7430
7450
  private sharedVolumeName;
7431
7451
  get additionalConfig(): Partial<ContainerAppConfigOptions>;
package/dist/bundle.js CHANGED
@@ -51278,6 +51278,341 @@ var require_advanced = /* @__PURE__ */ __commonJSMin(((exports) => {
51278
51278
  exports.Option = advanced_options_index;
51279
51279
  }));
51280
51280
  //#endregion
51281
+ //#region ../../node_modules/ansi-escapes/index.js
51282
+ var require_ansi_escapes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51283
+ const ansiEscapes = module.exports;
51284
+ module.exports.default = ansiEscapes;
51285
+ const ESC = "\x1B[";
51286
+ const OSC = "\x1B]";
51287
+ const BEL = "\x07";
51288
+ const SEP = ";";
51289
+ const isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
51290
+ ansiEscapes.cursorTo = (x, y) => {
51291
+ if (typeof x !== "number") throw new TypeError("The `x` argument is required");
51292
+ if (typeof y !== "number") return ESC + (x + 1) + "G";
51293
+ return ESC + (y + 1) + ";" + (x + 1) + "H";
51294
+ };
51295
+ ansiEscapes.cursorMove = (x, y) => {
51296
+ if (typeof x !== "number") throw new TypeError("The `x` argument is required");
51297
+ let ret = "";
51298
+ if (x < 0) ret += ESC + -x + "D";
51299
+ else if (x > 0) ret += ESC + x + "C";
51300
+ if (y < 0) ret += ESC + -y + "A";
51301
+ else if (y > 0) ret += ESC + y + "B";
51302
+ return ret;
51303
+ };
51304
+ ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
51305
+ ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
51306
+ ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
51307
+ ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
51308
+ ansiEscapes.cursorLeft = ESC + "G";
51309
+ ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
51310
+ ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
51311
+ ansiEscapes.cursorGetPosition = ESC + "6n";
51312
+ ansiEscapes.cursorNextLine = ESC + "E";
51313
+ ansiEscapes.cursorPrevLine = ESC + "F";
51314
+ ansiEscapes.cursorHide = ESC + "?25l";
51315
+ ansiEscapes.cursorShow = ESC + "?25h";
51316
+ ansiEscapes.eraseLines = (count) => {
51317
+ let clear = "";
51318
+ for (let i = 0; i < count; i++) clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
51319
+ if (count) clear += ansiEscapes.cursorLeft;
51320
+ return clear;
51321
+ };
51322
+ ansiEscapes.eraseEndLine = ESC + "K";
51323
+ ansiEscapes.eraseStartLine = ESC + "1K";
51324
+ ansiEscapes.eraseLine = ESC + "2K";
51325
+ ansiEscapes.eraseDown = ESC + "J";
51326
+ ansiEscapes.eraseUp = ESC + "1J";
51327
+ ansiEscapes.eraseScreen = ESC + "2J";
51328
+ ansiEscapes.scrollUp = ESC + "S";
51329
+ ansiEscapes.scrollDown = ESC + "T";
51330
+ ansiEscapes.clearScreen = "\x1Bc";
51331
+ ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
51332
+ ansiEscapes.beep = BEL;
51333
+ ansiEscapes.link = (text, url) => {
51334
+ return [
51335
+ OSC,
51336
+ "8",
51337
+ SEP,
51338
+ SEP,
51339
+ url,
51340
+ BEL,
51341
+ text,
51342
+ OSC,
51343
+ "8",
51344
+ SEP,
51345
+ SEP,
51346
+ BEL
51347
+ ].join("");
51348
+ };
51349
+ ansiEscapes.image = (buffer, options = {}) => {
51350
+ let ret = `${OSC}1337;File=inline=1`;
51351
+ if (options.width) ret += `;width=${options.width}`;
51352
+ if (options.height) ret += `;height=${options.height}`;
51353
+ if (options.preserveAspectRatio === false) ret += ";preserveAspectRatio=0";
51354
+ return ret + ":" + buffer.toString("base64") + BEL;
51355
+ };
51356
+ ansiEscapes.iTerm = {
51357
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
51358
+ annotation: (message, options = {}) => {
51359
+ let ret = `${OSC}1337;`;
51360
+ const hasX = typeof options.x !== "undefined";
51361
+ const hasY = typeof options.y !== "undefined";
51362
+ 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");
51363
+ message = message.replace(/\|/g, "");
51364
+ ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
51365
+ if (options.length > 0) ret += (hasX ? [
51366
+ message,
51367
+ options.length,
51368
+ options.x,
51369
+ options.y
51370
+ ] : [options.length, message]).join("|");
51371
+ else ret += message;
51372
+ return ret + BEL;
51373
+ }
51374
+ };
51375
+ }));
51376
+ //#endregion
51377
+ //#region ../../node_modules/supports-hyperlinks/index.js
51378
+ var require_supports_hyperlinks = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51379
+ const supportsColor = require_supports_color();
51380
+ const hasFlag = require_has_flag();
51381
+ function parseVersion(versionString) {
51382
+ if (/^\d{3,4}$/.test(versionString)) {
51383
+ const m = /(\d{1,2})(\d{2})/.exec(versionString);
51384
+ return {
51385
+ major: 0,
51386
+ minor: parseInt(m[1], 10),
51387
+ patch: parseInt(m[2], 10)
51388
+ };
51389
+ }
51390
+ const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
51391
+ return {
51392
+ major: versions[0],
51393
+ minor: versions[1],
51394
+ patch: versions[2]
51395
+ };
51396
+ }
51397
+ function supportsHyperlink(stream) {
51398
+ const { env } = process;
51399
+ if ("FORCE_HYPERLINK" in env) return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
51400
+ if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) return false;
51401
+ if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) return true;
51402
+ if ("NETLIFY" in env) return true;
51403
+ if (!supportsColor.supportsColor(stream)) return false;
51404
+ if (stream && !stream.isTTY) return false;
51405
+ if (process.platform === "win32") return false;
51406
+ if ("CI" in env) return false;
51407
+ if ("TEAMCITY_VERSION" in env) return false;
51408
+ if ("TERM_PROGRAM" in env) {
51409
+ const version = parseVersion(env.TERM_PROGRAM_VERSION);
51410
+ switch (env.TERM_PROGRAM) {
51411
+ case "iTerm.app":
51412
+ if (version.major === 3) return version.minor >= 1;
51413
+ return version.major > 3;
51414
+ case "WezTerm": return version.major >= 20200620;
51415
+ case "vscode": return version.major > 1 || version.major === 1 && version.minor >= 72;
51416
+ }
51417
+ }
51418
+ if ("VTE_VERSION" in env) {
51419
+ if (env.VTE_VERSION === "0.50.0") return false;
51420
+ const version = parseVersion(env.VTE_VERSION);
51421
+ return version.major > 0 || version.minor >= 50;
51422
+ }
51423
+ return false;
51424
+ }
51425
+ module.exports = {
51426
+ supportsHyperlink,
51427
+ stdout: supportsHyperlink(process.stdout),
51428
+ stderr: supportsHyperlink(process.stderr)
51429
+ };
51430
+ }));
51431
+ //#endregion
51432
+ //#region ../../node_modules/terminal-link/index.js
51433
+ var require_terminal_link$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51434
+ const ansiEscapes = require_ansi_escapes();
51435
+ const supportsHyperlinks = require_supports_hyperlinks();
51436
+ const terminalLink = (text, url, { target = "stdout", ...options } = {}) => {
51437
+ if (!supportsHyperlinks[target]) {
51438
+ if (options.fallback === false) return text;
51439
+ return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
51440
+ }
51441
+ return ansiEscapes.link(text, url);
51442
+ };
51443
+ module.exports = (text, url, options = {}) => terminalLink(text, url, options);
51444
+ module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {
51445
+ target: "stderr",
51446
+ ...options
51447
+ });
51448
+ module.exports.isSupported = supportsHyperlinks.stdout;
51449
+ module.exports.stderr.isSupported = supportsHyperlinks.stderr;
51450
+ }));
51451
+ //#endregion
51452
+ //#region ../base/dist/helpers/terminal-link.js
51453
+ var require_terminal_link = /* @__PURE__ */ __commonJSMin(((exports) => {
51454
+ var __importDefault = exports && exports.__importDefault || function(mod) {
51455
+ return mod && mod.__esModule ? mod : { "default": mod };
51456
+ };
51457
+ Object.defineProperty(exports, "__esModule", { value: true });
51458
+ exports.makeTerminalLink = void 0;
51459
+ const terminal_link_1 = __importDefault(require_terminal_link$1());
51460
+ const makeTerminalLink = (url) => {
51461
+ return ((strings) => (0, terminal_link_1.default)(strings[0], url));
51462
+ };
51463
+ exports.makeTerminalLink = makeTerminalLink;
51464
+ }));
51465
+ //#endregion
51466
+ //#region ../base/dist/helpers/auth.js
51467
+ var require_auth = /* @__PURE__ */ __commonJSMin(((exports) => {
51468
+ Object.defineProperty(exports, "__esModule", { value: true });
51469
+ 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;
51470
+ const util_1$2 = require("util");
51471
+ const clipanion_1 = require_advanced();
51472
+ const terminal_link_1 = require_terminal_link();
51473
+ /**
51474
+ * Shared Datadog credential handling.
51475
+ *
51476
+ * - "Data upload" commands only need an API key (DD_API_KEY). With Workload Identity Federation (WIF),
51477
+ * an intake mapping provides one.
51478
+ * - "Org action" commands act on behalf of a user or service account: they need an access token
51479
+ * (DD_ACCESS_TOKEN, sent as `Authorization: Bearer`) from a WIF identity mapping, or an API key and an
51480
+ * application key. An access token takes precedence over an application key.
51481
+ */
51482
+ exports.AUTHENTICATION_DOCS_URL = "https://github.com/DataDog/datadog-ci#authentication";
51483
+ /**
51484
+ * Read the access token from the environment, following the same `DATADOG_*` then `DD_*` order as the API and
51485
+ * application keys.
51486
+ */
51487
+ const getAccessTokenFromEnv = (env = process.env) => env.DATADOG_ACCESS_TOKEN || env.DD_ACCESS_TOKEN || void 0;
51488
+ exports.getAccessTokenFromEnv = getAccessTokenFromEnv;
51489
+ /**
51490
+ * Normalize org-action credentials: empty values are dropped, and an access token wins over an application key,
51491
+ * so the application key is dropped when a token is set. The API key is kept when provided.
51492
+ */
51493
+ const resolveOrgCredentials = ({ accessToken, apiKey, appKey }) => {
51494
+ if (accessToken) return {
51495
+ accessToken,
51496
+ apiKey: apiKey || void 0
51497
+ };
51498
+ return {
51499
+ apiKey: apiKey || void 0,
51500
+ appKey: appKey || void 0
51501
+ };
51502
+ };
51503
+ exports.resolveOrgCredentials = resolveOrgCredentials;
51504
+ const hasOrgCredentials = (credentials) => !!credentials.accessToken || !!credentials.apiKey && !!credentials.appKey;
51505
+ exports.hasOrgCredentials = hasOrgCredentials;
51506
+ /**
51507
+ * Explain which credentials an org-action command is missing, or return `undefined` when the credentials are enough:
51508
+ * an access token, or an API key and an application key.
51509
+ */
51510
+ const getMissingOrgCredentialsMessage = (commandName, credentials) => {
51511
+ if ((0, exports.hasOrgCredentials)(credentials)) return;
51512
+ const identityMappingHint = "With Workload Identity Federation, use an identity mapping to get an access token: an intake mapping only provides an API key.";
51513
+ 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}`;
51514
+ 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}`;
51515
+ 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}`;
51516
+ };
51517
+ exports.getMissingOrgCredentialsMessage = getMissingOrgCredentialsMessage;
51518
+ exports.WORKLOAD_IDENTITY_FEDERATION_DOCS_URL = "https://docs.datadoghq.com/account_management/workload_identity_federation/";
51519
+ /** "Workload Identity Federation" as a terminal link to its docs. */
51520
+ exports.wifLink = (0, terminal_link_1.makeTerminalLink)(exports.WORKLOAD_IDENTITY_FEDERATION_DOCS_URL)`Workload Identity Federation`;
51521
+ /** The last line of every authentication help text. */
51522
+ exports.seeReadme = `See ${exports.AUTHENTICATION_DOCS_URL}`;
51523
+ /**
51524
+ * Bodies of the "Authentication" section of `--help`. Paragraphs are separated by a blank line, and a single newline is
51525
+ * a hard line break. Each body ends with "See <README URL>" on its own short line, so the wrapper never splits it.
51526
+ */
51527
+ exports.AUTH_HELP = {
51528
+ 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}`,
51529
+ 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}`,
51530
+ none: `This command does not need Datadog credentials.\n\n${exports.seeReadme}`
51531
+ };
51532
+ /**
51533
+ * Authentication help for Serverless `instrument` commands, which save the Datadog API key in the instrumented service.
51534
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
51535
+ * @param datadogCredentials - how the command reads the Datadog API key, for example "a Datadog API key (DD_API_KEY)".
51536
+ */
51537
+ 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}`;
51538
+ exports.getServerlessInstrumentAuthHelp = getServerlessInstrumentAuthHelp;
51539
+ /**
51540
+ * Authentication help for commands that only call the cloud provider, such as Serverless `uninstrument` commands.
51541
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
51542
+ */
51543
+ const getCloudCredentialsOnlyAuthHelp = (cloudCredentials) => `This command uses your ${cloudCredentials}. It does not need Datadog credentials.\n\n${exports.seeReadme}`;
51544
+ exports.getCloudCredentialsOnlyAuthHelp = getCloudCredentialsOnlyAuthHelp;
51545
+ /**
51546
+ * Authentication help for the Serverless `flare` commands, which read from the cloud provider and send a flare to Datadog.
51547
+ * @param cloudCredentials - the cloud provider credentials the command uses, for example "AWS credentials".
51548
+ */
51549
+ 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}`;
51550
+ exports.getFlareAuthHelp = getFlareAuthHelp;
51551
+ /** Calls Datadog API endpoints: an API key and an application key, or an access token. */
51552
+ exports.orgActionAuth = { kind: "orgAction" };
51553
+ /** Only sends telemetry: an API key. */
51554
+ exports.apiKeyAuth = { kind: "apiKey" };
51555
+ /** Does not need Datadog credentials. */
51556
+ exports.noAuth = { kind: "none" };
51557
+ /** A command-specific authentication help text. */
51558
+ const customAuth = (help) => ({
51559
+ kind: "custom",
51560
+ help
51561
+ });
51562
+ exports.customAuth = customAuth;
51563
+ const getAuthHelp = (requirement) => requirement.kind === "custom" ? requirement.help : exports.AUTH_HELP[requirement.kind];
51564
+ exports.getAuthHelp = getAuthHelp;
51565
+ /** The authentication requirement a command class declares, if any. */
51566
+ const getAuthRequirement = (commandClass) => commandClass.authRequirement;
51567
+ exports.getAuthRequirement = getAuthRequirement;
51568
+ /** The authentication help of a command, from the `authRequirement` its class declares. */
51569
+ const getAuthHelpForCommand = (commandClass) => {
51570
+ const requirement = (0, exports.getAuthRequirement)(commandClass);
51571
+ return requirement ? (0, exports.getAuthHelp)(requirement) : void 0;
51572
+ };
51573
+ exports.getAuthHelpForCommand = getAuthHelpForCommand;
51574
+ const HELP_WIDTH = 80;
51575
+ const WORD_REGEX = /\u001B\]8;;[^\u0007]*\u0007[^\u001B]*\u001B\]8;;\u0007\S*|\S+/g;
51576
+ /** Wrap a line at 80 visible characters, like Clipanion does for `Details`, without splitting terminal links. */
51577
+ const wrapLine = (line) => {
51578
+ var _a;
51579
+ const lines = [];
51580
+ let current = "";
51581
+ for (const word of (_a = line.match(WORD_REGEX)) !== null && _a !== void 0 ? _a : []) {
51582
+ const candidate = current ? `${current} ${word}` : word;
51583
+ if (current && (0, util_1$2.stripVTControlCharacters)(candidate).length > HELP_WIDTH) {
51584
+ lines.push(current);
51585
+ current = word;
51586
+ } else current = candidate;
51587
+ }
51588
+ lines.push(current);
51589
+ return lines.join("\n");
51590
+ };
51591
+ /** Format an authentication help text: paragraphs separated by a blank line, single newlines kept as line breaks. */
51592
+ const formatAuthHelp = (text) => `${text.split("\n\n").map((paragraph) => paragraph.split("\n").map(wrapLine).join("\n")).join("\n\n")}\n`;
51593
+ exports.formatAuthHelp = formatAuthHelp;
51594
+ /**
51595
+ * A Clipanion `Cli` whose detailed `--help` has an "Authentication" section, after "Details" and before "Examples",
51596
+ * for every command that declares an `authRequirement`. The section is rendered with Clipanion's own header style.
51597
+ *
51598
+ * Every help route goes through `Cli.usage()`: `<command> --help` and `-h` (through the builtin `HelpCommand`) and
51599
+ * `Cli.run` for a command with `help` set. The command's `usage.details` is left unchanged.
51600
+ */
51601
+ var CliWithAuthHelp = class extends clipanion_1.Cli {
51602
+ usage(command = null, opts = {}) {
51603
+ const result = super.usage(command, opts);
51604
+ const commandClass = command instanceof clipanion_1.Command ? command.constructor : command;
51605
+ const help = opts.detailed && commandClass ? (0, exports.getAuthHelpForCommand)(commandClass) : void 0;
51606
+ if (!help) return result;
51607
+ const format = this.format(opts.colored);
51608
+ const section = `\n${format.header("Authentication")}\n\n${(0, exports.formatAuthHelp)(help)}`;
51609
+ const examplesIndex = result.indexOf(`\n${format.header("Examples")}\n`);
51610
+ return examplesIndex === -1 ? `${result}${section}` : `${result.slice(0, examplesIndex)}${section}${result.slice(examplesIndex)}`;
51611
+ }
51612
+ };
51613
+ exports.CliWithAuthHelp = CliWithAuthHelp;
51614
+ }));
51615
+ //#endregion
51281
51616
  //#region ../../node_modules/color-name/index.js
51282
51617
  var require_color_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51283
51618
  module.exports = {
@@ -53332,7 +53667,7 @@ var require_source$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53332
53667
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53333
53668
  module.exports = {
53334
53669
  "name": "@datadog/datadog-ci-base",
53335
- "version": "5.28.0",
53670
+ "version": "5.29.0",
53336
53671
  "description": "Base package for Datadog CI",
53337
53672
  "license": "Apache-2.0",
53338
53673
  "keywords": ["datadog", "datadog-ci"],
@@ -54900,7 +55235,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54900
55235
  //#region ../base/dist/helpers/serverless/constants.js
54901
55236
  var require_constants$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
54902
55237
  Object.defineProperty(exports, "__esModule", { value: true });
54903
- 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;
55238
+ 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;
54904
55239
  exports.API_KEY_ENV_VAR = "DD_API_KEY";
54905
55240
  exports.CI_API_KEY_ENV_VAR = "DATADOG_API_KEY";
54906
55241
  exports.CI_SITE_ENV_VAR = "DATADOG_SITE";
@@ -54967,6 +55302,7 @@ var require_constants$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
54967
55302
  exports.SIDECAR_IMAGE = "index.docker.io/datadog/serverless-init:latest";
54968
55303
  exports.AGENT_IMAGE = "public.ecr.aws/datadog/agent:latest";
54969
55304
  exports.SIDECAR_PORT = 8126;
55305
+ exports.DOGSTATSD_PORT = 8125;
54970
55306
  exports.DEFAULT_SIDECAR_NAME = "datadog-sidecar";
54971
55307
  exports.DEFAULT_VOLUME_NAME = "shared-volume";
54972
55308
  exports.DEFAULT_VOLUME_PATH = "/shared-volume";
@@ -78462,7 +78798,8 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
78462
78798
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
78463
78799
  data,
78464
78800
  status: response.status,
78465
- statusText: response.statusText
78801
+ statusText: response.statusText,
78802
+ headers: responseHeaders
78466
78803
  });
78467
78804
  return {
78468
78805
  config,
@@ -103580,14 +103917,14 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
103580
103917
  };
103581
103918
  exports.getProxyUrl = getProxyUrl;
103582
103919
  const getRequestBuilder = (options) => {
103583
- const { apiKey, appKey, baseUrl, overrideUrl, proxyOpts } = options;
103920
+ const { accessToken, apiKey, appKey, baseUrl, overrideUrl, proxyOpts } = options;
103584
103921
  const proxyUrlFromConfiguration = (0, exports.getProxyUrl)(proxyOpts);
103585
103922
  const dispatcher = (0, request_1.getProxyDispatcher)(proxyUrlFromConfiguration);
103586
103923
  const overrideArgs = (args) => {
103587
103924
  const newArguments = Object.assign(Object.assign({}, args), {
103588
103925
  baseURL: baseUrl,
103589
103926
  dispatcher,
103590
- headers: Object.assign(Object.assign({ "DD-API-KEY": apiKey }, appKey ? { "DD-APPLICATION-KEY": appKey } : {}), args.headers)
103927
+ headers: Object.assign(Object.assign(Object.assign({}, apiKey ? { "DD-API-KEY": apiKey } : {}), accessToken ? { Authorization: `Bearer ${accessToken}` } : appKey ? { "DD-APPLICATION-KEY": appKey } : {}), args.headers)
103591
103928
  });
103592
103929
  if (overrideUrl !== void 0) newArguments.url = overrideUrl;
103593
103930
  if (options.headers !== void 0) options.headers.forEach((value, key) => {
@@ -104059,6 +104396,7 @@ var require_instrument = /* @__PURE__ */ __commonJSMin(((exports) => {
104059
104396
  exports.ContainerAppInstrumentCommand = exports.DEFAULT_SIDECAR_MEMORY = exports.DEFAULT_SIDECAR_CPU = void 0;
104060
104397
  const clipanion_1 = require_advanced();
104061
104398
  const t = __importStar(require_lib$2());
104399
+ const auth_1 = require_auth();
104062
104400
  const plugin_1 = require_plugin();
104063
104401
  const constants_1 = require_constants$9();
104064
104402
  const injection_spec_1 = require_injection_spec();
@@ -104141,6 +104479,7 @@ var require_instrument = /* @__PURE__ */ __commonJSMin(((exports) => {
104141
104479
  category: "Serverless",
104142
104480
  description: "Apply Datadog instrumentation to an Azure Container App."
104143
104481
  });
104482
+ ContainerAppInstrumentCommand.authRequirement = (0, auth_1.customAuth)((0, auth_1.getServerlessInstrumentAuthHelp)("Azure credentials", "a Datadog API key (DD_API_KEY)"));
104144
104483
  }));
104145
104484
  //#endregion
104146
104485
  //#region ../base/dist/helpers/api.js
@@ -107213,7 +107552,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
107213
107552
  return mod && mod.__esModule ? mod : { "default": mod };
107214
107553
  };
107215
107554
  Object.defineProperty(exports, "__esModule", { value: true });
107216
- exports.createInstrumentedTemplate = exports.byName = exports.generateConfigDiff = exports.sortedEqual = exports.getBaseEnvVars = exports.collectAsyncIterator = exports.parseEnvVars = void 0;
107555
+ 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;
107217
107556
  const node_util_1 = require("node:util");
107218
107557
  const chalk_1 = __importDefault(require_source$1());
107219
107558
  const jest_diff_1 = require_build();
@@ -107412,6 +107751,29 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
107412
107751
  });
107413
107752
  };
107414
107753
  exports.createInstrumentedTemplate = createInstrumentedTemplate;
107754
+ exports.AGENT_TRACE_PORT = {
107755
+ port: constants_2.SIDECAR_PORT,
107756
+ name: "Datadog Agent trace port"
107757
+ };
107758
+ exports.AGENT_DOGSTATSD_PORT = {
107759
+ port: constants_2.DOGSTATSD_PORT,
107760
+ protocol: "udp",
107761
+ name: "Datadog Agent DogStatsD UDP port"
107762
+ };
107763
+ /** Rejects an application port that a sidecar also binds, since only one of them can listen on it. */
107764
+ const assertAppPortsAvoidSidecarPorts = (appPorts, sidecarPorts) => {
107765
+ for (const { port, lastPort = port, protocol = "tcp", source } of appPorts) {
107766
+ const sidecarPort = sidecarPorts.find((candidate) => {
107767
+ var _a;
107768
+ return ((_a = candidate.protocol) !== null && _a !== void 0 ? _a : "tcp") === protocol && port <= candidate.port && candidate.port <= lastPort;
107769
+ });
107770
+ if (sidecarPort) {
107771
+ const isRange = lastPort !== port;
107772
+ 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}` : ""}.`);
107773
+ }
107774
+ }
107775
+ };
107776
+ exports.assertAppPortsAvoidSidecarPorts = assertAppPortsAvoidSidecarPorts;
107415
107777
  }));
107416
107778
  //#endregion
107417
107779
  //#region ../../node_modules/@simple-git/args-pathspec/dist/index.cjs
@@ -146938,6 +147300,7 @@ var require_upload = /* @__PURE__ */ __commonJSMin(((exports) => {
146938
147300
  const clipanion_1 = require_advanced();
146939
147301
  const constants_1 = require_constants$10();
146940
147302
  const apikey_1 = require_apikey();
147303
+ const auth_1 = require_auth();
146941
147304
  const env_1 = require_env$1();
146942
147305
  const errors_1 = require_errors();
146943
147306
  const fips_1 = require_fips();
@@ -147098,6 +147461,7 @@ var require_upload = /* @__PURE__ */ __commonJSMin(((exports) => {
147098
147461
  `,
147099
147462
  examples: [["Upload the current commit details", "datadog-ci report-commits upload"]]
147100
147463
  });
147464
+ GitMetadataUploadCommand.authRequirement = auth_1.apiKeyAuth;
147101
147465
  }));
147102
147466
  //#endregion
147103
147467
  //#region ../base/dist/helpers/serverless/source-code-integration.js
@@ -148012,6 +148376,8 @@ var PluginCommand$1 = class extends import_instrument.ContainerAppInstrumentComm
148012
148376
  name: import_constants$1.DD_TRACE_ENABLED_ENV_VAR,
148013
148377
  value: "false"
148014
148378
  };
148379
+ const existingHealthPort = sourceApp.template?.containers?.find(({ name }) => name === config.sidecarName)?.env?.find(({ name }) => name === import_constants$1.HEALTH_PORT_ENV_VAR)?.value;
148380
+ const healthPort = Number(envVarsByName[import_constants$1.HEALTH_PORT_ENV_VAR]?.value ?? existingHealthPort) || import_constants$1.DEFAULT_HEALTH_CHECK_PORT;
148015
148381
  const baseSidecar = {
148016
148382
  name: config.sidecarName,
148017
148383
  image: config.sidecarImage ?? import_constants$1.SIDECAR_IMAGE,
@@ -148021,7 +148387,7 @@ var PluginCommand$1 = class extends import_instrument.ContainerAppInstrumentComm
148021
148387
  },
148022
148388
  probes: [{
148023
148389
  type: "Startup",
148024
- tcpSocket: { port: import_constants$1.DEFAULT_HEALTH_CHECK_PORT },
148390
+ tcpSocket: { port: healthPort },
148025
148391
  initialDelaySeconds: 0,
148026
148392
  periodSeconds: 10,
148027
148393
  failureThreshold: 3,
@@ -148034,6 +148400,14 @@ var PluginCommand$1 = class extends import_instrument.ContainerAppInstrumentComm
148034
148400
  mountOptions: { storageType: "EmptyDir" },
148035
148401
  volumeMountNameKey: "volumeName"
148036
148402
  }, envVarsByName);
148403
+ const ingress = sourceApp.configuration?.ingress;
148404
+ (0, import_common.assertAppPortsAvoidSidecarPorts)([ingress?.targetPort, ...(ingress?.additionalPortMappings ?? []).map(({ targetPort }) => targetPort)].flatMap((port) => port ? [{
148405
+ port,
148406
+ source: `the ingress of container app '${containerApp.name}'`
148407
+ }] : []), [{
148408
+ port: healthPort,
148409
+ name: "Datadog Agent health port"
148410
+ }, import_common.AGENT_TRACE_PORT]);
148037
148411
  const secrets = sourceApp.configuration?.secrets ?? [];
148038
148412
  const hasApiKey = secrets.some(({ name }) => name === DD_API_KEY_SECRET_NAME);
148039
148413
  const updatedSecrets = secrets.map((secret) => secret.name === "dd-api-key" ? {
@@ -148093,6 +148467,7 @@ var import_uninstrument = (/* @__PURE__ */ __commonJSMin(((exports) => {
148093
148467
  Object.defineProperty(exports, "__esModule", { value: true });
148094
148468
  exports.ContainerAppUninstrumentCommand = void 0;
148095
148469
  const clipanion_1 = require_advanced();
148470
+ const auth_1 = require_auth();
148096
148471
  const plugin_1 = require_plugin();
148097
148472
  const constants_1 = require_constants$9();
148098
148473
  const common_1 = require_common$1();
@@ -148131,6 +148506,7 @@ var import_uninstrument = (/* @__PURE__ */ __commonJSMin(((exports) => {
148131
148506
  category: "Serverless",
148132
148507
  description: "Revert Datadog instrumentation in an Azure Container App."
148133
148508
  });
148509
+ ContainerAppUninstrumentCommand.authRequirement = (0, auth_1.customAuth)((0, auth_1.getCloudCredentialsOnlyAuthHelp)("Azure credentials"));
148134
148510
  })))();
148135
148511
  var PluginCommand = class extends import_uninstrument.ContainerAppUninstrumentCommand {
148136
148512
  async execute() {
@@ -535,6 +535,19 @@ Bundled license information:
535
535
  * SOFTWARE.
536
536
  */
537
537
 
538
+ ansi-escapes/license:
539
+ /*
540
+ * MIT License
541
+ *
542
+ * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
543
+ *
544
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
545
+ *
546
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
547
+ *
548
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
549
+ */
550
+
538
551
  ansi-styles/license:
539
552
  /*
540
553
  * MIT License
@@ -2560,6 +2573,32 @@ supports-color/license:
2560
2573
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2561
2574
  */
2562
2575
 
2576
+ supports-hyperlinks/license:
2577
+ /*
2578
+ * MIT License
2579
+ *
2580
+ * Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
2581
+ *
2582
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2583
+ *
2584
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2585
+ *
2586
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2587
+ */
2588
+
2589
+ terminal-link/license:
2590
+ /*
2591
+ * MIT License
2592
+ *
2593
+ * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
2594
+ *
2595
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2596
+ *
2597
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2598
+ *
2599
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2600
+ */
2601
+
2563
2602
  tinyexec/LICENSE:
2564
2603
  /*
2565
2604
  * MIT License