This is an automated email from the ASF dual-hosted git repository. msciabarra pushed a commit to branch image-build in repository https://gitbox.apache.org/repos/asf/openserverless-task.git
commit 40b9d757b33aba4b7969e3465a583f468681c99e Author: Michele Sciabarra <msciaba...@apache.org> AuthorDate: Thu Jul 31 11:54:12 2025 +0000 image builder --- ide/python/findimg.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ide/python/findimg.js b/ide/python/findimg.js new file mode 100644 index 0000000..1611d70 --- /dev/null +++ b/ide/python/findimg.js @@ -0,0 +1,40 @@ +import { readFile } from "fs/promises"; + +async function main() { + const [,, runtimeInput, jsonPath] = process.argv; + + if (!runtimeInput || !jsonPath) { + console.error("Usage: bun find.js <runtime[:version|default]> <runtimes.json>"); + process.exit(1); + } + + const [language, kindOrDefault] = runtimeInput.split(":"); + + const content = await readFile(jsonPath, "utf-8"); + const data = JSON.parse(content); + + const runtimes = data.runtimes?.[language]; + + if (!runtimes) { + console.error(`Runtime family "${language}" not found.`); + process.exit(1); + } + + let runtime; + + if (!kindOrDefault || kindOrDefault === "default") { + runtime = runtimes.find(r => r.default); + } else { + runtime = runtimes.find(r => r.kind === `${language}:${kindOrDefault}`); + } + + if (!runtime || !runtime.image) { + console.error(`Runtime for "${runtimeInput}" not found or has no image info.`); + process.exit(1); + } + + const { prefix, name, tag } = runtime.image; + console.log(`${prefix}/${name}:${tag}|${language}_${tag}`); +} + +main();