Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update detsys-ts: Merge pull request #62 from DeterminateSystems/dont-pull-microstackshots #44

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 47 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86722,7 +86722,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
/* harmony export */ "O": () => (/* binding */ getRollingMinor)
/* harmony export */ });
/* harmony import */ var detsys_ts__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(6295);
/* harmony import */ var detsys_ts__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(8320);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(9093);
/* harmony import */ var _actions_github__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5942);
// src/index.ts
Expand Down Expand Up @@ -86801,7 +86801,7 @@ __webpack_async_result__();

/***/ }),

/***/ 6295:
/***/ 8320:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {


Expand Down Expand Up @@ -86841,7 +86841,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
;// CONCATENATED MODULE: external "node:stream/promises"
const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream/promises");
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@e8f6e8f54d85aa0fd3d0b694dd3279a21497a33b_my6t2hapzhbardj4d5wtrx4lzm/node_modules/detsys-ts/dist/index.js
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@817e4d4123b6fb4eae5aa557658f25f8539e7240_cyq6j27kjpra3jtdpg5422ffka/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
Expand Down Expand Up @@ -87071,16 +87071,16 @@ function stringifyError(e) {



async function collectBacktraces(prefixes) {
async function collectBacktraces(prefixes, startTimestampMs) {
if (isMacOS) {
return await collectBacktracesMacOS(prefixes);
return await collectBacktracesMacOS(prefixes, startTimestampMs);
}
if (isLinux) {
return await collectBacktracesSystemd(prefixes);
return await collectBacktracesSystemd(prefixes, startTimestampMs);
}
return /* @__PURE__ */ new Map();
}
async function collectBacktracesMacOS(prefixes) {
async function collectBacktracesMacOS(prefixes, startTimestampMs) {
const backtraces = /* @__PURE__ */ new Map();
try {
const { stdout: logJson } = await exec2.getExecOutput(
Expand Down Expand Up @@ -87122,16 +87122,20 @@ async function collectBacktracesMacOS(prefixes) {
for (const [source, dir] of dirs) {
const fileNames = (await readdir(dir)).filter((fileName) => {
return prefixes.some((prefix) => fileName.startsWith(prefix));
}).filter((fileName) => {
return !fileName.endsWith(".diag");
});
const doGzip = promisify2(gzip);
for (const fileName of fileNames) {
try {
const logText = await readFile2(`${dir}/${fileName}`);
const buf = await doGzip(logText);
backtraces.set(
`backtrace_value_${source}_${fileName}`,
buf.toString("base64")
);
if ((await stat(`${dir}/${fileName}`)).ctimeMs >= startTimestampMs) {
const logText = await readFile2(`${dir}/${fileName}`);
const buf = await doGzip(logText);
backtraces.set(
`backtrace_value_${source}_${fileName}`,
buf.toString("base64")
);
}
} catch (innerError) {
backtraces.set(
`backtrace_failure_${source}_${fileName}`,
Expand All @@ -87142,13 +87146,14 @@ async function collectBacktracesMacOS(prefixes) {
}
return backtraces;
}
async function collectBacktracesSystemd(prefixes) {
async function collectBacktracesSystemd(prefixes, startTimestampMs) {
const sinceSeconds = Math.ceil((Date.now() - startTimestampMs) / 1e3);
const backtraces = /* @__PURE__ */ new Map();
const coredumps = [];
try {
const { stdout: coredumpjson } = await exec2.getExecOutput(
"coredumpctl",
["--json=pretty", "list", "--since", "1 hour ago"],
["--json=pretty", "list", "--since", `${sinceSeconds} seconds ago`],
{
silent: true
}
Expand Down Expand Up @@ -87719,6 +87724,8 @@ var FACT_NIX_STORE_CHECK_ERROR = "nix_store_check_error";
var STATE_KEY_EXECUTION_PHASE = "detsys_action_execution_phase";
var STATE_KEY_NIX_NOT_FOUND = "detsys_action_nix_not_found";
var STATE_NOT_FOUND = "not-found";
var STATE_KEY_CROSS_PHASE_ID = "detsys_cross_phase_id";
var STATE_BACKTRACE_START_TIMESTAMP = "detsys_backtrace_start_timestamp";
var DIAGNOSTIC_ENDPOINT_TIMEOUT_MS = 3e4;
var CHECK_IN_ENDPOINT_TIMEOUT_MS = 5e3;
var DetSysAction = class {
Expand Down Expand Up @@ -87746,6 +87753,8 @@ var DetSysAction = class {
this.features = {};
this.featureEventMetadata = {};
this.events = [];
this.getCrossPhaseId();
this.collectBacktraceSetup();
this.facts = {
$lib: "idslib",
$lib_version: version,
Expand Down Expand Up @@ -87835,6 +87844,15 @@ var DetSysAction = class {
getUniqueId() {
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || randomUUID();
}
// This ID will be saved in the action's state, to be persisted across phase steps
getCrossPhaseId() {
let crossPhaseId = actionsCore8.getState(STATE_KEY_CROSS_PHASE_ID);
if (crossPhaseId === "") {
crossPhaseId = randomUUID();
actionsCore8.saveState(STATE_KEY_CROSS_PHASE_ID, crossPhaseId);
}
return crossPhaseId;
}
getCorrelationHashes() {
return this.identity;
}
Expand Down Expand Up @@ -88188,10 +88206,23 @@ var DetSysAction = class {
process.chdir(startCwd);
}
}
collectBacktraceSetup() {
if (process.env.DETSYS_BACKTRACE_COLLECTOR === "") {
actionsCore8.exportVariable(
"DETSYS_BACKTRACE_COLLECTOR",
this.getCrossPhaseId()
);
actionsCore8.saveState(STATE_BACKTRACE_START_TIMESTAMP, Date.now());
}
}
async collectBacktraces() {
try {
if (process.env.DETSYS_BACKTRACE_COLLECTOR !== this.getCrossPhaseId()) {
return;
}
const backtraces = await collectBacktraces(
this.actionOptions.binaryNamePrefixes
this.actionOptions.binaryNamePrefixes,
parseInt(actionsCore8.getState(STATE_BACKTRACE_START_TIMESTAMP))
);
actionsCore8.debug(`Backtraces identified: ${backtraces.size}`);
if (backtraces.size > 0) {
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading