Skip to content

Commit

Permalink
CI: fix docker demo (#1526)
Browse files Browse the repository at this point in the history
* CI: fix docker demo

- Rename bridge to espresso-bridge to avoid conflicts with other
  executable called bridge which often already exist on disk.
- Improve output of smoke-test script to make it easier to debug
  failures in the future.

* Allow access to host from within bridge container

* Undo unwanted change

* Fix local docker image build scripts

* Fix copying of genesis data
  • Loading branch information
sveitser authored and jbearer committed Jun 3, 2024
1 parent e5ee674 commit 64a2cda
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
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.

0 comments on commit 64a2cda

Please sign in to comment.