@datadog/datadog-ci-plugin-sarif 5.13.1 → 5.15.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.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.1",
5912
+ "version": "5.15.0",
5913
5913
  "description": "Base package for Datadog CI",
5914
5914
  "license": "Apache-2.0",
5915
5915
  "keywords": ["datadog", "datadog-ci"],
@@ -5939,6 +5939,10 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5939
5939
  "development": "./src/constants.ts",
5940
5940
  "default": "./dist/constants.js"
5941
5941
  },
5942
+ "./helpers/request/*": {
5943
+ "development": "./src/helpers/request/*.ts",
5944
+ "default": "./dist/helpers/request/*.js"
5945
+ },
5942
5946
  "./helpers/*": {
5943
5947
  "development": "./src/helpers/*.ts",
5944
5948
  "default": "./dist/helpers/*.js"
@@ -43739,177 +43743,6 @@ var require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
43739
43743
  exports.ProxyAgent = ProxyAgent;
43740
43744
  }));
43741
43745
  //#endregion
43742
- //#region ../../node_modules/ansi-escapes/index.js
43743
- var require_ansi_escapes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
43744
- const ansiEscapes = module.exports;
43745
- module.exports.default = ansiEscapes;
43746
- const ESC = "\x1B[";
43747
- const OSC = "\x1B]";
43748
- const BEL = "\x07";
43749
- const SEP = ";";
43750
- const isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
43751
- ansiEscapes.cursorTo = (x, y) => {
43752
- if (typeof x !== "number") throw new TypeError("The `x` argument is required");
43753
- if (typeof y !== "number") return ESC + (x + 1) + "G";
43754
- return ESC + (y + 1) + ";" + (x + 1) + "H";
43755
- };
43756
- ansiEscapes.cursorMove = (x, y) => {
43757
- if (typeof x !== "number") throw new TypeError("The `x` argument is required");
43758
- let ret = "";
43759
- if (x < 0) ret += ESC + -x + "D";
43760
- else if (x > 0) ret += ESC + x + "C";
43761
- if (y < 0) ret += ESC + -y + "A";
43762
- else if (y > 0) ret += ESC + y + "B";
43763
- return ret;
43764
- };
43765
- ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
43766
- ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
43767
- ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
43768
- ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
43769
- ansiEscapes.cursorLeft = ESC + "G";
43770
- ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
43771
- ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
43772
- ansiEscapes.cursorGetPosition = ESC + "6n";
43773
- ansiEscapes.cursorNextLine = ESC + "E";
43774
- ansiEscapes.cursorPrevLine = ESC + "F";
43775
- ansiEscapes.cursorHide = ESC + "?25l";
43776
- ansiEscapes.cursorShow = ESC + "?25h";
43777
- ansiEscapes.eraseLines = (count) => {
43778
- let clear = "";
43779
- for (let i = 0; i < count; i++) clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
43780
- if (count) clear += ansiEscapes.cursorLeft;
43781
- return clear;
43782
- };
43783
- ansiEscapes.eraseEndLine = ESC + "K";
43784
- ansiEscapes.eraseStartLine = ESC + "1K";
43785
- ansiEscapes.eraseLine = ESC + "2K";
43786
- ansiEscapes.eraseDown = ESC + "J";
43787
- ansiEscapes.eraseUp = ESC + "1J";
43788
- ansiEscapes.eraseScreen = ESC + "2J";
43789
- ansiEscapes.scrollUp = ESC + "S";
43790
- ansiEscapes.scrollDown = ESC + "T";
43791
- ansiEscapes.clearScreen = "\x1Bc";
43792
- ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
43793
- ansiEscapes.beep = BEL;
43794
- ansiEscapes.link = (text, url) => {
43795
- return [
43796
- OSC,
43797
- "8",
43798
- SEP,
43799
- SEP,
43800
- url,
43801
- BEL,
43802
- text,
43803
- OSC,
43804
- "8",
43805
- SEP,
43806
- SEP,
43807
- BEL
43808
- ].join("");
43809
- };
43810
- ansiEscapes.image = (buffer, options = {}) => {
43811
- let ret = `${OSC}1337;File=inline=1`;
43812
- if (options.width) ret += `;width=${options.width}`;
43813
- if (options.height) ret += `;height=${options.height}`;
43814
- if (options.preserveAspectRatio === false) ret += ";preserveAspectRatio=0";
43815
- return ret + ":" + buffer.toString("base64") + BEL;
43816
- };
43817
- ansiEscapes.iTerm = {
43818
- setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
43819
- annotation: (message, options = {}) => {
43820
- let ret = `${OSC}1337;`;
43821
- const hasX = typeof options.x !== "undefined";
43822
- const hasY = typeof options.y !== "undefined";
43823
- if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
43824
- message = message.replace(/\|/g, "");
43825
- ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
43826
- if (options.length > 0) ret += (hasX ? [
43827
- message,
43828
- options.length,
43829
- options.x,
43830
- options.y
43831
- ] : [options.length, message]).join("|");
43832
- else ret += message;
43833
- return ret + BEL;
43834
- }
43835
- };
43836
- }));
43837
- //#endregion
43838
- //#region ../../node_modules/supports-hyperlinks/index.js
43839
- var require_supports_hyperlinks = /* @__PURE__ */ __commonJSMin(((exports, module) => {
43840
- const supportsColor = require_supports_color();
43841
- const hasFlag = require_has_flag();
43842
- function parseVersion(versionString) {
43843
- if (/^\d{3,4}$/.test(versionString)) {
43844
- const m = /(\d{1,2})(\d{2})/.exec(versionString);
43845
- return {
43846
- major: 0,
43847
- minor: parseInt(m[1], 10),
43848
- patch: parseInt(m[2], 10)
43849
- };
43850
- }
43851
- const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
43852
- return {
43853
- major: versions[0],
43854
- minor: versions[1],
43855
- patch: versions[2]
43856
- };
43857
- }
43858
- function supportsHyperlink(stream) {
43859
- const { env } = process;
43860
- if ("FORCE_HYPERLINK" in env) return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
43861
- if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) return false;
43862
- if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) return true;
43863
- if ("NETLIFY" in env) return true;
43864
- if (!supportsColor.supportsColor(stream)) return false;
43865
- if (stream && !stream.isTTY) return false;
43866
- if (process.platform === "win32") return false;
43867
- if ("CI" in env) return false;
43868
- if ("TEAMCITY_VERSION" in env) return false;
43869
- if ("TERM_PROGRAM" in env) {
43870
- const version = parseVersion(env.TERM_PROGRAM_VERSION);
43871
- switch (env.TERM_PROGRAM) {
43872
- case "iTerm.app":
43873
- if (version.major === 3) return version.minor >= 1;
43874
- return version.major > 3;
43875
- case "WezTerm": return version.major >= 20200620;
43876
- case "vscode": return version.major > 1 || version.major === 1 && version.minor >= 72;
43877
- }
43878
- }
43879
- if ("VTE_VERSION" in env) {
43880
- if (env.VTE_VERSION === "0.50.0") return false;
43881
- const version = parseVersion(env.VTE_VERSION);
43882
- return version.major > 0 || version.minor >= 50;
43883
- }
43884
- return false;
43885
- }
43886
- module.exports = {
43887
- supportsHyperlink,
43888
- stdout: supportsHyperlink(process.stdout),
43889
- stderr: supportsHyperlink(process.stderr)
43890
- };
43891
- }));
43892
- //#endregion
43893
- //#region ../../node_modules/terminal-link/index.js
43894
- var require_terminal_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
43895
- const ansiEscapes = require_ansi_escapes();
43896
- const supportsHyperlinks = require_supports_hyperlinks();
43897
- const terminalLink = (text, url, { target = "stdout", ...options } = {}) => {
43898
- if (!supportsHyperlinks[target]) {
43899
- if (options.fallback === false) return text;
43900
- return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
43901
- }
43902
- return ansiEscapes.link(text, url);
43903
- };
43904
- module.exports = (text, url, options = {}) => terminalLink(text, url, options);
43905
- module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {
43906
- target: "stderr",
43907
- ...options
43908
- });
43909
- module.exports.isSupported = supportsHyperlinks.stdout;
43910
- module.exports.stderr.isSupported = supportsHyperlinks.stderr;
43911
- }));
43912
- //#endregion
43913
43746
  //#region ../../node_modules/undici/lib/core/symbols.js
