@datadog/datadog-ci-plugin-terraform 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
@@ -7739,7 +7739,7 @@ var require_upath = /* @__PURE__ */ __commonJSMin(((exports) => {
7739
7739
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7740
7740
  module.exports = {
7741
7741
  "name": "@datadog/datadog-ci-base",
7742
- "version": "5.13.0",
7742
+ "version": "5.13.1",
7743
7743
  "description": "Base package for Datadog CI",
7744
7744
  "license": "Apache-2.0",
7745
7745
  "keywords": ["datadog", "datadog-ci"],
@@ -64969,10 +64969,10 @@ var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
64969
64969
  throw requestError;
64970
64970
  }
64971
64971
  const responseHeaders = parseResponseHeaders(response.headers);
64972
- const contentType = (_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "";
64972
+ const mediaType = ((_h = responseHeaders["content-type"]) !== null && _h !== void 0 ? _h : "").split(";")[0].trim();
64973
64973
  const rawBody = yield response.text();
64974
64974
  let data = rawBody;
64975
- if (contentType.includes("application/json") && rawBody.length > 0) try {
64975
+ if (rawBody.length > 0 && (mediaType === "application/json" || mediaType === "application/vnd.api+json")) try {
64976
64976
  data = JSON.parse(rawBody);
64977
64977
  } catch (_j) {}
64978
64978
  if (!response.ok) throw new RequestError(`Request failed with status code ${response.status}`, config, {
@@ -66446,19 +66446,35 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
66446
66446
  /**
66447
66447
  * Narrows the list of Worker log files to check by using ACTIONS_ORCHESTRATION_ID
66448
66448
  * to identify the correct log for the current job on non-ephemeral runners.
66449
+ *
66450
+ * ACTIONS_ORCHESTRATION_ID format: <planId>.<jobId>.__default
66451
+ *
66452
+ * All jobs in the same GitHub Actions workflow run share the same planId.
66453
+ * On multi-runners (non-ephemeral runners processing sequential jobs), multiple
66454
+ * Worker log files can exist from different jobs of the same workflow run,
66455
+ * all containing the same planId. Matching only on planId causes the first
66456
+ * (chronologically oldest) log to be selected, which may belong to a previous
66457
+ * job. The jobId (second segment of ACTIONS_ORCHESTRATION_ID) is unique per job
66458
+ * and is serialized as "jobId" in the Worker log's job message JSON, allowing
66459
+ * unambiguous identification of the current job's log.
66449
66460
  */
66450
66461
  const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
66451
66462
  const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
66452
66463
  if (!orchestrationId) return workerLogFiles;
66453
- const planId = orchestrationId.split(".")[0];
66464
+ const parts = orchestrationId.split(".");
66465
+ const planId = parts[0];
66466
+ const jobId = parts[1];
66454
66467
  for (const logFile of workerLogFiles) {
66455
66468
  const filePath = upath_1.default.join(foundDiagDir, logFile);
66456
- if (fs_1$2.default.readFileSync(filePath, "utf-8").includes(`"planId": "${planId}"`)) {
66457
- context.stdout.write(`Found Worker log for planId ${planId}: ${logFile}\n`);
66469
+ const content = fs_1$2.default.readFileSync(filePath, "utf-8");
66470
+ const matchesPlanId = content.includes(`"planId": "${planId}"`);
66471
+ const matchesJobId = !jobId || content.includes(`"jobId": "${jobId}"`);
66472
+ if (matchesPlanId && matchesJobId) {
66473
+ context.stdout.write(`Found Worker log for planId ${planId}, jobId ${jobId !== null && jobId !== void 0 ? jobId : "N/A"}: ${logFile}\n`);
66458
66474
  return [logFile];
66459
66475
  }
66460
66476
  }
66461
- context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log for planId ${planId}, checking all logs\n`);
66477
+ 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`);
66462
66478
  return workerLogFiles;
66463
66479
  };
66464
66480
  const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {
@@ -79293,7 +79309,6 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
79293
79309
  ]);
79294
79310
  console.log();
79295
79311
  patchModulePaths(nodeModulesPath);
79296
- printPluginVersion(pluginPackage);
79297
79312
  });
79298
79313
  const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, function* () {
79299
79314
  if (!!process.env["DISABLE_PLUGIN_AUTO_INSTALL"]) {