@datadog/datadog-ci-plugin-synthetics 5.16.1 → 5.18.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
@@ -2267,26 +2267,6 @@ declare class SyntheticsDeployTestsCommand extends BaseCommand {
2267
2267
  execute(): Promise<number | void>;
2268
2268
  }
2269
2269
  //#endregion
2270
- //#region ../base/dist/helpers/logger.d.ts
2271
- declare enum LogLevel {
2272
- DEBUG = 1,
2273
- INFO = 2,
2274
- WARN = 3,
2275
- ERROR = 4
2276
- }
2277
- declare class Logger {
2278
- private loglevel;
2279
- private writeMessage;
2280
- private shouldIncludeTimestamp;
2281
- constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestamp?: boolean);
2282
- setLogLevel(newLogLevel: LogLevel): void;
2283
- setShouldIncludeTime(newShouldIncludeTimestamp: boolean): void;
2284
- error(s: string): void;
2285
- warn(s: string): void;
2286
- info(s: string): void;
2287
- debug(s: string): void;
2288
- }
2289
- //#endregion
2290
2270
  //#region src/commands/deploy-tests.d.ts
2291
2271
  declare class PluginCommand$3 extends SyntheticsDeployTestsCommand {
2292
2272
  protected reporter: MainReporter;
@@ -2295,7 +2275,6 @@ declare class PluginCommand$3 extends SyntheticsDeployTestsCommand {
2295
2275
  fips: boolean;
2296
2276
  fipsIgnoreError: boolean;
2297
2277
  };
2298
- protected logger: Logger;
2299
2278
  static getDefaultConfig(): DeployTestsCommandConfig;
2300
2279
  protected setup(): Promise<void>;
2301
2280
  protected resolveConfig(): Promise<void>;
@@ -2328,7 +2307,6 @@ declare class PluginCommand$2 extends SyntheticsImportTestsCommand {
2328
2307
  fips: boolean;
2329
2308
  fipsIgnoreError: boolean;
2330
2309
  };
2331
- protected logger: Logger;
2332
2310
  static getDefaultConfig(): ImportTestsCommandConfig;
2333
2311
  protected setup(): Promise<void>;
2334
2312
  protected resolveConfig(): Promise<void>;
@@ -2403,6 +2381,26 @@ declare class SyntheticsUploadApplicationCommand extends BaseCommand {
2403
2381
  execute(): Promise<number | void>;
2404
2382
  }
2405
2383
  //#endregion
2384
+ //#region ../base/dist/helpers/logger.d.ts
2385
+ declare enum LogLevel {
2386
+ DEBUG = 1,
2387
+ INFO = 2,
2388
+ WARN = 3,
2389
+ ERROR = 4
2390
+ }
2391
+ declare class Logger {
2392
+ private loglevel;
2393
+ private writeMessage;
2394
+ private shouldIncludeTimestamp;
2395
+ constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestamp?: boolean);
2396
+ setLogLevel(newLogLevel: LogLevel): void;
2397
+ setShouldIncludeTime(newShouldIncludeTimestamp: boolean): void;
2398
+ error(s: string): void;
2399
+ warn(s: string): void;
2400
+ info(s: string): void;
2401
+ debug(s: string): void;
2402
+ }
2403
+ //#endregion
2406
2404
  //#region src/commands/upload-application.d.ts