43914
43747
  var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
43915
43748
  module.exports = {
@@ -65535,20 +65368,15 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
65535
65368
  return mod && mod.__esModule ? mod : { "default": mod };
65536
65369
  };
65537
65370
  Object.defineProperty(exports, "__esModule", { value: true });
65538
- exports.isFile = exports.getGitHubEventPayload = exports.execute = exports.maskString = exports.formatBytes = exports.timedExecAsync = exports.filterAndFormatGithubRemote = exports.filterSensitiveInfoFromRepository = exports.performSubCommand = exports.pluralize = exports.normalizeRef = exports.recursivelyRemoveUndefinedValues = exports.removeUndefinedValues = exports.removeEmptyValues = exports.buildPath = exports.getApiHostForSite = exports.getProxyAgent = exports.getRequestBuilder = exports.getProxyUrl = exports.resolveConfigFromFile = exports.resolveConfigFromFileAndEnvironment = exports.getConfig = exports.pick = exports.makeTerminalLink = exports.DEFAULT_CONFIG_PATHS = void 0;
65371
+ exports.isFile = exports.getGitHubEventPayload = exports.execute = exports.maskString = exports.formatBytes = exports.timedExecAsync = exports.filterAndFormatGithubRemote = exports.filterSensitiveInfoFromRepository = exports.performSubCommand = exports.pluralize = exports.normalizeRef = exports.recursivelyRemoveUndefinedValues = exports.removeUndefinedValues = exports.removeEmptyValues = exports.buildPath = exports.getApiHostForSite = exports.getProxyAgent = exports.getRequestBuilder = exports.getProxyUrl = exports.resolveConfigFromFile = exports.resolveConfigFromFileAndEnvironment = exports.getConfig = exports.pick = exports.DEFAULT_CONFIG_PATHS = void 0;
65539
65372
  const child_process_1 = require("child_process");
