2023-04-14 06:26:46 +00:00
|
|
|
#!/bin/bash
|
2023-09-21 06:55:26 +00:00
|
|
|
# Builds and deploys a stack with only what we need.
|
|
|
|
# This script assumes we are running in the project root.
|
2023-04-14 06:26:46 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-04-17 09:16:02 +00:00
|
|
|
laconic_so="${LACONIC_SO:-laconic-so} --stack $(readlink -f test) --verbose"
|
2023-05-26 10:10:16 +00:00
|
|
|
|
2023-04-14 06:26:46 +00:00
|
|
|
CONFIG_DIR=$(readlink -f "${CONFIG_DIR:-$(mktemp -d)}")
|
|
|
|
|
2024-04-17 09:16:02 +00:00
|
|
|
# Prevent conflicting tty output
|
|
|
|
export BUILDKIT_PROGRESS=plain
|
|
|
|
|
2023-05-28 08:50:18 +00:00
|
|
|
# By default assume we are running in the project root
|
|
|
|
export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-..}"
|
2024-05-13 04:35:49 +00:00
|
|
|
|
|
|
|
echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=21 >> $CONFIG_DIR/stack.env
|
2023-04-14 06:26:46 +00:00
|
|
|
# Pass this in so we can run eth_call forwarding tests, which expect no IPLD DB
|
2023-05-28 08:50:18 +00:00
|
|
|
echo CERC_RUN_STATEDIFF=${CERC_RUN_STATEDIFF:-true} >> $CONFIG_DIR/stack.env
|
2024-05-13 04:35:49 +00:00
|
|
|
# Don't run the debugger
|
2024-04-17 09:16:02 +00:00
|
|
|
echo CERC_REMOTE_DEBUG=false >> $CONFIG_DIR/stack.env
|
2023-04-14 06:26:46 +00:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2023-09-21 06:55:26 +00:00
|
|
|
if [[ -z $SKIP_BUILD ]]; then
|
|
|
|
$laconic_so setup-repositories \
|
2024-04-18 13:54:42 +00:00
|
|
|
--exclude git.vdb.to/cerc-io/ipld-eth-server
|
2024-04-17 09:16:02 +00:00
|
|
|
# Assume the tested image has been built separately
|
2023-09-21 06:55:26 +00:00
|
|
|
$laconic_so build-containers \
|
2024-04-17 09:16:02 +00:00
|
|
|
--exclude cerc/ipld-eth-server
|
2023-09-21 06:55:26 +00:00
|
|
|
fi
|
2023-04-14 06:26:46 +00:00
|
|
|
|
|
|
|
$laconic_so deploy \
|
2024-04-30 10:00:49 +00:00
|
|
|
--exclude ipld-eth-server \
|
2023-05-26 10:10:16 +00:00
|
|
|
--env-file $CONFIG_DIR/stack.env \
|
|
|
|
--cluster test up
|
2023-04-14 06:26:46 +00:00
|
|
|
|
2023-05-25 13:48:12 +00:00
|
|
|
set +x
|
2023-04-14 06:26:46 +00:00
|
|
|
|
|
|
|
# Get IPv4 endpoint of geth file server
|
|
|
|
bootnode_endpoint=$(docker port test-fixturenet-eth-bootnode-geth-1 9898 | head -1)
|
|
|
|
|
|
|
|
# Extract the chain config and ID from genesis file
|
|
|
|
curl -s $bootnode_endpoint/geth.json | jq '.config' > $CONFIG_DIR/chain.json
|
|
|
|
|
|
|
|
# Output vars if we are running on Github
|
|
|
|
if [[ -n "$GITHUB_ENV" ]]; then
|
2023-05-26 10:10:16 +00:00
|
|
|
echo ETH_CHAIN_ID="$(jq '.chainId' $CONFIG_DIR/chain.json)" >> "$GITHUB_ENV"
|
2023-05-28 09:52:56 +00:00
|
|
|
echo ETH_CHAIN_CONFIG="$CONFIG_DIR/chain.json" >> "$GITHUB_ENV"
|
|
|
|
echo ETH_HTTP_PATH=$(docker port test-fixturenet-eth-geth-1-1 8545 | head -1) >> "$GITHUB_ENV"
|
2023-05-26 10:10:16 +00:00
|
|
|
# Read a private key so we can send from a funded account
|
2023-05-28 09:52:56 +00:00
|
|
|
echo DEPLOYER_PRIVATE_KEY=$(curl -s $bootnode_endpoint/accounts.csv | head -1 | cut -d',' -f3) >> "$GITHUB_ENV"
|
2023-04-14 06:26:46 +00:00
|
|
|
fi
|