2407
2405
  declare class PluginCommand extends SyntheticsUploadApplicationCommand {
2408
2406
  protected config: UploadApplicationCommandConfig;
package/dist/bundle.js CHANGED
@@ -5761,7 +5761,7 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
5761
5761
  var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5762
5762
  module.exports = {
5763
5763
  "name": "@datadog/datadog-ci-base",
5764
- "version": "5.16.1",
5764
+ "version": "5.18.0",
5765
5765
  "description": "Base package for Datadog CI",
5766
5766
  "license": "Apache-2.0",
5767
5767
  "keywords": ["datadog", "datadog-ci"],
@@ -5856,7 +5856,7 @@ var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5856
5856
  "datadog-metrics": "^0.9.3",
5857
5857
  "debug": "^4.4.1",
5858
5858
  "deep-extend": "^0.6.0",
5859
- "fast-xml-parser": "^5.5.12",
5859
+ "fast-xml-parser": "^5.7.2",
5860
5860
  "form-data": "^4.0.4",
5861
5861
  "glob": "^13.0.6",
5862
5862
  "inquirer": "^8.2.7",
@@ -65363,8 +65363,6 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
65363
65363
  exports.DATADOG_ROUTE_PATHS = [
65364
65364
  "/api/intake/ci/custom_spans",
65365
65365
  "/api/ui/support/serverless/flare",
65366
- "/api/unstable/deployments/gates/evaluation",
65367
- "/api/unstable/deployments/gates/evaluation/:evaluationId",
65368
65366
  "/api/v1/validate",
65369
65367
  "/api/v2/ci/deployments/correlate-image",
65370
65368
  "/api/v2/ci/deployments/correlate",
@@ -65374,6 +65372,8 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
65374
65372
  "/api/v2/cicovreprt",
65375
65373
  "/api/v2/ciiac",
65376
65374
  "/api/v2/cireport",
65375
+ "/api/v2/deployments/gates/evaluation",
65376
+ "/api/v2/deployments/gates/evaluation/:evaluationId",
65377
65377
  "/api/v2/dora/deployment",
65378
65378
  "/api/v2/git/repository/packfile",
65379
65379
  "/api/v2/git/repository/search_commits",
@@ -137482,6 +137482,7 @@ var require_is_standalone_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
137482
137482
  const { isSea } = yield import("node:sea");
137483
137483
  return isSea();
137484
137484
  } catch (_a) {
137485
+ if (process.pkg !== void 0) return true;
137485
137486
  return false;
137486
137487
  }
137487
137488
  });
@@ -138376,7 +138377,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
138376
138377
  return mod && mod.__esModule ? mod : { "default": mod };
138377
138378
  };
138378
138379
  Object.defineProperty(exports, "__esModule", { value: true });
138379
- exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.executePluginCommand = void 0;
138380
+ exports.getTempPath = exports.VERSION_OVERRIDE_REGEX = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.normalizePluginSubmodule = exports.executePluginCommand = void 0;
138380
138381
  const node_child_process_1 = require("node:child_process");
138381
138382
  const node_path_1 = __importDefault(require("node:path"));
138382
138383
  const node_url_1 = __importDefault(require("node:url"));
@@ -138417,6 +138418,15 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
138417
138418
  }
138418
138419
  });
138419
138420
  exports.executePluginCommand = executePluginCommand;
138421
+ const normalizePluginSubmodule = (submodule) => {
138422
+ if (isPluginSubmodule(submodule)) return submodule;
138423
+ if (typeof submodule === "object" && submodule && "default" in submodule) {
138424
+ const defaultExport = submodule.default;
138425
+ if (isPluginSubmodule(defaultExport)) return defaultExport;
138426
+ }
138427
+ return submodule;
138428
+ };
138429
+ exports.normalizePluginSubmodule = normalizePluginSubmodule;
138420
138430
  const listAllPlugins = () => {
138421
138431
  return Object.keys(package_json_1.peerDependencies);
138422
138432
  };
@@ -138579,6 +138589,21 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
138579
138589
  }
138580
138590
  patchModulePaths();
138581
138591
  yield handlePluginAutoInstall(scope);
138592
+ const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
138593
+ debug("Resolving submodule:", submoduleName);
138594
+ let submoduleResolveError;
138595
+ let resolvedSubmodulePath;
138596
+ try {
138597
+ resolvedSubmodulePath = require.resolve(submoduleName);
138598
+ } catch (error) {
138599
+ debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
138600
+ submoduleResolveError = error;
138601
+ }
138602
+ if (resolvedSubmodulePath) {
138603
+ const submodulePath = node_url_1.default.pathToFileURL(resolvedSubmodulePath).href;
138604
+ debug("Importing submodule:", submodulePath);
138605
+ return (0, exports.normalizePluginSubmodule)(yield import(submodulePath));
138606
+ }
138582
138607
  const pluginPackage = `@datadog/datadog-ci-plugin-${scope}`;
138583
138608
  try {
138584
138609
  const submodule = (_b = require(pluginPackage).commands) === null || _b === void 0 ? void 0 : _b[command];
@@ -138587,19 +138612,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
138587
138612
  return submodule;
138588
138613
  }
138589
138614
  } catch (error) {
138590
- debug("Plugin bundle load failed, trying submodule path:", error);
138591
- }
138592
- const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
138593
- debug("Resolving submodule:", submoduleName);
138594
- let submodulePath = submoduleName;
138595
- try {
138596
- const resolvedPath = require.resolve(submoduleName);
138597
- submodulePath = node_url_1.default.pathToFileURL(resolvedPath).href;
138598
- } catch (error) {
138599
- debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
138615
+ debug("Plugin bundle load failed:", error);
138600
138616
  }