65540
65373
  const fs_1$3 = require("fs");
65541
65374
  const util_1 = require("util");
65542
65375
  const clipanion_1 = require_advanced();
65543
65376
  const deep_extend_1 = __importDefault(require_deep_extend());
65544
65377
  const proxy_agent_1 = require_dist$3();
65545
- const terminal_link_1 = __importDefault(require_terminal_link());
65546
65378
  const request_1 = require_request();
65547
65379
  exports.DEFAULT_CONFIG_PATHS = ["datadog-ci.json"];
65548
- const makeTerminalLink = (url) => {
65549
- return ((strings) => (0, terminal_link_1.default)(strings[0], url));
65550
- };
65551
- exports.makeTerminalLink = makeTerminalLink;
65552
65380
  const pick = (base, keys) => {
65553
65381
  const definedKeys = keys.filter((key) => !!base[key]);
65554
65382
  const pickedObject = {};
@@ -65820,10 +65648,11 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
65820
65648
  return mod && mod.__esModule ? mod : { "default": mod };
65821
65649
  };
65822
65650
  Object.defineProperty(exports, "__esModule", { value: true });
65823
- exports.getGithubJobIDFromLogs = exports.getGithubStepInfoFromLogs = exports.enrichCIEnvFromGithubLogs = exports.getGithubJobNameFromLogs = exports.isGithubWindowsRunner = exports.shouldGetGithubJobID = exports.shouldGetGithubJobDisplayName = exports.isInteractive = exports.getCIProvider = exports.isCI = exports.getCIEnv = exports.getCIMetadata = exports.getCISpanTags = exports.githubWellKnownDiagnosticDirsWin = exports.githubWellKnownDiagnosticDirsUnix = exports.validateLevel = exports.LEVEL_TO_NUMBER = exports.VALID_LEVELS = exports.CI_LEVELS = exports.envDDGithubStepIndex = exports.envDDGithubJobName = exports.CI_ENGINES = void 0;
65651
+ exports.getGithubJobIDFromLogs = exports.getGithubStepInfoFromLogs = exports.enrichCIEnvFromGithubLogs = exports.getGithubJobNameFromLogs = exports.isGithubWindowsRunner = exports.shouldGetGithubJobID = exports.shouldGetGithubJobDisplayName = exports.isInteractive = exports.getCIProvider = exports.isCI = exports.getCIEnv = exports.getCIMetadata = exports.getCISpanTags = exports.githubWellKnownDiagnosticDirPatternsWin = exports.githubWellKnownDiagnosticDirPatternsUnix = exports.githubWellKnownDiagnosticDirsWin = exports.githubWellKnownDiagnosticDirsUnix = exports.validateLevel = exports.LEVEL_TO_NUMBER = exports.VALID_LEVELS = exports.CI_LEVELS = exports.envDDGithubStepIndex = exports.envDDGithubJobName = exports.CI_ENGINES = void 0;
65824
65652
  const fs_1$2 = __importDefault(require("fs"));
