Skip to content

Commit

Permalink
Add verification scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawchord committed Oct 3, 2024
1 parent ec9dab0 commit 5e77b87
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/dfx-orbit.validate.backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ -z "${RELEASE_COMMIT}" ]; then
echo "RELEASE_COMMIT is unset or set to the empty string"
exit 1
fi

# Checkout
git fetch
git checkout $RELEASE_COMMIT

# Make sure target directory exists but no prior artifacts are there
mkdir -p target
rm -f target/backend.wasm.gz target/args.txt

# Generate argument file and wasm binary
ENV=ic ./scripts/deploy.args.sh > target/args.txt
DOCKER_BUILDKIT=1 docker build --progress=plain --build-arg network=ic -o target/ .

# Verify that the wasm matches the request
dfx-orbit verify $BACKEND_REQUEST_ID canister install backend --mode upgrade --wasm target/backend.wasm.gz --arg-file target/args.txt
26 changes: 26 additions & 0 deletions scripts/dfx-orbit.validate.frontend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

if [ -z "${RELEASE_COMMIT}" ]; then
echo "RELEASE_COMMIT is unset or set to the empty string"
exit 1
fi

if [ -z "${ENV_SHA}" ]; then
echo "ENV_SHA is unset or set to the empty string"
exit 1
fi

# Checkout
git fetch
git checkout $RELEASE_COMMIT

# Make sure target directory exists but no prior artifacts are there
mkdir -p target
rm -fr target/frontend

# Check that the frontend ENV file matches the hash and build the frontend
echo "$ENV_SHA .env.production" | sha256sum -c || exit 1
DOCKER_BUILDKIT=1 docker build -f Dockerfile.frontend --progress=plain --build-arg network=ic -o target/ .

# Check that the artifacts match the commit args
dfx-orbit verify $FRONTEND_REQUEST_ID asset upload frontend --batch-id $BATCH_ID --files target/frontend

0 comments on commit 5e77b87

Please sign in to comment.