Fix subtle hash calculation bugs

This commit is contained in:
Radon Rosborough 2020-12-31 23:07:00 -08:00
parent b4c5cf2763
commit 9860f8f07c
1 changed files with 16 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import http from "http";
import express from "express"; import express from "express";
import { getLangs, getPackages } from "./config.js"; import { getLangs, getPackages } from "./config.js";
import { getLocalImageDigest } from "./docker-util.js"; import { getLocalImageLabel } from "./docker-util.js";
import { hashDockerfile } from "./hash-dockerfile.js"; import { hashDockerfile } from "./hash-dockerfile.js";
import { runCommand } from "./util.js"; import { runCommand } from "./util.js";
@ -25,19 +25,24 @@ async function main() {
const hash = await hashDockerfile( const hash = await hashDockerfile(
"composite", "composite",
{ {
"riju:runtime": await getLocalImageDigest("riju:runtime"), "riju:runtime": await getLocalImageLabel(
"riju:runtime",
"riju.image-hash"
),
}, },
{ {
salt: { salt: {
packageHashes: await Promise.all( packageHashes: (
(await getPackages()).map(async ({ debPath }) => { await Promise.all(
return ( (await getPackages()).map(async ({ debPath }) => {
await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, { return (
getStdout: true, await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, {
}) getStdout: true,
).stdout.trim(); })
}) ).stdout.trim();
), })
)
).sort(),
}, },
} }
); );