@datadog/datadog-ci-plugin-synthetics 5.20.0 → 5.21.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 +146 -23
- package/dist/bundle.js.map +1 -1
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -5761,7 +5761,7 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5761
5761
|
var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5762
5762
|
module.exports = {
|
|
5763
5763
|
"name": "@datadog/datadog-ci-base",
|
|
5764
|
-
"version": "5.
|
|
5764
|
+
"version": "5.21.0",
|
|
5765
5765
|
"description": "Base package for Datadog CI",
|
|
5766
5766
|
"license": "Apache-2.0",
|
|
5767
5767
|
"keywords": ["datadog", "datadog-ci"],
|
|
@@ -5889,13 +5889,14 @@ var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5889
5889
|
//#region ../base/dist/constants.js
|
|
5890
5890
|
var require_constants$12 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5891
5891
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5892
|
-
exports.METHOD_POST = exports.CONTENT_TYPE_VALUE_JSON = exports.CONTENT_TYPE_VALUE_PROTOBUF = exports.CONTENT_TYPE_HEADER = exports.SKIP_VERSION_BANNER_ENV_VAR = exports.LOG_FORMAT_ENV_VAR = exports.FIPS_IGNORE_ERROR_ENV_VAR = exports.FIPS_ENV_VAR = exports.DATADOG_SITES = exports.DATADOG_SITE_US2_GOV = exports.DATADOG_SITE_GOV = exports.DATADOG_SITE_AP2 = exports.DATADOG_SITE_AP1 = exports.DATADOG_SITE_US5 = exports.DATADOG_SITE_US3 = exports.DATADOG_SITE_EU1 = exports.DATADOG_SITE_US1 = void 0;
|
|
5892
|
+
exports.METHOD_POST = exports.CONTENT_TYPE_VALUE_JSON = exports.CONTENT_TYPE_VALUE_PROTOBUF = exports.CONTENT_TYPE_HEADER = exports.SKIP_VERSION_BANNER_ENV_VAR = exports.LOG_FORMAT_ENV_VAR = exports.FIPS_IGNORE_ERROR_ENV_VAR = exports.FIPS_ENV_VAR = exports.DATADOG_SITES = exports.DATADOG_SITE_US2_GOV = exports.DATADOG_SITE_GOV = exports.DATADOG_SITE_UK1 = exports.DATADOG_SITE_AP2 = exports.DATADOG_SITE_AP1 = exports.DATADOG_SITE_US5 = exports.DATADOG_SITE_US3 = exports.DATADOG_SITE_EU1 = exports.DATADOG_SITE_US1 = void 0;
|
|
5893
5893
|
exports.DATADOG_SITE_US1 = "datadoghq.com";
|
|
5894
5894
|
exports.DATADOG_SITE_EU1 = "datadoghq.eu";
|
|
5895
5895
|
exports.DATADOG_SITE_US3 = "us3.datadoghq.com";
|
|
5896
5896
|
exports.DATADOG_SITE_US5 = "us5.datadoghq.com";
|
|
5897
5897
|
exports.DATADOG_SITE_AP1 = "ap1.datadoghq.com";
|
|
5898
5898
|
exports.DATADOG_SITE_AP2 = "ap2.datadoghq.com";
|
|
5899
|
+
exports.DATADOG_SITE_UK1 = "uk1.datadoghq.com";
|
|
5899
5900
|
exports.DATADOG_SITE_GOV = "ddog-gov.com";
|
|
5900
5901
|
exports.DATADOG_SITE_US2_GOV = "us2.ddog-gov.com";
|
|
5901
5902
|
exports.DATADOG_SITES = [
|
|
@@ -5905,6 +5906,7 @@ var require_constants$12 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5905
5906
|
exports.DATADOG_SITE_US5,
|
|
5906
5907
|
exports.DATADOG_SITE_AP1,
|
|
5907
5908
|
exports.DATADOG_SITE_AP2,
|
|
5909
|
+
exports.DATADOG_SITE_UK1,
|
|
5908
5910
|
exports.DATADOG_SITE_GOV,
|
|
5909
5911
|
exports.DATADOG_SITE_US2_GOV
|
|
5910
5912
|
];
|
|
@@ -64723,11 +64725,38 @@ var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
64723
64725
|
//#endregion
|
|
64724
64726
|
//#region ../base/dist/helpers/ci.js
|
|
64725
64727
|
var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
64728
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
64729
|
+
function adopt(value) {
|
|
64730
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
64731
|
+
resolve(value);
|
|
64732
|
+
});
|
|
64733
|
+
}
|
|
64734
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
64735
|
+
function fulfilled(value) {
|
|
64736
|
+
try {
|
|
64737
|
+
step(generator.next(value));
|
|
64738
|
+
} catch (e) {
|
|
64739
|
+
reject(e);
|
|
64740
|
+
}
|
|
64741
|
+
}
|
|
64742
|
+
function rejected(value) {
|
|
64743
|
+
try {
|
|
64744
|
+
step(generator["throw"](value));
|
|
64745
|
+
} catch (e) {
|
|
64746
|
+
reject(e);
|
|
64747
|
+
}
|
|
64748
|
+
}
|
|
64749
|
+
function step(result) {
|
|
64750
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
64751
|
+
}
|
|
64752
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64753
|
+
});
|
|
64754
|
+
};
|
|
64726
64755
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
64727
64756
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
64728
64757
|
};
|
|
64729
64758
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64730
|
-
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;
|
|
64759
|
+
exports.getGithubJobIDFromLogs = exports.getGithubStepInfoFromLogs = exports.processLevels = exports.enrichCIEnvFromGithubLogs = exports.getGithubJobNameFromLogs = exports.createGithubLogCache = 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.parseLevels = exports.validateLevel = exports.LEVEL_TO_NUMBER = exports.VALID_LEVELS = exports.CI_LEVELS = exports.envDDGithubStepIndex = exports.envDDGithubJobName = exports.CI_ENGINES = void 0;
|
|
64731
64760
|
const fs_1$2 = __importDefault(require("fs"));
|
|
64732
64761
|
const chalk_1 = __importDefault(require_source$3());
|
|
64733
64762
|
const upath_1 = __importDefault(require_upath());
|
|
@@ -64785,6 +64814,26 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
64785
64814
|
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}]`;
|
|
64786
64815
|
};
|
|
64787
64816
|
exports.validateLevel = validateLevel;
|
|
64817
|
+
/**
|
|
64818
|
+
* Parses an additive, comma-separated `--level` value (e.g. "pipeline,stage").
|
|
64819
|
+
* Trims each member, drops empties, dedupes, sorts by span depth, and validates
|
|
64820
|
+
* every member (known value + provider support). Returns the parsed levels or,
|
|
64821
|
+
* if anything is invalid or empty, a single aggregated error message.
|
|
64822
|
+
*/
|
|
64823
|
+
const parseLevels = (input) => {
|
|
64824
|
+
const unique = uniq((input !== null && input !== void 0 ? input : "").split(",").map((p) => p.trim()).filter((p) => p.length > 0));
|
|
64825
|
+
if (unique.length === 0) return {
|
|
64826
|
+
levels: [],
|
|
64827
|
+
error: `Level must be one of [${exports.VALID_LEVELS.join(", ")}]`
|
|
64828
|
+
};
|
|
64829
|
+
const errors = uniq(unique.map((p) => (0, exports.validateLevel)(p)).filter((e) => Boolean(e)));
|
|
64830
|
+
if (errors.length > 0) return {
|
|
64831
|
+
levels: [],
|
|
64832
|
+
error: errors.join("; ")
|
|
64833
|
+
};
|
|
64834
|
+
return { levels: unique.sort((a, b) => exports.LEVEL_TO_NUMBER[a] - exports.LEVEL_TO_NUMBER[b]) };
|
|
64835
|
+
};
|
|
64836
|
+
exports.parseLevels = parseLevels;
|
|
64788
64837
|
exports.githubWellKnownDiagnosticDirsUnix = ["/home/runner/actions-runner/_diag", "/opt/actions-runner/_diag"];
|
|
64789
64838
|
exports.githubWellKnownDiagnosticDirsWin = ["C:/actions-runner/_diag"];
|
|
64790
64839
|
exports.githubWellKnownDiagnosticDirPatternsUnix = ["/home/runner/actions-runner/*/_diag", "/home/runner/actions-runner/*/*/_diag"];
|
|
@@ -65102,7 +65151,7 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65102
65151
|
}
|
|
65103
65152
|
}
|
|
65104
65153
|
if (env.BITBUCKET_COMMIT) {
|
|
65105
|
-
const { BITBUCKET_REPO_FULL_NAME, BITBUCKET_BUILD_NUMBER, BITBUCKET_BRANCH, BITBUCKET_COMMIT, BITBUCKET_GIT_SSH_ORIGIN, BITBUCKET_GIT_HTTP_ORIGIN, BITBUCKET_TAG, BITBUCKET_PIPELINE_UUID, BITBUCKET_PR_ID, BITBUCKET_PR_DESTINATION_BRANCH, BITBUCKET_CLONE_DIR } = env;
|
|
65154
|
+
const { BITBUCKET_REPO_FULL_NAME, BITBUCKET_BUILD_NUMBER, BITBUCKET_BRANCH, BITBUCKET_COMMIT, BITBUCKET_GIT_SSH_ORIGIN, BITBUCKET_GIT_HTTP_ORIGIN, BITBUCKET_TAG, BITBUCKET_PIPELINE_UUID, BITBUCKET_PR_ID, BITBUCKET_PR_DESTINATION_BRANCH, BITBUCKET_PR_DESTINATION_COMMIT, BITBUCKET_CLONE_DIR } = env;
|
|
65106
65155
|
const url = `https://bitbucket.org/${BITBUCKET_REPO_FULL_NAME}/addon/pipelines/home#!/results/${BITBUCKET_BUILD_NUMBER}`;
|
|
65107
65156
|
tags = {
|
|
65108
65157
|
[tags_1.CI_PROVIDER_NAME]: exports.CI_ENGINES.BITBUCKET,
|
|
@@ -65120,6 +65169,7 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65120
65169
|
if (BITBUCKET_PR_ID) {
|
|
65121
65170
|
tags[tags_1.PR_NUMBER] = BITBUCKET_PR_ID;
|
|
65122
65171
|
tags[tags_1.GIT_PULL_REQUEST_BASE_BRANCH] = BITBUCKET_PR_DESTINATION_BRANCH;
|
|
65172
|
+
if (BITBUCKET_PR_DESTINATION_COMMIT) tags[tags_1.GIT_PULL_REQUEST_BASE_BRANCH_SHA] = BITBUCKET_PR_DESTINATION_COMMIT;
|
|
65123
65173
|
}
|
|
65124
65174
|
}
|
|
65125
65175
|
if (env.CF_BUILD_ID) {
|
|
@@ -65429,7 +65479,32 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65429
65479
|
return os.toLowerCase() === "windows";
|
|
65430
65480
|
};
|
|
65431
65481
|
exports.isGithubWindowsRunner = isGithubWindowsRunner;
|
|
65432
|
-
const
|
|
65482
|
+
const createGithubLogCache = () => ({
|
|
65483
|
+
workerLogFilesResolved: false,
|
|
65484
|
+
workerLogFiles: void 0,
|
|
65485
|
+
targetLogFilesResolved: false,
|
|
65486
|
+
targetLogFiles: [],
|
|
65487
|
+
fileContents: /* @__PURE__ */ new Map()
|
|
65488
|
+
});
|
|
65489
|
+
exports.createGithubLogCache = createGithubLogCache;
|
|
65490
|
+
/** Reads a diagnostic log file, serving from (and populating) `cache` when provided. */
|
|
65491
|
+
const readLogFile = (filePath, cache) => {
|
|
65492
|
+
const cached = cache === null || cache === void 0 ? void 0 : cache.fileContents.get(filePath);
|
|
65493
|
+
if (cached !== void 0) return cached;
|
|
65494
|
+
const content = fs_1$2.default.readFileSync(filePath, "utf-8");
|
|
65495
|
+
cache === null || cache === void 0 || cache.fileContents.set(filePath, content);
|
|
65496
|
+
return content;
|
|
65497
|
+
};
|
|
65498
|
+
const getGithubWorkerLogFiles = (context, cache) => {
|
|
65499
|
+
if (cache === null || cache === void 0 ? void 0 : cache.workerLogFilesResolved) return cache.workerLogFiles;
|
|
65500
|
+
const result = computeGithubWorkerLogFiles(context);
|
|
65501
|
+
if (cache) {
|
|
65502
|
+
cache.workerLogFilesResolved = true;
|
|
65503
|
+
cache.workerLogFiles = result;
|
|
65504
|
+
}
|
|
65505
|
+
return result;
|
|
65506
|
+
};
|
|
65507
|
+
const computeGithubWorkerLogFiles = (context) => {
|
|
65433
65508
|
let foundDiagDir = "";
|
|
65434
65509
|
let workerLogFiles = [];
|
|
65435
65510
|
let wellKnownDirs = expandDiagnosticDirCandidates([
|
|
@@ -65486,13 +65561,21 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65486
65561
|
* which on a single-job runner is immediate, and on a multi-runner is the current
|
|
65487
65562
|
* job's (most recent) log.
|
|
65488
65563
|
*/
|
|
65489
|
-
const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles) => {
|
|
65564
|
+
const getTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles, cache) => {
|
|
65565
|
+
if (cache === null || cache === void 0 ? void 0 : cache.targetLogFilesResolved) return cache.targetLogFiles;
|
|
65566
|
+
const result = computeTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles, cache);
|
|
65567
|
+
if (cache) {
|
|
65568
|
+
cache.targetLogFilesResolved = true;
|
|
65569
|
+
cache.targetLogFiles = result;
|
|
65570
|
+
}
|
|
65571
|
+
return result;
|
|
65572
|
+
};
|
|
65573
|
+
const computeTargetWorkerLogFiles = (context, foundDiagDir, workerLogFiles, cache) => {
|
|
65490
65574
|
const sortedNewestFirst = [...workerLogFiles].sort().reverse();
|
|
65491
65575
|
const orchestrationId = process.env.ACTIONS_ORCHESTRATION_ID;
|
|
65492
65576
|
if (orchestrationId) {
|
|
65493
65577
|
for (const logFile of sortedNewestFirst) {
|
|
65494
|
-
const
|
|
65495
|
-
const content = fs_1$2.default.readFileSync(filePath, "utf-8");
|
|
65578
|
+
const content = readLogFile(upath_1.default.join(foundDiagDir, logFile), cache);
|
|
65496
65579
|
if (content.includes("\"system.orchestrationId\":") && content.includes(`"${orchestrationId}"`)) {
|
|
65497
65580
|
context.stdout.write(`Found Worker log via system.orchestrationId for ${orchestrationId}: ${logFile}\n`);
|
|
65498
65581
|
return [logFile];
|
|
@@ -65502,11 +65585,10 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65502
65585
|
}
|
|
65503
65586
|
return sortedNewestFirst;
|
|
65504
65587
|
};
|
|
65505
|
-
const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex) => {
|
|
65506
|
-
const logsToCheck = getTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles);
|
|
65588
|
+
const getGithubJobAttributeFromLogFiles = (context, foundDiagDir, workerLogFiles, jobAttributeRegex, cache) => {
|
|
65589
|
+
const logsToCheck = getTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles, cache);
|
|
65507
65590
|
for (const logFile of logsToCheck) {
|
|
65508
|
-
const
|
|
65509
|
-
const match = fs_1$2.default.readFileSync(filePath, "utf-8").match(jobAttributeRegex);
|
|
65591
|
+
const match = readLogFile(upath_1.default.join(foundDiagDir, logFile), cache).match(jobAttributeRegex);
|
|
65510
65592
|
if (match && match[1]) return unescapeJsonString(match[1]);
|
|
65511
65593
|
}
|
|
65512
65594
|
};
|
|
@@ -65526,13 +65608,13 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65526
65608
|
*
|
|
65527
65609
|
* @returns The job display name, or undefined if not found
|
|
65528
65610
|
*/
|
|
65529
|
-
const getGithubJobNameFromLogs = (context) => {
|
|
65611
|
+
const getGithubJobNameFromLogs = (context, cache) => {
|
|
65530
65612
|
if (!(0, exports.shouldGetGithubJobDisplayName)()) return;
|
|
65531
65613
|
context.stdout.write("Determining GitHub job name\n");
|
|
65532
|
-
const result = getGithubWorkerLogFiles(context);
|
|
65614
|
+
const result = getGithubWorkerLogFiles(context, cache);
|
|
65533
65615
|
if (!result) return;
|
|
65534
65616
|
const [foundDiagDir, workerLogFiles] = result;
|
|
65535
|
-
const jobDisplayName = getGithubJobAttributeFromLogFiles(context, foundDiagDir, workerLogFiles, githubJobDisplayNameRegex);
|
|
65617
|
+
const jobDisplayName = getGithubJobAttributeFromLogFiles(context, foundDiagDir, workerLogFiles, githubJobDisplayNameRegex, cache);
|
|
65536
65618
|
if (!jobDisplayName) context.stderr.write(`${chalk_1.default.yellow.bold("[WARNING]")} could not find "jobDisplayName" attribute in GitHub diagnostic logs`);
|
|
65537
65619
|
else {
|
|
65538
65620
|
context.stdout.write(`Successfully extracted job name: ${jobDisplayName}\n`);
|
|
@@ -65546,16 +65628,16 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65546
65628
|
* - job: extracts job display name
|
|
65547
65629
|
* - pipeline/stage: no-op
|
|
65548
65630
|
*/
|
|
65549
|
-
const enrichCIEnvFromGithubLogs = (context, level, ciEnv) => {
|
|
65631
|
+
const enrichCIEnvFromGithubLogs = (context, level, ciEnv, cache) => {
|
|
65550
65632
|
switch (level) {
|
|
65551
65633
|
case exports.CI_LEVELS.STEP: {
|
|
65552
|
-
const stepInfo = (0, exports.getGithubStepInfoFromLogs)(context);
|
|
65634
|
+
const stepInfo = (0, exports.getGithubStepInfoFromLogs)(context, cache);
|
|
65553
65635
|
if (!ciEnv[exports.envDDGithubJobName]) ciEnv[exports.envDDGithubJobName] = stepInfo.jobDisplayName;
|
|
65554
65636
|
ciEnv[exports.envDDGithubStepIndex] = String(stepInfo.stepIndex);
|
|
65555
65637
|
break;
|
|
65556
65638
|
}
|
|
65557
65639
|
case exports.CI_LEVELS.JOB: {
|
|
65558
|
-
const jobName = (0, exports.getGithubJobNameFromLogs)(context);
|
|
65640
|
+
const jobName = (0, exports.getGithubJobNameFromLogs)(context, cache);
|
|
65559
65641
|
if (jobName) ciEnv[exports.envDDGithubJobName] = jobName;
|
|
65560
65642
|
break;
|
|
65561
65643
|
}
|
|
@@ -65564,6 +65646,48 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65564
65646
|
};
|
|
65565
65647
|
exports.enrichCIEnvFromGithubLogs = enrichCIEnvFromGithubLogs;
|
|
65566
65648
|
/**
|
|
65649
|
+
* Sends the same payload to each requested CI level, one request per level.
|
|
65650
|
+
*
|
|
65651
|
+
* Shared by the `tag` and `measure` commands. Each level is enriched on its own
|
|
65652
|
+
* copy of `ciEnv` (so e.g. the step index never leaks into the job request).
|
|
65653
|
+
*
|
|
65654
|
+
* Failure handling mirrors the original single-level behavior:
|
|
65655
|
+
* - A setup/config error — a missing API key, or GitHub diagnostic logs that
|
|
65656
|
+
* cannot be located — is thrown and propagates to the caller's outer catch,
|
|
65657
|
+
* making it fatal regardless of `--no-fail`. The thrown error is annotated
|
|
65658
|
+
* with the failing level so the report says which one broke.
|
|
65659
|
+
* - A request that completes but reports a non-zero status sets the returned
|
|
65660
|
+
* flag and the loop continues; the caller decides whether `--no-fail` turns
|
|
65661
|
+
* it into a success.
|
|
65662
|
+
*
|
|
65663
|
+
* A single `GithubLogCache` lives for the duration of the loop so the GitHub
|
|
65664
|
+
* diagnostic logs are located and read at most once even when several levels
|
|
65665
|
+
* need them (e.g. `--level job,step`).
|
|
65666
|
+
*
|
|
65667
|
+
* Returns `true` if any level reported a non-zero status. Callers own the
|
|
65668
|
+
* `--no-fail`/success messaging and exit code based on this flag.
|
|
65669
|
+
*/
|
|
65670
|
+
const processLevels = (context, levels, ciEnv, sendForLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65671
|
+
const cache = (0, exports.createGithubLogCache)();
|
|
65672
|
+
let anyFailed = false;
|
|
65673
|
+
for (const level of levels) {
|
|
65674
|
+
let exitStatus;
|
|
65675
|
+
try {
|
|
65676
|
+
const levelEnv = Object.assign({}, ciEnv);
|
|
65677
|
+
(0, exports.enrichCIEnvFromGithubLogs)(context, level, levelEnv, cache);
|
|
65678
|
+
exitStatus = yield sendForLevel(levelEnv, exports.LEVEL_TO_NUMBER[level]);
|
|
65679
|
+
} catch (error) {
|
|
65680
|
+
throw new Error(`level '${level}': ${error.message}`);
|
|
65681
|
+
}
|
|
65682
|
+
if (exitStatus !== 0) {
|
|
65683
|
+
anyFailed = true;
|
|
65684
|
+
context.stderr.write(`${chalk_1.default.red.bold("[ERROR]")} failed to send for level '${level}'\n`);
|
|
65685
|
+
}
|
|
65686
|
+
}
|
|
65687
|
+
return anyFailed;
|
|
65688
|
+
});
|
|
65689
|
+
exports.processLevels = processLevels;
|
|
65690
|
+
/**
|
|
65567
65691
|
* Extracts the job display name and step index from GitHub Actions diagnostic logs.
|
|
65568
65692
|
*
|
|
65569
65693
|
* To avoid parsing the full Job message JSON (~26KB), we:
|
|
@@ -65571,18 +65695,17 @@ var require_ci = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
65571
65695
|
* 2. Extract only the `"steps": [...]` array from the Job message via bracket-depth tracking
|
|
65572
65696
|
* 3. Parse just that array and match `contextName` against `GITHUB_ACTION`
|
|
65573
65697
|
*/
|
|
65574
|
-
const getGithubStepInfoFromLogs = (context) => {
|
|
65698
|
+
const getGithubStepInfoFromLogs = (context, cache) => {
|
|
65575
65699
|
if ((0, exports.getCIProvider)() !== exports.CI_ENGINES.GITHUB) throw new Error("Step level is only supported for GitHub Actions");
|
|
65576
65700
|
const githubAction = process.env.GITHUB_ACTION;
|
|
65577
65701
|
if (!githubAction) throw new Error("GITHUB_ACTION environment variable is not set, cannot determine step index");
|
|
65578
65702
|
context.stdout.write("Determining GitHub step info from diagnostic logs\n");
|
|
65579
|
-
const result = getGithubWorkerLogFiles(context);
|
|
65703
|
+
const result = getGithubWorkerLogFiles(context, cache);
|
|
65580
65704
|
if (!result) throw new Error("Could not find GitHub diagnostic log files, cannot determine step index");
|
|
65581
65705
|
const [foundDiagDir, workerLogFiles] = result;
|
|
65582
|
-
const logsToCheck = getTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles);
|
|
65706
|
+
const logsToCheck = getTargetWorkerLogFiles(context, foundDiagDir, workerLogFiles, cache);
|
|
65583
65707
|
for (const logFile of logsToCheck) {
|
|
65584
|
-
const
|
|
65585
|
-
const content = fs_1$2.default.readFileSync(filePath, "utf-8");
|
|
65708
|
+
const content = readLogFile(upath_1.default.join(foundDiagDir, logFile), cache);
|
|
65586
65709
|
const displayNameMatch = content.match(githubJobDisplayNameRegex);
|
|
65587
65710
|
if (!displayNameMatch || !displayNameMatch[1]) continue;
|
|
65588
65711
|
const jobDisplayName = unescapeJsonString(displayNameMatch[1]);
|