[#69] Remediate incorrect image tagging by CI

This commit is contained in:
Radon Rosborough 2021-07-17 08:25:19 +00:00
parent 0705e351d2
commit 0cf0d1bc83
1 changed files with 17 additions and 8 deletions

View File

@ -4,23 +4,32 @@ import url from "url";
import { Command } from "commander"; import { Command } from "commander";
import { getLangs } from "../lib/yaml.js"; import { getLangs } from "../lib/yaml.js";
import { getLocalImageLabel } from "./docker-util.js"; import { getDockerRepo, getRemoteImageLabel } from "./docker-util.js";
// Get the contents of the JSON file that will be written to S3 in // Get the contents of the JSON file that will be written to S3 in
// order to deploy Riju. // order to deploy Riju.
async function getDeployConfig() { async function getDeployConfig() {
const DOCKER_REPO = getDockerRepo();
const langs = await getLangs(); const langs = await getLangs();
const langImageTags = Object.fromEntries( const langImageTags = Object.fromEntries(
await Promise.all( await Promise.all(
langs.map(async (lang) => [ langs.map(async (lang) => {
lang, const hash = await getRemoteImageLabel(
`lang-${lang}-` + `${DOCKER_REPO}:lang-${lang}`,
(await getLocalImageLabel(`riju:lang-${lang}`, "riju.image-hash")), "riju.image-hash"
]) );
if (!hash) {
throw new Error(`image is not published to ${DOCKER_REPO}: riju:lang-${lang}`);
}
return [lang, `lang-${lang}-` + hash];
})
) )
); );
const appImageTag = const hash = await getRemoteImageLabel(`${DOCKER_REPO}:app`, "riju.image-hash");
`app-` + (await getLocalImageLabel(`riju:app`, "riju.image-hash")); if (!hash) {
throw new Error(`image is not published to ${DOCKER_REPO}: riju:app`);
}
const appImageTag = `app-` + hash;
return { return {
appImageTag, appImageTag,
langImageTags, langImageTags,