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

CI: fix docker demo #1526

Merged
merged 5 commits into from
May 30, 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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
target/release/permissionless-builder
target/release/nasty-client
target/release/pub-key
target/release/bridge
target/release/espresso-bridge
build-arm:
runs-on: buildjet-4vcpu-ubuntu-2204-arm
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
target/release/permissionless-builder
target/release/nasty-client
target/release/pub-key
target/release/bridge
target/release/espresso-bridge
build-dockers:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -421,4 +421,4 @@ jobs:
- name: Test docker demo
run: |
just demo &
timeout 600 scripts/smoke-test-demo
timeout -v 600 scripts/smoke-test-demo | sed -e 's/^/smoke-test: /;'
2 changes: 1 addition & 1 deletion .github/workflows/build_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
${{ env.CARGO_TARGET_DIR }}/${{ env.TARGET_TRIPLET }}/release/deploy
${{ env.CARGO_TARGET_DIR }}/${{ env.TARGET_TRIPLET }}/release/keygen
${{ env.CARGO_TARGET_DIR }}/${{ env.TARGET_TRIPLET }}/release/pub-key
${{ env.CARGO_TARGET_DIR }}/${{ env.TARGET_TRIPLET }}/release/bridge
${{ env.CARGO_TARGET_DIR }}/${{ env.TARGET_TRIPLET }}/release/espresso-bridge
static-dockers:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-demo-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
run: |
export PATH="$PWD/target/release:$PATH"
scripts/demo-native --tui=false &
timeout -v 600 scripts/smoke-test-demo
timeout -v 600 scripts/smoke-test-demo | sed -e 's/^/smoke-test: /;'
2 changes: 1 addition & 1 deletion docker/bridge.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["tini", "--"]

COPY target/$TARGETARCH/release/bridge /bin/bridge
COPY target/$TARGETARCH/release/espresso-bridge /bin/bridge
RUN chmod +x /bin/bridge

CMD [ "/bin/bridge"]
5 changes: 3 additions & 2 deletions scripts/build-docker-images
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ cleanup(){
}

# Copy data files to Docker context.
cp -r data/genesis ${WORKDIR}/genesis
mkdir -p ${WORKDIR}/data
cp -rv data/genesis ${WORKDIR}/data/

for ARCH in "amd64" "arm64"; do
case "$ARCH" in
Expand All @@ -35,7 +36,7 @@ for ARCH in "amd64" "arm64"; do
;;
esac
mkdir -p ${WORKDIR}/target/$ARCH/release
for binary in "orchestrator" "cdn-broker" "cdn-marshal" "cdn-whitelist" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client" "pub-key" "bridge"; do
for binary in "orchestrator" "cdn-broker" "cdn-marshal" "cdn-whitelist" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client" "pub-key" "espresso-bridge"; do
cp -v "${CARGO_TARGET_DIR}/${TARGET}/release/$binary" ${WORKDIR}/target/$ARCH/release
done
done
Expand Down
5 changes: 3 additions & 2 deletions scripts/build-docker-images-native
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ cleanup(){
}

# Copy data files to Docker context.
cp -r data/genesis ${WORKDIR}/genesis
mkdir -p ${WORKDIR}/data
cp -rv data/genesis ${WORKDIR}/data/

mkdir -p "${WORKDIR}/target/$ARCH/release"
for binary in "orchestrator" "cdn-broker" "cdn-marshal" "cdn-whitelist" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client" "pub-key" "bridge"; do
for binary in "orchestrator" "cdn-broker" "cdn-marshal" "cdn-whitelist" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client" "pub-key" "espresso-bridge"; do
cp -v "${CARGO_TARGET_DIR}/release/$binary" "${WORKDIR}/target/$ARCH/release"
# Patch the interpreter for running without nix inside the ubuntu based docker image.
if [ $KERNEL == "linux" ]; then
Expand Down
29 changes: 18 additions & 11 deletions scripts/smoke-test-demo
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env bash

set -e
set -eE

# Duplicate some debugging information to stdout in case the process exits
trap 'error_handler "${LINENO}" "$BASH_COMMAND"' ERR INT
error_handler() {
local lineno=$1
local msg=$2
echo "Failed at line $lineno: msg: $msg"
}

# load env vars in .env
set -a; source .env; set +a;
Expand Down Expand Up @@ -32,15 +39,15 @@ function wait_for() {

# usage: get_balance <address> <block>
function get_balance() {
if which bridge > /dev/null ; then
# If the bridge program is built locally, use it.
if which espresso-bridge > /dev/null 2>&1 ; then
# If the espresso-bridge program is built locally, use it.
(
unset MNEMONIC
RUST_LOG=off bridge balance -e $SEQUENCER_API -a $1 -b $2
RUST_LOG=off espresso-bridge balance -e $SEQUENCER_API -a $1 -b $2
)
else
# Otherwise, use Docker.
docker run -e RUST_LOG=off ghcr.io/espressosystems/espresso-sequencer/bridge:main \
docker run --network="host" -e RUST_LOG=off ghcr.io/espressosystems/espresso-sequencer/bridge:main \
bridge balance -e $SEQUENCER_API -a $1 -b $2
fi
}
Expand All @@ -66,14 +73,14 @@ wait_for 300 "demo load generator" "$LOAD_GENERATOR/healthcheck"

# Get the block height and number of transactions, wait some time, and check that these numbers have
# both increased.
block_height=`curl -sL $SEQUENCER_API/node/block-height`
num_tx=`curl -sL $SEQUENCER_API/node/transactions/count`
block_height=$(curl -sL $SEQUENCER_API/node/block-height)
num_tx=$(curl -sL $SEQUENCER_API/node/transactions/count)
# Get the balance of the builder and fee recipient accounts. The former should decrease over time
# while the latter should increase.
builder_balance=`get_balance 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f $block_height`
recipient_balance=`get_balance 0x0000000000000000000000000000000000000000 $block_height`
builder_balance=$(get_balance 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f $block_height)
recipient_balance=$(get_balance 0x0000000000000000000000000000000000000000 $block_height)
# Get the last L1 block where the light client was updated. This should increase over time.
light_client_updated=`last_light_client_update`
light_client_updated=$(last_light_client_update)

echo "Initial state:"
echo " block_height: $block_height"
Expand Down
File renamed without changes.
Loading