65825
65653
  const chalk_1 = __importDefault(require_source());
65826
65654
  const upath_1 = __importDefault(require_upath());
65655
+ const glob_1 = require_glob();
65827
65656
  const tags_1 = require_tags();
65828
65657
  const user_provided_git_1 = require_user_provided_git();
65829
65658
  const utils_1 = require_utils$1();
@@ -65877,12 +65706,10 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
65877
65706
  if (level === exports.CI_LEVELS.STEP && provider !== exports.CI_ENGINES.GITHUB) return `Level '${exports.CI_LEVELS.STEP}' is only supported for provider [${exports.CI_ENGINES.GITHUB}]`;
65878
65707
  };
65879
65708
  exports.validateLevel = validateLevel;
65880
- exports.githubWellKnownDiagnosticDirsUnix = [
65881
- "/home/runner/actions-runner/cached/_diag",
65882
- "/home/runner/actions-runner/_diag",
65883
- "/opt/actions-runner/_diag"
65884
- ];
65885
- exports.githubWellKnownDiagnosticDirsWin = ["C:/actions-runner/cached/_diag", "C:/actions-runner/_diag"];
65709
+ exports.githubWellKnownDiagnosticDirsUnix = ["/home/runner/actions-runner/_diag", "/opt/actions-runner/_diag"];
65710
+ exports.githubWellKnownDiagnosticDirsWin = ["C:/actions-runner/_diag"];
65711
+ exports.githubWellKnownDiagnosticDirPatternsUnix = ["/home/runner/actions-runner/*/_diag", "/home/runner/actions-runner/*/*/_diag"];
65712
+ exports.githubWellKnownDiagnosticDirPatternsWin = ["C:/actions-runner/*/_diag", "C:/actions-runner/*/*/_diag"];
65886
65713
  const githubJobDisplayNameRegex = /"jobDisplayName":\s*"((?:[^"\\]|\\.)*)"/;
