From eb21984300fa5a717e221dc0618900e7b35db3f6 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 27 Oct 2023 17:09:28 +1100 Subject: [PATCH] feat(hole-punch): update rust `v0.52` to `master` (#317) --- .../impl/rust/{v0.52 => master}/Makefile | 4 ++-- hole-punch-interop/versions.ts | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) rename hole-punch-interop/impl/rust/{v0.52 => master}/Makefile (87%) diff --git a/hole-punch-interop/impl/rust/v0.52/Makefile b/hole-punch-interop/impl/rust/master/Makefile similarity index 87% rename from hole-punch-interop/impl/rust/v0.52/Makefile rename to hole-punch-interop/impl/rust/master/Makefile index 84233ff1..437c68a7 100644 --- a/hole-punch-interop/impl/rust/v0.52/Makefile +++ b/hole-punch-interop/impl/rust/master/Makefile @@ -1,5 +1,5 @@ -image_name := rust-v0.52 -commitSha := 1ead41ed04ce89e50b11a078586e47d89e17d3c4 +image_name := rust-master +commitSha := 461209ab1ba6b8e2a653ca354a5aad38802a35f9 all: image.json diff --git a/hole-punch-interop/versions.ts b/hole-punch-interop/versions.ts index 12e58836..609dc89d 100644 --- a/hole-punch-interop/versions.ts +++ b/hole-punch-interop/versions.ts @@ -10,11 +10,20 @@ export type Version = { export const versions: Array = [ { - id: "rust-v0.52", + id: "rust-master", transports: ["tcp", "quic"], - }, -].map((v: Version) => (typeof v.containerImageID === "undefined" ? ({ ...v, containerImageID: canonicalImageIDLookup(v.id) }) : v)) + containerImageID: readImageId("./impl/rust/master/image.json"), + } as Version, +].map((v: Version) => (typeof v.containerImageID === "undefined" ? ({ ...v, containerImageID: readImageId(canonicalImagePath(v.id)) }) : v)) +function readImageId(path: string): string { + return JSON.parse(fs.readFileSync(path, "utf8")).imageID; +} + +// Finds the `image.json` for the given version id. +// +// Expects the form of "-vX.Y.Z" or "vX.Y". +// The image id must be in the file "./impl//vX.Y/image.json" or "./impl//v0.0.Z/image.json". function canonicalImagePath(id: string): string { // Split by implementation and version const [impl, version] = id.split("-v") @@ -28,12 +37,3 @@ function canonicalImagePath(id: string): string { // Read the image ID from the JSON file on the filesystem return `./impl/${impl}/${versionFolder}/image.json` } - -// Loads the container image id for the given version id. Expects the form of -// "-vX.Y.Z" or "vX.Y" and the image id to be in the file -// "./impl//vX.Y/image.json" or "./impl//v0.0.Z/image.json" -function canonicalImageIDLookup(id: string): string { - const imageIDJSON = fs.readFileSync(canonicalImagePath(id), "utf8") - const imageID = JSON.parse(imageIDJSON).imageID - return imageID -}