This commit is contained in:
Graham Christensen 2024-09-05 16:23:05 -04:00
parent 08888a1feb
commit b9a3650a02
2 changed files with 13 additions and 13 deletions

20
dist/index.js generated vendored
View file

@ -90887,7 +90887,7 @@ const external_node_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequ
var cache = __nccwpck_require__(6878); var cache = __nccwpck_require__(6878);
;// CONCATENATED MODULE: external "node:child_process" ;// CONCATENATED MODULE: external "node:child_process"
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: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@2e8b52ef6f516caef4c88593cd71aee68fc5e4ae_xjnerncbz5oexhjk6ww5y6g6n4/node_modules/detsys-ts/dist/index.js ;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@569dbd7c2ae47f6506e3436cfd72d744af40ad9c_t2bjxwoge7chrgxuvjsev567yu/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)
@ -91748,7 +91748,7 @@ async function verifyEtag(filename, quotedExpectedEtag) {
core.info( core.info(
`Verifying etag failed: etag did not parse: ${expectedEtag}` `Verifying etag failed: etag did not parse: ${expectedEtag}`
); );
return "corrupt"; return "corrupt" /* Corrupt */;
} }
const fd = await (0,promises_namespaceObject.open)(filename, "r"); const fd = await (0,promises_namespaceObject.open)(filename, "r");
let actualEtag; let actualEtag;
@ -91761,16 +91761,16 @@ async function verifyEtag(filename, quotedExpectedEtag) {
} }
await fd.close(); await fd.close();
if (expectedEtag === actualEtag) { if (expectedEtag === actualEtag) {
return "valid"; return "valid" /* Valid */;
} else { } else {
core.info( core.info(
`Verifying etag failed: etag mismatch. Wanted ${expectedEtag}, got ${actualEtag}` `Verifying etag failed: etag mismatch. Wanted ${expectedEtag}, got ${actualEtag}`
); );
return "corrupt"; return "corrupt" /* Corrupt */;
} }
} catch (e) { } catch (e) {
core.debug(`Verifying etag failed: ${stringifyError(e)}`); core.debug(`Verifying etag failed: ${stringifyError(e)}`);
return "corrupt"; return "corrupt" /* Corrupt */;
} }
} }
async function calculateMd5Etag(fd) { async function calculateMd5Etag(fd) {
@ -92232,7 +92232,7 @@ var DetSysAction = class {
JSON.stringify(this.identity) JSON.stringify(this.identity)
); );
const versionCheckup = await (await this.getClient()).head(correlatedUrl); const versionCheckup = await (await this.getClient()).head(correlatedUrl);
if (versionCheckup.headers.etag) { if ((versionCheckup.headers.server ?? "") === "AmazonS3" && versionCheckup.headers.etag) {
const v = versionCheckup.headers.etag; const v = versionCheckup.headers.etag;
this.addFact(FACT_SOURCE_URL_ETAG, v); this.addFact(FACT_SOURCE_URL_ETAG, v);
core.debug( core.debug(
@ -92254,7 +92254,7 @@ var DetSysAction = class {
new URL(versionCheckup.url), new URL(versionCheckup.url),
destFile destFile
); );
if (fetchStream.response?.headers.etag) { if ((fetchStream.response?.headers.server ?? "") === "AmazonS3" && fetchStream.response?.headers.etag) {
const v = fetchStream.response.headers.etag; const v = fetchStream.response.headers.etag;
try { try {
await this.saveCachedVersion(v, destFile); await this.saveCachedVersion(v, destFile);
@ -92309,9 +92309,9 @@ var DetSysAction = class {
retry(client.stream(url)); retry(client.stream(url));
}); });
const fetchStream = await downloadPromise; const fetchStream = await downloadPromise;
if (fetchStream.response?.headers.etag) { if ((fetchStream.response?.headers.server ?? "") === "AmazonS3" && fetchStream.response?.headers.etag) {
const etag = fetchStream.response.headers.etag; const etag = fetchStream.response.headers.etag;
if (await verifyEtag(destination, etag) !== "valid") { if (await verifyEtag(destination, etag) === "corrupt" /* Corrupt */) {
throw new Error("download failed: etag mismatch"); throw new Error("download failed: etag mismatch");
} }
} }
@ -92372,7 +92372,7 @@ var DetSysAction = class {
true true
)) { )) {
const filename = `${tempDir}/${this.actionOptions.name}`; const filename = `${tempDir}/${this.actionOptions.name}`;
if (await verifyEtag(filename, etag) === "valid") { if (await verifyEtag(filename, etag) === "valid" /* Valid */) {
this.recordEvent(EVENT_ARTIFACT_CACHE_HIT); this.recordEvent(EVENT_ARTIFACT_CACHE_HIT);
return `${tempDir}/${this.actionOptions.name}`; return `${tempDir}/${this.actionOptions.name}`;
} else { } else {

View file

@ -16,7 +16,7 @@ dependencies:
version: 5.1.1 version: 5.1.1
detsys-ts: detsys-ts:
specifier: github:DeterminateSystems/detsys-ts#verify-etag specifier: github:DeterminateSystems/detsys-ts#verify-etag
version: github.com/DeterminateSystems/detsys-ts/2e8b52ef6f516caef4c88593cd71aee68fc5e4ae version: github.com/DeterminateSystems/detsys-ts/569dbd7c2ae47f6506e3436cfd72d744af40ad9c
got: got:
specifier: ^14.3.0 specifier: ^14.3.0
version: 14.3.0 version: 14.3.0
@ -5753,10 +5753,10 @@ packages:
engines: { node: ">=10" } engines: { node: ">=10" }
dev: true dev: true
github.com/DeterminateSystems/detsys-ts/2e8b52ef6f516caef4c88593cd71aee68fc5e4ae: github.com/DeterminateSystems/detsys-ts/569dbd7c2ae47f6506e3436cfd72d744af40ad9c:
resolution: resolution:
{ {
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/2e8b52ef6f516caef4c88593cd71aee68fc5e4ae, tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/569dbd7c2ae47f6506e3436cfd72d744af40ad9c,
} }
name: detsys-ts name: detsys-ts
version: 1.0.0 version: 1.0.0