alpine sucks sometimes
All checks were successful
Build and deploy / deploy (push) Successful in 1m23s

This commit is contained in:
2025-09-05 00:39:53 +01:00
parent eb23299181
commit 32f53eb27e
3 changed files with 9 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ export const dockerRouter = createTRPCRouter({
const container = containers.find((container) => container.Id === input.id);
if (!container) {
console.error(`Container with id ${input.id} not found`);
throw new TRPCError({
code: "NOT_FOUND",
message: `Container with id ${input.id} not found`,
@@ -27,6 +28,7 @@ export const dockerRouter = createTRPCRouter({
latest: await getLatest(imageData.name, imageData.tag),
};
} catch (ex) {
console.error(ex);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: (ex as Error).message,
@@ -159,9 +161,10 @@ function isSemver(tag: string): boolean {
}
async function getHash(image: string) {
const latestImage = await $`bin/regctl image digest ${image}`.text();
const latestImage = await $`./bin/regctl image digest ${image}`.text();
const hash = latestImage.split(":")?.[1]?.substring(0, 12);
if (!hash) {
console.error(`Hash not found: ${latestImage}`);
throw new Error("Hash not found", {
cause: {
imageDigest: latestImage,
@@ -189,8 +192,8 @@ async function getLatest(image: string, tag?: string): Promise<{ hash: string; t
}
async function getSemverTag(image: string): Promise<{ hash: string; tag?: string }> {
const allTags = await $`bin/regctl tag ls --exclude 'version.*' --exclude 'unstable.*' --exclude '.*rc.*' --exclude 'lib.*' --exclude 'release.*' --exclude 'arm.*
' --exclude 'amd.*' ${image}`.text();
const allTags =
await $`./bin/regctl tag ls --exclude 'version.*' --exclude 'unstable.*' --exclude '.*rc.*' --exclude 'lib.*' --exclude 'release.*' --exclude 'arm.*' --exclude 'amd.*' ${image}`.text();
const semverTags = allTags.split("\n").filter((tag) => isSemver(tag));
const newestTag = semver.rsort(semverTags)[0];