@datadog/datadog-ci-plugin-container-app 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
@@ -53125,11 +53125,12 @@ var require_source$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53125
53125
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53126
53126
  module.exports = {
53127
53127
  "name": "@datadog/datadog-ci-base",
53128
- "version": "5.17.0",
53128
+ "version": "5.19.0",
53129
53129
  "description": "Base package for Datadog CI",
53130
53130
  "license": "Apache-2.0",
53131
53131
  "keywords": ["datadog", "datadog-ci"],
53132
53132
  "homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/base",
53133
+ "bugs": { "url": "https://github.com/DataDog/datadog-ci/issues" },
53133
53134
  "repository": {
53134
53135
  "type": "git",
53135
53136
  "url": "https://github.com/DataDog/datadog-ci.git",
@@ -53303,6 +53304,7 @@ var require_is_standalone_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
53303
53304
  const { isSea } = yield import("node:sea");
53304
53305
  return isSea();
53305
53306
  } catch (_a) {
53307
+ if (process.pkg !== void 0) return true;
53306
53308
  return false;
53307
53309
  }
53308
53310
  });
@@ -54255,7 +54257,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54255
54257
  return mod && mod.__esModule ? mod : { "default": mod };
54256
54258
  };
54257
54259
  Object.defineProperty(exports, "__esModule", { value: true });
54258
- exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.executePluginCommand = void 0;
54260
+ exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.normalizePluginSubmodule = exports.executePluginCommand = void 0;
54259
54261
  const node_child_process_1 = require("node:child_process");
54260
54262
  const node_path_1 = __importDefault(require("node:path"));
54261
54263
  const node_url_1 = __importDefault(require("node:url"));
@@ -54296,6 +54298,15 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54296
54298
  }
54297
54299
  });
54298
54300
  exports.executePluginCommand = executePluginCommand;
54301
+ const normalizePluginSubmodule = (submodule) => {
54302
+ if (isPluginSubmodule(submodule)) return submodule;
54303
+ if (typeof submodule === "object" && submodule && "default" in submodule) {
54304
+ const defaultExport = submodule.default;
54305
+ if (isPluginSubmodule(defaultExport)) return defaultExport;
54306
+ }
54307
+ return submodule;
54308
+ };
54309
+ exports.normalizePluginSubmodule = normalizePluginSubmodule;
54299
54310
  const listAllPlugins = () => {
54300
54311
  return Object.keys(package_json_1.peerDependencies);
54301
54312
  };
@@ -54458,6 +54469,21 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54458
54469
  }
54459
54470
  patchModulePaths();
54460
54471
  yield handlePluginAutoInstall(scope);
54472
+ const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
54473
+ debug("Resolving submodule:", submoduleName);
54474
+ let submoduleResolveError;
54475
+ let resolvedSubmodulePath;
54476
+ try {
54477
+ resolvedSubmodulePath = require.resolve(submoduleName);
54478
+ } catch (error) {
54479
+ debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
54480
+ submoduleResolveError = error;
54481
+ }
54482
+ if (resolvedSubmodulePath) {
54483
+ const submodulePath = node_url_1.default.pathToFileURL(resolvedSubmodulePath).href;
54484
+ debug("Importing submodule:", submodulePath);
54485
+ return (0, exports.normalizePluginSubmodule)(yield import(submodulePath));
54486
+ }
54461
54487
  const pluginPackage = `@datadog/datadog-ci-plugin-${scope}`;
54462
54488
  try {
54463
54489
  const submodule = (_b = require(pluginPackage).commands) === null || _b === void 0 ? void 0 : _b[command];
@@ -54466,19 +54492,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54466
54492
  return submodule;
54467
54493
  }
54468
54494
  } catch (error) {
54469
- debug("Plugin bundle load failed, trying submodule path:", error);
54495
+ debug("Plugin bundle load failed:", error);
54470
54496
  }
54471
- const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
54472
- debug("Resolving submodule:", submoduleName);
54473
- let submodulePath = submoduleName;
54474
- try {
54475
- const resolvedPath = require.resolve(submoduleName);
54476
- submodulePath = node_url_1.default.pathToFileURL(resolvedPath).href;
54477
- } catch (error) {
54478
- debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
54479
- }
54480
- debug("Importing submodule:", submodulePath);
54481
- return yield import(submodulePath);
54497
+ throw submoduleResolveError;
54482
54498
  });
