@datadog/datadog-ci-plugin-synthetics 5.13.0 → 5.13.1

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
@@ -2312,7 +2312,7 @@ var require_upath = /* @__PURE__ */ __commonJSMin(((exports) => {
2312
2312
  var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2313
2313
  module.exports = {
2314
2314
  "name": "@datadog/datadog-ci-base",
2315
- "version": "5.13.0",
2315
+ "version": "5.13.1",
2316
2316
  "description": "Base package for Datadog CI",
2317
2317
  "license": "Apache-2.0",
2318
2318
  "keywords": ["datadog", "datadog-ci"],
@@ -64976,10 +64976,10 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
64976
64976
  throw requestError;
64977
64977
  }
64978
64978
  const responseHeaders = parseResponseHeaders(response.headers);
64979
- const contentType = (_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "";
64979
+ const mediaType = ((_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "").split(";")[0].trim();
64980
64980
  const rawBody = yield response.text();
64981
64981
  let data = rawBody;
64982
- if (contentType.includes("application/json") && rawBody.length > 0) try {
64982
+ if (rawBody.length > 0 && (mediaType === "application/json" || mediaType === "application/vnd.api+json")) try {
64983
64983
  data = JSON.parse(rawBody);
64984
64984
  } catch (_j) {}
64985
64985
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
@@ -66453,19 +66453,35 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
66453
66453
  /**
66454
66454
  * Narrows the list of Worker log files to check by using ACTIONS_ORCHESTRATION_ID
66455
66455
  * to identify the correct log for the current job on non-ephemeral runners.
66456
+ *
66457
+ * ACTIONS_ORCHESTRATION_ID format: <planId>.<jobId>.__default
66458
+ *
66459
+ * All jobs in the same GitHub Actions workflow run share the same planId.
66460
+ * On multi-runners (non-ephemeral runners processing sequential jobs), multiple
66461
+ * Worker log files can exist from different jobs of the same workflow run,
66462
+ * all containing the same planId. Matching only on planId causes the first
66463
+ * (chronologically oldest) log to be selected, which may belong to a previous
66464
+ * job. The jobId (second segment of ACTIONS_ORCHESTRATION_ID) is unique per job
66465
+ * and is serialized as "jobId" in the Worker log's job message JSON, allowing
66466
+ * unambiguous identification of the current job's log.
66456
66467
  */
66457
66468
  const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
66458
66469
  const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
66459
66470
  if (!orchestrationId) return workerLogFiles;
66460
- const planId = orchestrationId.split(".")[0];
66471
+ const parts = orchestrationId.split(".");
66472
+ const planId = parts[0];
66473
+ const jobId = parts[1];
66461
66474
  for (const logFile of workerLogFiles) {
66462
66475
  const filePath = upath_1.default.join(foundDiagDir, logFile);
66463
- if (fs_1$2.default.readFileSync(filePath, "utf-8").includes(`"planId": "${planId}"`)) {
66464
- context.stdout.write(`Found Worker log for planId ${planId}: ${logFile}\n`);
66476
+ const content = fs_1$2.default.readFileSync(filePath, "utf-8");
66477
+ const matchesPlanId = content.includes(`"planId": "${planId}"`);
66478
+ const matchesJobId = !jobId || content.includes(`"jobId": "${jobId}"`);
66479
+ if (matchesPlanId && matchesJobId) {
66480
+ context.stdout.write(`Found Worker log for planId ${planId}, jobId ${jobId !== null && jobId !== void 0 ? jobId : "N/A"}: ${logFile}\n`);
66465
66481
  return [logFile];
66466
66482
  }
66467
66483
  }
66468
- context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log for planId ${planId}, checking all logs\n`);
66484
+ context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log for planId ${planId}, jobId ${jobId !== null && jobId !== void 0 ? jobId : "N/A"}, checking all logs\n`);
66469
66485
  return workerLogFiles;
66470
66486
  };
66471
66487
  const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {
@@ -142904,7 +142920,6 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
142904
142920
  ]);
142905
142921
  console.log();
142906
142922
  patchModulePaths(nodeModulesPath);
142907
- printPluginVersion(pluginPackage);
142908
142923
  });
142909
142924
  const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, function* () {
142910
142925
  if (!!process.env["DISABLE_PLUGIN_AUTO_INSTALL"]) {