138601
- debug("Importing submodule:", submodulePath);
138602
- return yield import(submodulePath);
138617
+ throw submoduleResolveError;
138603
138618
  });
138604
138619
  const scopeToPackageName = (scope) => {
138605
138620
  if (scope.match(/^@datadog\/datadog-ci-plugin-[a-z-]+$/)) return scope;
@@ -138619,6 +138634,9 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
138619
138634
  const isValidScope = (scope) => {
138620
138635
  return (0, exports.scopeToPackageName)(scope) in package_json_1.peerDependencies;
138621
138636
  };
138637
+ const isPluginSubmodule = (submodule) => {
138638
+ return typeof submodule === "object" && !!submodule && "PluginCommand" in submodule && typeof submodule.PluginCommand === "function";
138639
+ };
138622
138640
  /**
138623
138641
  * @example "1.2.3"
138624
138642
  * @example "file:./artifacts/@datadog-datadog-ci-base-20.tgz"
@@ -138899,57 +138917,11 @@ var require_fips = /* @__PURE__ */ __commonJSMin(((exports) => {
138899
138917
  exports.enableFips = enableFips;
138900
138918
  }));
138901
138919
  //#endregion
138902
- //#region ../base/dist/helpers/logger.js
138903
- var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
138904
- var __importDefault = exports && exports.__importDefault || function(mod) {
138905
- return mod && mod.__esModule ? mod : { "default": mod };
138906
- };
138907
- Object.defineProperty(exports, "__esModule", { value: true });
138908
- exports.Logger = exports.LogLevel = void 0;
138909
- const chalk_1 = __importDefault(require_source$3());
138910
- var LogLevel;
138911
- (function(LogLevel) {
138912
- LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
138913
- LogLevel[LogLevel["INFO"] = 2] = "INFO";
138914
- LogLevel[LogLevel["WARN"] = 3] = "WARN";
138915
- LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
138916
- })(LogLevel || (exports.LogLevel = LogLevel = {}));
138917
- var Logger = class {
138918
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
138919
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
138920
- this.writeMessage = (s) => {
138921
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
138922
- };
138923
- this.loglevel = loglevel;
138924
- }
138925
- setLogLevel(newLogLevel) {
138926
- this.loglevel = newLogLevel;
138927
- }
138928
- setShouldIncludeTime(newShouldIncludeTimestamp) {
138929
- this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
138930
- }
138931
- error(s) {
138932
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
138933
- }
138934
- warn(s) {
138935
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
138936
- }
138937
- info(s) {
138938
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
138939
- }
138940
- debug(s) {
138941
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
138942
- }
138943
- };
138944
- exports.Logger = Logger;
138945
- }));
138946
- //#endregion
138947
138920
  //#region ../../node_modules/get-value/dist/index.mjs
138948
138921
  var import_constants = require_constants$3();
138949
138922
  var import_api = require_api();
138950
138923
  var import_deploy_tests = require_deploy_tests();
138951
138924
  var import_fips = require_fips();
138952
- var import_logger = require_logger();
138953
138925
  var __defProp = Object.defineProperty;
138954
138926
  var __name = (target, value) => __defProp(target, "name", {
138955
138927
  value,
@@ -139220,9 +139192,6 @@ var PluginCommand$3 = class PluginCommand$3 extends import_deploy_tests.Syntheti
139220
139192
  fips: (0, import_env.toBoolean)(process.env[import_constants.FIPS_ENV_VAR]) ?? false,
139221
139193
  fipsIgnoreError: (0, import_env.toBoolean)(process.env[import_constants.FIPS_IGNORE_ERROR_ENV_VAR]) ?? false
139222
139194
  };
139223
- this.logger = new import_logger.Logger((s) => {
139224
- this.context.stdout.write(s);
139225
- }, import_logger.LogLevel.INFO);
139226
139195
  }
139227
139196
  static getDefaultConfig() {
139228
139197
  return {
@@ -139256,7 +139225,7 @@ var PluginCommand$3 = class PluginCommand$3 extends import_deploy_tests.Syntheti
139256
139225
  try {
139257
139226
  await deployTests(this.reporter, this.config);
139258
139227
  } catch (error) {
139259
- this.logger.error(`Error: ${error.message}`);
139228
+ this.reporter.error(`Error: ${error.message}`);
139260
139229
  return 1;
139261
139230
  }
139262
139231
  return 0;
@@ -139402,20 +139371,18 @@ var PluginCommand$2 = class PluginCommand$2 extends import_import_tests.Syntheti
139402
139371
  fips: (0, import_env.toBoolean)(process.env[import_constants.FIPS_ENV_VAR]) ?? false,
139403
139372
  fipsIgnoreError: (0, import_env.toBoolean)(process.env[import_constants.FIPS_IGNORE_ERROR_ENV_VAR]) ?? false
139404
139373
  };
139405
- this.logger = new import_logger.Logger((s) => {
139406
- this.context.stdout.write(s);
139407
- }, import_logger.LogLevel.INFO);
139408
139374
  }