54483
54499
  const scopeToPackageName = (scope) => {
54484
54500
  if (scope.match(/^@datadog\/datadog-ci-plugin-[a-z-]+$/)) return scope;
@@ -54498,6 +54514,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
54498
54514
  const isValidScope = (scope) => {
54499
54515
  return (0, exports.scopeToPackageName)(scope) in package_json_1.peerDependencies;
54500
54516
  };
54517
+ const isPluginSubmodule = (submodule) => {
54518
+ return typeof submodule === "object" && !!submodule && "PluginCommand" in submodule && typeof submodule.PluginCommand === "function";
54519
+ };
54501
54520
  /**
54502
54521
  * @example "1.2.3"
54503
54522
  * @example "file:./artifacts/@datadog-datadog-ci-base-20.tgz"
@@ -104069,8 +104088,6 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
104069
104088
  exports.DATADOG_ROUTE_PATHS = [
104070
104089
  "/api/intake/ci/custom_spans",
104071
104090
  "/api/ui/support/serverless/flare",
104072
- "/api/unstable/deployments/gates/evaluation",
104073
- "/api/unstable/deployments/gates/evaluation/:evaluationId",
104074
104091
  "/api/v1/validate",
104075
104092
  "/api/v2/ci/deployments/correlate-image",
104076
104093
  "/api/v2/ci/deployments/correlate",
@@ -104080,6 +104097,8 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
104080
104097
  "/api/v2/cicovreprt",
104081
104098
  "/api/v2/ciiac",
104082
104099
  "/api/v2/cireport",
104100
+ "/api/v2/deployments/gates/evaluation",
104101
+ "/api/v2/deployments/gates/evaluation/:evaluationId",
104083
104102
  "/api/v2/dora/deployment",
104084
104103
  "/api/v2/git/repository/packfile",
104085
104104
  "/api/v2/git/repository/search_commits",
@@ -116839,12 +116858,19 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
116839
116858
  LogLevel[LogLevel["WARN"] = 3] = "WARN";
116840
116859
  LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
116841
116860
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
116861
+ const LEVEL_NAMES = {
116862
+ [LogLevel.DEBUG]: "debug",
116863
+ [LogLevel.INFO]: "info",
116864
+ [LogLevel.WARN]: "warn",
116865
+ [LogLevel.ERROR]: "error"
116866
+ };
116842
116867
  var Logger = class {
116843
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
116844
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
116845
- this.writeMessage = (s) => {
116846
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
116847
- };
116868
+ constructor(writeMessage, loglevel, shouldIncludeTimestampOrOptions) {
116869
+ var _a, _b;
116870
+ const options = typeof shouldIncludeTimestampOrOptions === "boolean" ? { shouldIncludeTimestamp: shouldIncludeTimestampOrOptions } : shouldIncludeTimestampOrOptions !== null && shouldIncludeTimestampOrOptions !== void 0 ? shouldIncludeTimestampOrOptions : {};
116871
+ this.rawWriteMessage = writeMessage;
116872
+ this.shouldIncludeTimestamp = (_a = options.shouldIncludeTimestamp) !== null && _a !== void 0 ? _a : false;
116873
+ this.jsonOutput = (_b = options.jsonOutput) !== null && _b !== void 0 ? _b : false;
116848
116874
  this.loglevel = loglevel;
116849
116875
  }
116850
116876
  setLogLevel(newLogLevel) {
@@ -116853,17 +116879,34 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
116853
116879
  setShouldIncludeTime(newShouldIncludeTimestamp) {
116854
116880
  this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
116855
116881
  }
116882
+ setJsonOutput(newJsonOutput) {
116883
+ this.jsonOutput = newJsonOutput;
116884
+ }
116856
116885
  error(s) {
116857
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
116886
+ if (this.loglevel <= LogLevel.ERROR) this.emit(LogLevel.ERROR, s, chalk_1.default.red);
116858
116887
  }
116859
116888
  warn(s) {
116860
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
116889
+ if (this.loglevel <= LogLevel.WARN) this.emit(LogLevel.WARN, s, chalk_1.default.yellow);
116861
116890
  }
116862
116891
  info(s) {
116863
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
116892
+ if (this.loglevel <= LogLevel.INFO) this.emit(LogLevel.INFO, s);
116864
116893
  }
116865
116894
  debug(s) {
116866
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
116895
+ if (this.loglevel <= LogLevel.DEBUG) this.emit(LogLevel.DEBUG, s);
116896
+ }
116897
+ emit(level, message, colorize) {
116898
+ if (this.jsonOutput) {
116899
+ const payload = {
116900
+ level: LEVEL_NAMES[level],
116901
+ message
116902
+ };
116903
+ if (this.shouldIncludeTimestamp) payload.timestamp = (/* @__PURE__ */ new Date()).toISOString();
116904
+ this.rawWriteMessage(JSON.stringify(payload) + "\n");
116905
+ return;
116906
+ }
116907
+ const prefix = this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ` : "";
116908
+ const body = colorize ? colorize(message) : message;
116909
+ this.rawWriteMessage(prefix + body + "\n");
116867
116910
  }
116868
116911
  };
116869
116912
  exports.Logger = Logger;