Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hole-punch): update rust v0.52 to master #317

Merged
merged 5 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image_name := rust-v0.52
commitSha := 1ead41ed04ce89e50b11a078586e47d89e17d3c4
image_name := rust-master
commitSha := 7517934a0f629309f83b69dc00eef44c44ddbc72
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved

all: image.json

Expand Down
24 changes: 12 additions & 12 deletions hole-punch-interop/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ export type Version = {

export const versions: Array<Version> = [
{
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 "<impl>-vX.Y.Z" or "<impl>vX.Y".
// The image id must be in the file "./impl/<impl>/vX.Y/image.json" or "./impl/<impl>/v0.0.Z/image.json".
function canonicalImagePath(id: string): string {
// Split by implementation and version
const [impl, version] = id.split("-v")
Expand All @@ -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
// "<impl>-vX.Y.Z" or "<impl>vX.Y" and the image id to be in the file
// "./impl/<impl>/vX.Y/image.json" or "./impl/<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
}