@datadog/datadog-ci-plugin-sarif 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
@@ -5909,7 +5909,7 @@ var require_src$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5909
5909
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5910
5910
  module.exports = {
5911
5911
  "name": "@datadog/datadog-ci-base",
5912
- "version": "5.13.0",
5912
+ "version": "5.13.1",
5913
5913
  "description": "Base package for Datadog CI",
5914
5914
  "license": "Apache-2.0",
5915
5915
  "keywords": ["datadog", "datadog-ci"],
@@ -7072,7 +7072,6 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
7072
7072
  ]);
7073
7073
  console.log();
7074
7074
  patchModulePaths(nodeModulesPath);
7075
- printPluginVersion(pluginPackage);
7076
7075
  });
7077
7076
  const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, function* () {
7078
7077
  if (!!process.env["DISABLE_PLUGIN_AUTO_INSTALL"]) {
@@ -65481,10 +65480,10 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
65481
65480
  throw requestError;
65482
65481
  }
65483
65482
  const responseHeaders = parseResponseHeaders(response.headers);
65484
- const contentType = (_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "";
65483
+ const mediaType = ((_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "").split(";")[0].trim();
65485
65484
  const rawBody = yield response.text();
65486
65485
  let data = rawBody;
65487
- if (contentType.includes("application/json") && rawBody.length > 0) try {
65486
+ if (rawBody.length > 0 && (mediaType === "application/json" || mediaType === "application/vnd.api+json")) try {
65488
65487
  data = JSON.parse(rawBody);
65489
65488
  } catch (_j) {}
65490
65489
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
@@ -66538,19 +66537,35 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
66538
66537
  /**
66539
66538
  * Narrows the list of Worker log files to check by using ACTIONS_ORCHESTRATION_ID
66540
66539
  * to identify the correct log for the current job on non-ephemeral runners.
66540
+ *
66541
+ * ACTIONS_ORCHESTRATION_ID format: <planId>.<jobId>.__default
66542
+ *
66543
+ * All jobs in the same GitHub Actions workflow run share the same planId.
66544
+ * On multi-runners (non-ephemeral runners processing sequential jobs), multiple
66545
+ * Worker log files can exist from different jobs of the same workflow run,
66546
+ * all containing the same planId. Matching only on planId causes the first
66547
+ * (chronologically oldest) log to be selected, which may belong to a previous
66548
+ * job. The jobId (second segment of ACTIONS_ORCHESTRATION_ID) is unique per job
66549
+ * and is serialized as "jobId" in the Worker log's job message JSON, allowing
66550
+ * unambiguous identification of the current job's log.
66541
66551
  */
66542
66552
  const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
66543
66553
  const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
66544
66554
  if (!orchestrationId) return workerLogFiles;
66545
- const planId = orchestrationId.split(".")[0];
66555
+ const parts = orchestrationId.split(".");
66556
+ const planId = parts[0];
66557
+ const jobId = parts[1];
66546
66558
  for (const logFile of workerLogFiles) {
66547
66559
  const filePath = upath_1.default.join(foundDiagDir, logFile);
66548
- if (fs_1$2.default.readFileSync(filePath, "utf-8").includes(`"planId": "${planId}"`)) {
66549
- context.stdout.write(`Found Worker log for planId ${planId}: ${logFile}\n`);
66560
+ const content = fs_1$2.default.readFileSync(filePath, "utf-8");
66561
+ const matchesPlanId = content.includes(`"planId": "${planId}"`);
66562
+ const matchesJobId = !jobId || content.includes(`"jobId": "${jobId}"`);
66563
+ if (matchesPlanId && matchesJobId) {
66564
+ context.stdout.write(`Found Worker log for planId ${planId}, jobId ${jobId !== null && jobId !== void 0 ? jobId : "N/A"}: ${logFile}\n`);
66550
66565
  return [logFile];
66551
66566
  }
66552
66567
  }
66553
- context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log for planId ${planId}, checking all logs\n`);
66568
+ 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`);
66554
66569
  return workerLogFiles;
66555
66570
  };
66556
66571
  const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {