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

chore(deployment): Add verification scripts #2638

Merged
merged 7 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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 || exit 1

# 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 || exit 1

# 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