@datadog/datadog-ci-plugin-terraform 5.17.0 → 5.19.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
@@ -10914,11 +10914,12 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
10914
10914
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10915
10915
  module.exports = {
10916
10916
  "name": "@datadog/datadog-ci-base",
10917
- "version": "5.17.0",
10917
+ "version": "5.19.0",
10918
10918
  "description": "Base package for Datadog CI",
10919
10919
  "license": "Apache-2.0",
10920
10920
  "keywords": ["datadog", "datadog-ci"],
10921
10921
  "homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/base",
10922
+ "bugs": { "url": "https://github.com/DataDog/datadog-ci/issues" },
10922
10923
  "repository": {
10923
10924
  "type": "git",
10924
10925
  "url": "https://github.com/DataDog/datadog-ci.git",
@@ -75542,8 +75543,6 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
75542
75543
  exports.DATADOG_ROUTE_PATHS = [
75543
75544
  "/api/intake/ci/custom_spans",
75544
75545
  "/api/ui/support/serverless/flare",
75545
- "/api/unstable/deployments/gates/evaluation",
75546
- "/api/unstable/deployments/gates/evaluation/:evaluationId",
75547
75546
  "/api/v1/validate",
75548
75547
  "/api/v2/ci/deployments/correlate-image",
75549
75548
  "/api/v2/ci/deployments/correlate",
@@ -75553,6 +75552,8 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
75553
75552
  "/api/v2/cicovreprt",
75554
75553
  "/api/v2/ciiac",
75555
75554
  "/api/v2/cireport",
75555
+ "/api/v2/deployments/gates/evaluation",
75556
+ "/api/v2/deployments/gates/evaluation/:evaluationId",
75556
75557
  "/api/v2/dora/deployment",
75557
75558
  "/api/v2/git/repository/packfile",
75558
75559
  "/api/v2/git/repository/search_commits",
@@ -76271,12 +76272,19 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
76271
76272
  LogLevel[LogLevel["WARN"] = 3] = "WARN";
76272
76273
  LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
76273
76274
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
76275
+ const LEVEL_NAMES = {
76276
+ [LogLevel.DEBUG]: "debug",
76277
+ [LogLevel.INFO]: "info",
76278
+ [LogLevel.WARN]: "warn",
76279
+ [LogLevel.ERROR]: "error"
76280
+ };
76274
76281
  var Logger = class {
76275
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
76276
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
76277
- this.writeMessage = (s) => {
76278
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
76279
- };
76282
+ constructor(writeMessage, loglevel, shouldIncludeTimestampOrOptions) {
76283
+ var _a, _b;
76284
+ const options = typeof shouldIncludeTimestampOrOptions === "boolean" ? { shouldIncludeTimestamp: shouldIncludeTimestampOrOptions } : shouldIncludeTimestampOrOptions !== null && shouldIncludeTimestampOrOptions !== void 0 ? shouldIncludeTimestampOrOptions : {};
76285
+ this.rawWriteMessage = writeMessage;
76286
+ this.shouldIncludeTimestamp = (_a = options.shouldIncludeTimestamp) !== null && _a !== void 0 ? _a : false;
76287
+ this.jsonOutput = (_b = options.jsonOutput) !== null && _b !== void 0 ? _b : false;
76280
76288
  this.loglevel = loglevel;
76281
76289
  }
76282
76290
  setLogLevel(newLogLevel) {
@@ -76285,17 +76293,34 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
76285
76293
  setShouldIncludeTime(newShouldIncludeTimestamp) {
76286
76294
  this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
76287
76295
  }
76296
+ setJsonOutput(newJsonOutput) {
76297
+ this.jsonOutput = newJsonOutput;
76298
+ }
76288
76299
  error(s) {
76289
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
76300
+ if (this.loglevel <= LogLevel.ERROR) this.emit(LogLevel.ERROR, s, chalk_1.default.red);
76290
76301
  }
76291
76302
  warn(s) {
76292
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
76303
+ if (this.loglevel <= LogLevel.WARN) this.emit(LogLevel.WARN, s, chalk_1.default.yellow);
76293
76304
  }
76294
76305
  info(s) {
76295
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
76306
+ if (this.loglevel <= LogLevel.INFO) this.emit(LogLevel.INFO, s);
76296
76307
  }
76297
76308
  debug(s) {
76298
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
76309
+ if (this.loglevel <= LogLevel.DEBUG) this.emit(LogLevel.DEBUG, s);
76310
+ }
76311
+ emit(level, message, colorize) {
76312
+ if (this.jsonOutput) {
76313
+ const payload = {
76314
+ level: LEVEL_NAMES[level],
76315
+ message
76316
+ };
76317
+ if (this.shouldIncludeTimestamp) payload.timestamp = (/* @__PURE__ */ new Date()).toISOString();
76318
+ this.rawWriteMessage(JSON.stringify(payload) + "\n");
76319
+ return;
76320
+ }
76321
+ const prefix = this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ` : "";
76322
+ const body = colorize ? colorize(message) : message;
76323
+ this.rawWriteMessage(prefix + body + "\n");
76299
76324
  }
76300
76325
  };
76301
76326
  exports.Logger = Logger;
@@ -76529,6 +76554,7 @@ var require_is_standalone_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
76529
76554
  const { isSea } = yield import("node:sea");
76530
76555
  return isSea();
76531
76556
  } catch (_a) {
76557
+ if (process.pkg !== void 0) return true;
76532
76558
  return false;
76533
76559
  }
76534
76560
  });
@@ -77423,7 +77449,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
77423
77449
  return mod && mod.__esModule ? mod : { "default": mod };
77424
77450
  };
77425
77451
  Object.defineProperty(exports, "__esModule", { value: true });
77426
- exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.executePluginCommand = void 0;
77452
+ exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.normalizePluginSubmodule = exports.executePluginCommand = void 0;
77427
77453
  const node_child_process_1 = require("node:child_process");
77428
77454
  const node_path_1 = __importDefault(require("node:path"));
77429
77455
  const node_url_1 = __importDefault(require("node:url"));
@@ -77464,6 +77490,15 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
77464
77490
  }
77465
77491
  });
77466
77492
  exports.executePluginCommand = executePluginCommand;
77493
+ const normalizePluginSubmodule = (submodule) => {
77494
+ if (isPluginSubmodule(submodule)) return submodule;
77495
+ if (typeof submodule === "object" && submodule && "default" in submodule) {
77496
+ const defaultExport = submodule.default;
77497
+ if (isPluginSubmodule(defaultExport)) return defaultExport;
77498
+ }
77499
+ return submodule;
77500
+ };
77501
+ exports.normalizePluginSubmodule = normalizePluginSubmodule;
77467
77502
  const listAllPlugins = () => {
77468
77503
  return Object.keys(package_json_1.peerDependencies);
77469
77504
  };
@@ -77626,6 +77661,21 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
77626
77661
  }
77627
77662
  patchModulePaths();
77628
77663
  yield handlePluginAutoInstall(scope);
77664
+ const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
77665
+ debug("Resolving submodule:", submoduleName);
77666
+ let submoduleResolveError;
77667
+ let resolvedSubmodulePath;
77668
+ try {
77669
+ resolvedSubmodulePath = require.resolve(submoduleName);
77670
+ } catch (error) {
77671
+ debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
77672
+ submoduleResolveError = error;
77673
+ }
77674
+ if (resolvedSubmodulePath) {
77675
+ const submodulePath = node_url_1.default.pathToFileURL(resolvedSubmodulePath).href;
77676
+ debug("Importing submodule:", submodulePath);
77677
+ return (0, exports.normalizePluginSubmodule)(yield import(submodulePath));
77678
+ }
77629
77679
  const pluginPackage = `@datadog/datadog-ci-plugin-${scope}`;
77630
77680
  try {
77631
77681
  const submodule = (_b = require(pluginPackage).commands) === null || _b === void 0 ? void 0 : _b[command];
@@ -77634,19 +77684,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
77634
77684
  return submodule;
77635
77685
  }
77636
77686
  } catch (error) {
77637
- debug("Plugin bundle load failed, trying submodule path:", error);
77638
- }
77639
- const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
77640
- debug("Resolving submodule:", submoduleName);
77641
- let submodulePath = submoduleName;
77642
- try {
77643
- const resolvedPath = require.resolve(submoduleName);
77644
- submodulePath = node_url_1.default.pathToFileURL(resolvedPath).href;
77645
- } catch (error) {
77646
- debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
77687
+ debug("Plugin bundle load failed:", error);
77647
77688
  }
77648
- debug("Importing submodule:", submodulePath);
77649
- return yield import(submodulePath);
77689
+ throw submoduleResolveError;
77650
77690
  });
77651
77691
  const scopeToPackageName = (scope) => {
77652
77692
  if (scope.match(/^@datadog\/datadog-ci-plugin-[a-z-]+$/)) return scope;
@@ -77666,6 +77706,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
77666
77706
  const isValidScope = (scope) => {
77667
77707
  return (0, exports.scopeToPackageName)(scope) in package_json_1.peerDependencies;
77668
77708
  };
77709
+ const isPluginSubmodule = (submodule) => {
77710
+ return typeof submodule === "object" && !!submodule && "PluginCommand" in submodule && typeof submodule.PluginCommand === "function";
77711
+ };
77669
77712
  /**
77670
77713
  * @example "1.2.3"
77671
77714
  * @example "file:./artifacts/@datadog-datadog-ci-base-20.tgz"