65887
65714
  const githubJodIDRegex = /"job":\s*{[\s\S]*?"v"\s*:\s*(\d+)(?:\.0)?/;
65888
65715
  /**
@@ -65913,13 +65740,27 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
65913
65740
  const runnerTemp = process.env.RUNNER_TEMP;
65914
65741
  if (runnerTemp) {
65915
65742
  const runnerRoot = upath_1.default.resolve(runnerTemp, "..", "..");
65916
- dirs.push(upath_1.default.join(runnerRoot, "cached", "_diag"));
65743
+ dirs.push(`${runnerRoot}/*/_diag`);
65744
+ dirs.push(`${runnerRoot}/*/*/_diag`);
65917
65745
  dirs.push(upath_1.default.join(runnerRoot, "_diag"));
65918
- dirs.push(upath_1.default.join(runnerRoot, "actions-runner", "cached", "_diag"));
65746
+ dirs.push(`${runnerRoot}/actions-runner/*/_diag`);
65747
+ dirs.push(`${runnerRoot}/actions-runner/*/*/_diag`);
65919
65748
  dirs.push(upath_1.default.join(runnerRoot, "actions-runner", "_diag"));
65920
65749
  }
65921
65750
  return uniq(dirs.filter(Boolean));
65922
65751
  };
65752
+ /**
65753
+ * Expands a mixed list of literal directories and glob patterns into concrete
65754
+ * directories. Literals pass through unchanged (existence is checked later).
65755
+ */
65756
+ const expandDiagnosticDirCandidates = (candidates) => {
65757
+ const expanded = [];
65758
+ for (const candidate of candidates) if ((0, glob_1.hasMagic)(candidate)) try {
65759
+ expanded.push(...(0, glob_1.globSync)(candidate));
65760
+ } catch (_a) {}
65761
+ else expanded.push(candidate);
65762
+ return uniq(expanded);
65763
+ };
65923
65764
  const parseEmailAndName = (emailAndName) => {
65924
65765
  if (!emailAndName) return {
65925
65766
  name: "",
@@ -66511,8 +66352,16 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
66511
66352
  const getGithubWorkerLogFiles = (context) => {
66512
66353
  let foundDiagDir = "";
66513
66354
  let workerLogFiles = [];
66514
- let wellKnownDirs = uniq([...getGithubDiagnosticDirsFromEnv(), ...exports.githubWellKnownDiagnosticDirsUnix]);
66515
- if ((0, exports.isGithubWindowsRunner)()) wellKnownDirs = uniq([...getGithubDiagnosticDirsFromEnv(), ...exports.githubWellKnownDiagnosticDirsWin]);
66355
+ let wellKnownDirs = expandDiagnosticDirCandidates([
66356
+ ...getGithubDiagnosticDirsFromEnv(),
66357
+ ...exports.githubWellKnownDiagnosticDirPatternsUnix,
66358
+ ...exports.githubWellKnownDiagnosticDirsUnix
66359
+ ]);
66360
+ if ((0, exports.isGithubWindowsRunner)()) wellKnownDirs = expandDiagnosticDirCandidates([
66361
+ ...getGithubDiagnosticDirsFromEnv(),
66362
+ ...exports.githubWellKnownDiagnosticDirPatternsWin,
66363
+ ...exports.githubWellKnownDiagnosticDirsWin
66364
+ ]);
66516
66365
  for (const currentDir of wellKnownDirs) try {
66517
66366
  const potentialLogs = fs_1$2.default.readdirSync(currentDir, { withFileTypes: true }).filter((file) => file.isFile() && file.name.startsWith("Worker_") && file.name.endsWith(".log")).map((file) => file.name);
66518
66367
  if (potentialLogs.length > 0) {
@@ -66535,38 +66384,43 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
66535
66384
  return [foundDiagDir, workerLogFiles];
66536
66385
  };
66537
66386
  /**
66538
- * Narrows the list of Worker log files to check by using ACTIONS_ORCHESTRATION_ID
66539
- * to identify the correct log for the current job on non-ephemeral runners.
66387
+ * Narrows the list of Worker log files to the one belonging to the current job.
66540
66388
  *
66541
- * ACTIONS_ORCHESTRATION_ID format: <planId>.<jobId>.__default
66389
+ * Worker log filenames contain a timestamp (Worker_YYYYMMDD-HHMMSS-utc.log), so
66390
+ * alphabetical order equals chronological order. Logs are always returned
66391
+ * newest-first so that the caller's iteration naturally encounters the current
66392
+ * job's log before any earlier ones — correct on both ephemeral and non-ephemeral
66393
+ * (multi) runners regardless of the strategy used.
66542
66394
  *
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.
66395
+ * Primary strategy (runner >= v2.331.0, feature-flag gated):
66396
+ * ACTIONS_ORCHESTRATION_ID is set by the runner from the system.orchestrationId
66397
+ * variable in the job request message. That variable is serialized into the Worker
66398
+ * log as part of the job message JSON. planId is a GUID shared by all jobs in the
66399
+ * same workflow run, so the full orchestration ID is needed for a unique match:
66400
+ * Non-matrix job: <planId>.<yaml-job-key>.__default
66401
+ * Single-dimension matrix: <planId>.<yaml-job-key>.<matrix-value>
66402
+ * Multi-dimension matrix: <planId>.<yaml-job-key>.<val1>.<val2>[...]
66403
+ *
66404
+ * Fallback (runner < v2.331.0 or ACTIONS_ORCHESTRATION_ID absent/unmatched):
66405
+ * Return all logs newest-first. The caller iterates until it finds a jobDisplayName,
66406
+ * which on a single-job runner is immediate, and on a multi-runner is the current
66407
+ * job's (most recent) log.
66551
66408
  */
66552
66409
  const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
66410
+ const sortedNewestFirst = [...workerLogFiles].sort().reverse();
66553
66411
  const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
66554
- if (!orchestrationId) return workerLogFiles;
66555
- const parts = orchestrationId.split(".");
66556
- const planId = parts[0];
66557
- const jobId = parts[1];
66558
- for (const logFile of workerLogFiles) {
66559
- const filePath = upath_1.default.join(foundDiagDir, logFile);
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`);
66565
- return [logFile];
66412
+ if (orchestrationId) {
66413
+ for (const logFile of sortedNewestFirst) {
66414
+ const filePath = upath_1.default.join(foundDiagDir, logFile);
66415
+ const content = fs_1$2.default.readFileSync(filePath, "utf-8");
66416
+ if (content.includes("\"system.orchestrationId\":") && content.includes(`"${orchestrationId}"`)) {
66417
+ context.stdout.write(`Found Worker log via system.orchestrationId for ${orchestrationId}: ${logFile}\n`);
66418
+ return [logFile];
66419
+ }
66566
66420
  }
66421
+ context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} Could not find Worker log via system.orchestrationId for ${orchestrationId}, checking all logs\n`);
66567
66422
  }
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`);
66569
- return workerLogFiles;
66423
+ return sortedNewestFirst;
66570
66424
  };
