Update detsys-ts for: Merge pull request #62 from DeterminateSystems/dont-pull-microstackshots (817e4d4123b6fb4eae5aa557658f25f8539e7240) (#118)

Co-authored-by: grahamc <76716+grahamc@users.noreply.github.com>
This commit is contained in:
detsys-pr-bot 2024-08-26 08:49:32 -07:00 committed by GitHub
parent 197bf2b2a5
commit 1406b8b52c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 17 deletions

59
dist/index.js generated vendored
View file

@ -96405,7 +96405,7 @@ var cache = __nccwpck_require__(6878);
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process"); const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
;// CONCATENATED MODULE: external "node:stream/promises" ;// CONCATENATED MODULE: external "node:stream/promises"
const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("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 __defProp = Object.defineProperty;
var __export = (target, all) => { var __export = (target, all) => {
for (var name in all) for (var name in all)
@ -96635,16 +96635,16 @@ function stringifyError(e) {
async function collectBacktraces(prefixes) { async function collectBacktraces(prefixes, startTimestampMs) {
if (isMacOS) { if (isMacOS) {
return await collectBacktracesMacOS(prefixes); return await collectBacktracesMacOS(prefixes, startTimestampMs);
} }
if (isLinux) { if (isLinux) {
return await collectBacktracesSystemd(prefixes); return await collectBacktracesSystemd(prefixes, startTimestampMs);
} }
return /* @__PURE__ */ new Map(); return /* @__PURE__ */ new Map();
} }
async function collectBacktracesMacOS(prefixes) { async function collectBacktracesMacOS(prefixes, startTimestampMs) {
const backtraces = /* @__PURE__ */ new Map(); const backtraces = /* @__PURE__ */ new Map();
try { try {
const { stdout: logJson } = await exec.getExecOutput( const { stdout: logJson } = await exec.getExecOutput(
@ -96686,16 +96686,20 @@ async function collectBacktracesMacOS(prefixes) {
for (const [source, dir] of dirs) { for (const [source, dir] of dirs) {
const fileNames = (await (0,promises_namespaceObject.readdir)(dir)).filter((fileName) => { const fileNames = (await (0,promises_namespaceObject.readdir)(dir)).filter((fileName) => {
return prefixes.some((prefix) => fileName.startsWith(prefix)); return prefixes.some((prefix) => fileName.startsWith(prefix));
}).filter((fileName) => {
return !fileName.endsWith(".diag");
}); });
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_namespaceObject.gzip); const doGzip = (0,external_node_util_.promisify)(external_node_zlib_namespaceObject.gzip);
for (const fileName of fileNames) { for (const fileName of fileNames) {
try { try {
const logText = await (0,promises_namespaceObject.readFile)(`${dir}/${fileName}`); if ((await (0,promises_namespaceObject.stat)(`${dir}/${fileName}`)).ctimeMs >= startTimestampMs) {
const buf = await doGzip(logText); const logText = await (0,promises_namespaceObject.readFile)(`${dir}/${fileName}`);
backtraces.set( const buf = await doGzip(logText);
`backtrace_value_${source}_${fileName}`, backtraces.set(
buf.toString("base64") `backtrace_value_${source}_${fileName}`,
); buf.toString("base64")
);
}
} catch (innerError) { } catch (innerError) {
backtraces.set( backtraces.set(
`backtrace_failure_${source}_${fileName}`, `backtrace_failure_${source}_${fileName}`,
@ -96706,13 +96710,14 @@ async function collectBacktracesMacOS(prefixes) {
} }
return backtraces; 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 backtraces = /* @__PURE__ */ new Map();
const coredumps = []; const coredumps = [];
try { try {
const { stdout: coredumpjson } = await exec.getExecOutput( const { stdout: coredumpjson } = await exec.getExecOutput(
"coredumpctl", "coredumpctl",
["--json=pretty", "list", "--since", "1 hour ago"], ["--json=pretty", "list", "--since", `${sinceSeconds} seconds ago`],
{ {
silent: true silent: true
} }
@ -97283,6 +97288,8 @@ var FACT_NIX_STORE_CHECK_ERROR = "nix_store_check_error";
var STATE_KEY_EXECUTION_PHASE = "detsys_action_execution_phase"; var STATE_KEY_EXECUTION_PHASE = "detsys_action_execution_phase";
var STATE_KEY_NIX_NOT_FOUND = "detsys_action_nix_not_found"; var STATE_KEY_NIX_NOT_FOUND = "detsys_action_nix_not_found";
var STATE_NOT_FOUND = "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 DIAGNOSTIC_ENDPOINT_TIMEOUT_MS = 3e4;
var CHECK_IN_ENDPOINT_TIMEOUT_MS = 5e3; var CHECK_IN_ENDPOINT_TIMEOUT_MS = 5e3;
var DetSysAction = class { var DetSysAction = class {
@ -97310,6 +97317,8 @@ var DetSysAction = class {
this.features = {}; this.features = {};
this.featureEventMetadata = {}; this.featureEventMetadata = {};
this.events = []; this.events = [];
this.getCrossPhaseId();
this.collectBacktraceSetup();
this.facts = { this.facts = {
$lib: "idslib", $lib: "idslib",
$lib_version: version, $lib_version: version,
@ -97399,6 +97408,15 @@ var DetSysAction = class {
getUniqueId() { getUniqueId() {
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_namespaceObject.randomUUID)(); return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_namespaceObject.randomUUID)();
} }
// This ID will be saved in the action's state, to be persisted across phase steps
getCrossPhaseId() {
let crossPhaseId = core.getState(STATE_KEY_CROSS_PHASE_ID);
if (crossPhaseId === "") {
crossPhaseId = (0,external_node_crypto_namespaceObject.randomUUID)();
core.saveState(STATE_KEY_CROSS_PHASE_ID, crossPhaseId);
}
return crossPhaseId;
}
getCorrelationHashes() { getCorrelationHashes() {
return this.identity; return this.identity;
} }
@ -97752,10 +97770,23 @@ var DetSysAction = class {
process.chdir(startCwd); process.chdir(startCwd);
} }
} }
collectBacktraceSetup() {
if (process.env.DETSYS_BACKTRACE_COLLECTOR === "") {
core.exportVariable(
"DETSYS_BACKTRACE_COLLECTOR",
this.getCrossPhaseId()
);
core.saveState(STATE_BACKTRACE_START_TIMESTAMP, Date.now());
}
}
async collectBacktraces() { async collectBacktraces() {
try { try {
if (process.env.DETSYS_BACKTRACE_COLLECTOR !== this.getCrossPhaseId()) {
return;
}
const backtraces = await collectBacktraces( const backtraces = await collectBacktraces(
this.actionOptions.binaryNamePrefixes this.actionOptions.binaryNamePrefixes,
parseInt(core.getState(STATE_BACKTRACE_START_TIMESTAMP))
); );
core.debug(`Backtraces identified: ${backtraces.size}`); core.debug(`Backtraces identified: ${backtraces.size}`);
if (backtraces.size > 0) { if (backtraces.size > 0) {

View file

@ -16,7 +16,7 @@ dependencies:
version: 5.1.1 version: 5.1.1
detsys-ts: detsys-ts:
specifier: github:DeterminateSystems/detsys-ts specifier: github:DeterminateSystems/detsys-ts
version: github.com/DeterminateSystems/detsys-ts/e8f6e8f54d85aa0fd3d0b694dd3279a21497a33b version: github.com/DeterminateSystems/detsys-ts/817e4d4123b6fb4eae5aa557658f25f8539e7240
got: got:
specifier: ^14.3.0 specifier: ^14.3.0
version: 14.3.0 version: 14.3.0
@ -5685,10 +5685,10 @@ packages:
engines: { node: ">=10" } engines: { node: ">=10" }
dev: true dev: true
github.com/DeterminateSystems/detsys-ts/e8f6e8f54d85aa0fd3d0b694dd3279a21497a33b: github.com/DeterminateSystems/detsys-ts/817e4d4123b6fb4eae5aa557658f25f8539e7240:
resolution: resolution:
{ {
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/e8f6e8f54d85aa0fd3d0b694dd3279a21497a33b, tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/817e4d4123b6fb4eae5aa557658f25f8539e7240,
} }
name: detsys-ts name: detsys-ts
version: 1.0.0 version: 1.0.0