fix(multidim): make js-libp2p builds reproducible (#288)

This commit is contained in:
Chad Nehemiah 2023-09-07 11:03:09 -05:00 committed by GitHub
parent 2218a12457
commit 43b67ccdba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22315 additions and 16 deletions

View File

@ -10,7 +10,7 @@ FROM mcr.microsoft.com/playwright
COPY --from=js-libp2p-base /app/ /app/
WORKDIR /app/interop
WORKDIR /app/node_modules/@libp2p/multidim-interop
# We install browsers here instead of the cached version so that we use the latest browsers at run time.
# Ideally this would also be pinned, but playwright controls this, so there isn't much we can do about it.
# By installing here, we avoid installing it at test time.

View File

@ -1,11 +1,11 @@
# Here because we want to fetch the node_modules within docker so that it's
# installed on the same platform the test is run. Otherwise tools like `esbuild` will fail to run
FROM node:18
FROM node:18.17.1
WORKDIR /app
COPY . .
RUN npm i && npm run build
RUN apt-get update && apt-get install -y cmake
COPY package*.json ./
RUN npm ci
WORKDIR /app/interop
RUN npm i && npm run build
WORKDIR /app/node_modules/@libp2p/multidim-interop
ENTRYPOINT [ "npm", "run", "test:interop:multidim", "--", "--build", "false", "--types", "false", "-t", "node" ]

View File

@ -1,8 +1,7 @@
image_name := js-v0.46
commitSha := b7e608998cc88860d9ec8a3ed7c03fdfb3eccb3b
image_name := js-v0.46.9
# TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in
all: image.json chromium-image.json firefox-image.json
all: image.json chromium-image.json firefox-image.json update-lock-file
# Necessary because multistage builds require a docker image name rather than a digest to be used
load-image-json: image.json
@ -18,17 +17,20 @@ firefox-image.json: load-image-json BrowserDockerfile
docker image inspect firefox-${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
image.json: js-libp2p-${commitSha}
cd js-libp2p-${commitSha} && docker build -t ${image_name} -f ../Dockerfile .
# We update the lock file here so that we make sure we are always using the correct lock file.
# If this changes, CI will fail since there are unstaged changes.
update-lock-file: image.json
CONTAINER_ID=$$(docker create $$(jq -r .imageID image.json)); \
docker cp $$CONTAINER_ID:/app/package-lock.json ./package-lock.json; \
docker rm $$CONTAINER_ID
image.json:
docker build -t ${image_name} -f ./Dockerfile .
docker image inspect ${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
js-libp2p-${commitSha}:
wget -O js-libp2p-${commitSha}.zip "https://github.com/libp2p/js-libp2p/archive/${commitSha}.zip"
unzip -o js-libp2p-${commitSha}.zip
unzip -o js-libp2p-${commitSha}.zip
clean:
rm -rf image.json js-libp2p-*.zip js-libp2p-* *-image.json
rm -rf image.json *-image.json
.PHONY: all clean browser-images load-image-json

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
{
"dependencies": {
"@libp2p/multidim-interop": "1.0.0-c4eff4c5"
},
"overrides": {
"@chainsafe/libp2p-noise": "13.0.1",
"@chainsafe/libp2p-yamux": "5.0.0",
"@libp2p/mplex": "9.0.5",
"@libp2p/tcp": "8.0.5",
"@libp2p/webrtc": "3.1.9",
"@libp2p/websockets": "7.0.5",
"@libp2p/webtransport": "3.0.9",
"@multiformats/mafmt": "12.1.6",
"@multiformats/multiaddr": "12.1.7",
"aegir": "40.0.12",
"libp2p": "0.46.9",
"redis": "4.6.8"
}
}