66571
66425
  const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {
66572
66426
  const logsToCheck = getTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles);
@@ -72453,6 +72307,66 @@ var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
72453
72307
  };
72454
72308
  }));
72455
72309
  //#endregion
72310
+ //#region ../base/dist/helpers/request/datadog-route.js
72311
+ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
72312
+ Object.defineProperty(exports, "__esModule", { value: true });
72313
+ exports.datadogRoute = exports.DATADOG_ROUTE_PATHS = void 0;
72314
+ /**
72315
+ * List of all Datadog API routes used by datadog-ci.
72316
+ *
72317
+ * Only those routes are accepted by {@link datadogRoute}.
72318
+ */
72319
+ exports.DATADOG_ROUTE_PATHS = [
72320
+ "/api/intake/ci/custom_spans",
72321
+ "/api/ui/support/serverless/flare",
72322
+ "/api/unstable/deployments/gates/evaluation",
72323
+ "/api/unstable/deployments/gates/evaluation/:evaluationId",
72324
+ "/api/v1/validate",
72325
+ "/api/v2/ci/deployments/correlate-image",
72326
+ "/api/v2/ci/deployments/correlate",
72327
+ "/api/v2/ci/pipeline/metrics",
72328
+ "/api/v2/ci/pipeline/tags",
72329
+ "/api/v2/cicodescan",
72330
+ "/api/v2/cicovreprt",
72331
+ "/api/v2/ciiac",
72332
+ "/api/v2/cireport",
72333
+ "/api/v2/dora/deployment",
72334
+ "/api/v2/git/repository/packfile",
72335
+ "/api/v2/git/repository/search_commits",
72336
+ "/api/v2/quality-gates/evaluate",
72337
+ "/api/v2/srcmap",
72338
+ "/api/v2/static-analysis-sca/dependencies",
72339
+ "/synthetics/ci/batch/:batchId",
72340
+ "/synthetics/ci/tunnel",
72341
+ "/synthetics/mobile/applications/:applicationId/multipart-presigned-urls",
72342
+ "/synthetics/mobile/applications/:applicationId/multipart-upload-complete",
72343
+ "/synthetics/mobile/applications/validation-job-status/:jobId",
72344
+ "/synthetics/settings",
72345
+ "/synthetics/tests/:testId",
72346
+ "/synthetics/tests/:testId/version_history/:version?only_check_existence=true",
72347
+ "/synthetics/tests/:testType/:testId",
72348
+ "/synthetics/tests/poll_results",
72349
+ "/synthetics/tests/search",
72350
+ "/synthetics/tests/trigger/ci",
72351
+ "/v1/input"
72352
+ ];
72353
+ /**
72354
+ * Format a Datadog API route with optional parameters.
72355
+ *
72356
+ * @example
72357
+ * ```ts
72358
+ * const route = datadogRoute('/api/v2/resources/:resourceId', {
72359
+ * resourceId: '123',
72360
+ * })
72361
+ * ```
72362
+ */
72363
+ const datadogRoute = (route, ...[params]) => {
72364
+ if (!params) return route;
72365
+ return route.replace(/:([A-Za-z0-9_]+)/g, (_, key) => encodeURIComponent(String(params[key])));
72366
+ };
72367
+ exports.datadogRoute = datadogRoute;
72368
+ }));
72369
+ //#endregion
72456
72370
  //#region ../../node_modules/delayed-stream/lib/delayed_stream.js