139409
139375
  static getDefaultConfig() {
139410
139376
  return {
139411
139377
  ...getDefaultConfig$1(),
139412
- files: [],
139378
+ files: ["local-test-definitions.json"],
139413
139379
  publicIds: [],
139414
139380
  testSearchQuery: ""
139415
139381
  };
139416
139382
  }
139417
139383
  async setup() {
139418
139384
  (0, import_fips.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
139385
+ this.reporter = getReporter([new DefaultReporter(this)]);
139419
139386
  await this.resolveConfig();
139420
139387
  }
139421
139388
  async resolveConfig() {
@@ -139436,7 +139403,7 @@ var PluginCommand$2 = class PluginCommand$2 extends import_import_tests.Syntheti
139436
139403
  try {
139437
139404
  await importTests(this.reporter, this.config);
139438
139405
  } catch (error) {
139439
- this.logger.error(`Error: ${error.message}`);
139406
+ this.reporter.error(`Error: ${error.message}`);
139440
139407
  return 1;
139441
139408
  }
139442
139409
  return 0;
@@ -140069,8 +140036,8 @@ var PluginCommand$1 = class extends import_run_tests.SyntheticsRunTestsCommand {
140069
140036
  }
140070
140037
  };
140071
140038
  //#endregion
140072
- //#region src/commands/upload-application.ts
140073
- var import_upload_application = (/* @__PURE__ */ __commonJSMin(((exports) => {
140039
+ //#region ../base/dist/commands/synthetics/upload-application.js
140040
+ var require_upload_application = /* @__PURE__ */ __commonJSMin(((exports) => {
140074
140041
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
140075
140042
  function adopt(value) {
140076
140043
  return value instanceof P ? value : new P(function(resolve) {
@@ -140139,7 +140106,56 @@ var import_upload_application = (/* @__PURE__ */ __commonJSMin(((exports) => {
140139
140106
  `,
140140
140107
  examples: [["Upload version `example 1.0` and mark it as latest", "datadog-ci synthetics upload-application --mobileApplicationId '123-123-123' --mobileApplicationVersionFilePath example/test.apk --versionName 'example 1.0' --latest"]]
140141
140108
  });
140142
- })))();
140109
+ }));
140110
+ //#endregion
140111
+ //#region ../base/dist/helpers/logger.js
140112
+ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
140113
+ var __importDefault = exports && exports.__importDefault || function(mod) {
140114
+ return mod && mod.__esModule ? mod : { "default": mod };
140115
+ };
140116
+ Object.defineProperty(exports, "__esModule", { value: true });
140117
+ exports.Logger = exports.LogLevel = void 0;
140118
+ const chalk_1 = __importDefault(require_source$3());
140119
+ var LogLevel;
140120
+ (function(LogLevel) {
140121
+ LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
140122
+ LogLevel[LogLevel["INFO"] = 2] = "INFO";
140123
+ LogLevel[LogLevel["WARN"] = 3] = "WARN";
140124
+ LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
140125
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
140126
+ var Logger = class {
140127
+ constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
140128
+ this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
140129
+ this.writeMessage = (s) => {
140130
+ return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
140131
+ };
140132
+ this.loglevel = loglevel;
140133
+ }
140134
+ setLogLevel(newLogLevel) {
140135
+ this.loglevel = newLogLevel;
140136
+ }
140137
+ setShouldIncludeTime(newShouldIncludeTimestamp) {
140138
+ this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
140139
+ }
140140
+ error(s) {
140141
+ if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
140142
+ }
140143
+ warn(s) {
140144
+ if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
140145
+ }
140146
+ info(s) {
140147
+ if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
140148
+ }
140149
+ debug(s) {
140150
+ if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
140151
+ }
140152
+ };
140153
+ exports.Logger = Logger;
140154
+ }));
140155
+ //#endregion
140156
+ //#region src/commands/upload-application.ts
140157
+ var import_upload_application = require_upload_application();
140158
+ var import_logger = require_logger();
140143
140159
  var PluginCommand = class PluginCommand extends import_upload_application.SyntheticsUploadApplicationCommand {
140144
140160
  constructor(..._args) {
140145
140161
  super(..._args);