From 9860f8f07ce5fe0a5bddd825a26f9dea3c1e3cfb Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Thu, 31 Dec 2020 23:07:00 -0800 Subject: [PATCH] Fix subtle hash calculation bugs --- tools/build-composite-image.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/build-composite-image.js b/tools/build-composite-image.js index 1900217..b1908d2 100644 --- a/tools/build-composite-image.js +++ b/tools/build-composite-image.js @@ -4,7 +4,7 @@ import http from "http"; import express from "express"; 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 { runCommand } from "./util.js"; @@ -25,19 +25,24 @@ async function main() { const hash = await hashDockerfile( "composite", { - "riju:runtime": await getLocalImageDigest("riju:runtime"), + "riju:runtime": await getLocalImageLabel( + "riju:runtime", + "riju.image-hash" + ), }, { salt: { - packageHashes: await Promise.all( - (await getPackages()).map(async ({ debPath }) => { - return ( - await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, { - getStdout: true, - }) - ).stdout.trim(); - }) - ), + packageHashes: ( + await Promise.all( + (await getPackages()).map(async ({ debPath }) => { + return ( + await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, { + getStdout: true, + }) + ).stdout.trim(); + }) + ) + ).sort(), }, } );