72457
72371
  var require_delayed_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
72458
72372
  var Stream$2 = require("stream").Stream;
@@ -81191,6 +81105,7 @@ var import_glob = require_glob();
81191
81105
  var import_retry = require_retry$1();
81192
81106
  var import_utils = require_utils$1();
81193
81107
  var import_tags = require_tags();
81108
+ var import_datadog_route = require_datadog_route();
81194
81109
  var import_form_data = /* @__PURE__ */ __toESM(require_form_data());
81195
81110
  var import_app = require_app();
81196
81111
  var import_source = /* @__PURE__ */ __toESM(require_source());
@@ -81278,7 +81193,7 @@ const uploadSarifReport = (request) => async (sarifReport, write) => {
81278
81193
  data: form,
81279
81194
  headers: form.getHeaders(),
81280
81195
  method: "POST",
81281
- url: "api/v2/cicodescan"
81196
+ url: (0, import_datadog_route.datadogRoute)("/api/v2/cicodescan")
81282
81197
  });
81283
81198
  };
81284
81199
  const apiConstructor = (baseIntakeUrl, apiKey) => {
@@ -150,19 +150,6 @@ ajv-formats/LICENSE:
150
150
  * SOFTWARE.
151
151
  */
152
152
 
153
- ansi-escapes/license:
154
- /*
155
- * MIT License
156
- *
157
- * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
158
- *
159
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
160
- *
161
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
162
- *
163
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
164
- */
165
-
166
153
  ansi-styles/license:
167
154
  /*
168
155
  * MIT License
@@ -1501,32 +1488,6 @@ supports-color/license:
1501
1488
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1502
1489
  */
1503
1490
 
1504
- supports-hyperlinks/license:
1505
- /*
1506
- * MIT License
1507
- *
1508
- * Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
1509
- *
1510
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1511
- *
1512
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1513
- *
1514
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1515
- */
1516
-
1517
- terminal-link/license:
1518
- /*
1519
- * MIT License
1520
- *
1521
- * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1522
- *
1523
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1524
- *
1525
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1526
- *
1527
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1528
- */
1529
-
1530
1491
  tiny-async-pool/package.json:
1531
1492
  /*
1532
1493
  * License: MIT