@datadog/datadog-ci-plugin-container-app 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
@@ -59579,7 +59579,7 @@ var require_src$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59579
59579
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59580
59580
  module.exports = {
59581
59581
  "name": "@datadog/datadog-ci-base",
59582
- "version": "5.13.0",
59582
+ "version": "5.13.1",
59583
59583
  "description": "Base package for Datadog CI",
59584
59584
  "license": "Apache-2.0",
59585
59585
  "keywords": ["datadog", "datadog-ci"],
@@ -60742,7 +60742,6 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
60742
60742
  ]);
60743
60743
  console.log();
60744
60744
  patchModulePaths(nodeModulesPath);
60745
- printPluginVersion(pluginPackage);
60746
60745
  });
60747
60746
  const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, function* () {
60748
60747
  if (!!process.env["DISABLE_PLUGIN_AUTO_INSTALL"]) {
@@ -114380,10 +114379,10 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
114380
114379
  throw requestError;
114381
114380
  }
114382
114381
  const responseHeaders = parseResponseHeaders(response.headers);
114383
- const contentType = (_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "";
114382
+ const mediaType = ((_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "").split(";")[0].trim();
114384
114383
  const rawBody = yield response.text();
114385
114384
  let data = rawBody;
114386
- if (contentType.includes("application/json") && rawBody.length > 0) try {
114385
+ if (rawBody.length > 0 && (mediaType === "application/json" || mediaType === "application/vnd.api+json")) try {
114387
114386
  data = JSON.parse(rawBody);
114388
114387
  } catch (_j) {}
114389
114388
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
@@ -124584,19 +124583,35 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
124584
124583
  /**
124585
124584
  * Narrows the list of Worker log files to check by using ACTIONS_ORCHESTRATION_ID
124586
124585
  * to identify the correct log for the current job on non-ephemeral runners.
124586
+ *
124587
+ * ACTIONS_ORCHESTRATION_ID format: <planId>.<jobId>.__default
124588
+ *
124589
+ * All jobs in the same GitHub Actions workflow run share the same planId.
124590
+ * On multi-runners (non-ephemeral runners processing sequential jobs), multiple
124591
+ * Worker log files can exist from different jobs of the same workflow run,
124592
+ * all containing the same planId. Matching only on planId causes the first
124593
+ * (chronologically oldest) log to be selected, which may belong to a previous
124594
+ * job. The jobId (second segment of ACTIONS_ORCHESTRATION_ID) is unique per job
124595
+ * and is serialized as "jobId" in the Worker log's job message JSON, allowing
124596
+ * unambiguous identification of the current job's log.
124587
124597
  */
124588
124598
  const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
124589
124599
  const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
124590
124600
  if (!orchestrationId) return workerLogFiles;
124591
- const planId = orchestrationId.split(".")[0];
124601
+ const parts = orchestrationId.split(".");
124602
+ const planId = parts[0];
124603
+ const jobId = parts[1];
124592
124604
  for (const logFile of workerLogFiles) {
124593
124605
  const filePath = upath_1.default.join(foundDiagDir, logFile);
124594
- if (fs_1$2.default.readFileSync(filePath, "utf-8").includes(`"planId": "${planId}"`)) {
124595
- context.stdout.write(`Found Worker log for planId ${planId}: ${logFile}\n`);
124606
+ const content = fs_1$2.default.readFileSync(filePath, "utf-8");
124607
+ const matchesPlanId = content.includes(`"planId": "${planId}"`);
124608
+ const matchesJobId = !jobId || content.includes(`"jobId": "${jobId}"`);
124609
+ if (matchesPlanId && matchesJobId) {
124610
+ context.stdout.write(`Found Worker log for planId ${planId}, jobId ${jobId !== null && jobId !== void 0 ? jobId : "N/A"}: ${logFile}\n`);
124596
124611
  return [logFile];
124597
124612
  }
124598
124613
  }
124599
- context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log for planId ${planId}, checking all logs\n`);
124614
+ 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`);
124600
124615
  return workerLogFiles;
124601
124616
  };
124602
124617
  const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {