Skip to content

Commit

Permalink
Adds .experimental tag suffix, removes new dockerfile, makes lightwal…
Browse files Browse the repository at this point in the history
…letd tests conditional
  • Loading branch information
arya2 committed Mar 14, 2023
1 parent 67bd2c1 commit ced6cbe
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 203 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ on:
required: false
type: string
default: info
with_mining_rpcs:
required: false
type: boolean
rpc_port:
required: false
type: string
tag_suffix:
required: false
type: string

outputs:
image_digest:
description: 'The image digest to be used on a caller workflow'
Expand Down Expand Up @@ -72,6 +82,9 @@ jobs:
images: |
us-docker.pkg.dev/zealous-zebra/zebra/${{ inputs.image_name }}
zfnd/zebra,enable=${{ github.event_name == 'release' && !github.event.release.prerelease }}
# appends inputs.tag_suffix to tags
flavor: |
suffix=${{ inputs.tag_suffix }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
Expand Down Expand Up @@ -145,6 +158,8 @@ jobs:
ZEBRA_SKIP_IPV6_TESTS=${{ inputs.zebra_skip_ipv6_tests }}
CHECKPOINT_SYNC=${{ inputs.checkpoint_sync }}
RUST_LOG=${{ inputs.rust_log }}
WITH_MINING_RPCS=${{ inputs.with_mining_rpcs }}
RPC_PORT=${{ inputs.rpc_port }}
push: true
# To improve build speeds, for each branch we push an additional image to the registry,
# to be used as the caching layer, using the `max` caching mode.
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ jobs:
name: Build Release Testnet Mining Docker
uses: ./.github/workflows/build-docker-image.yml
with:
dockerfile_path: ./docker/mining.Dockerfile
dockerfile_path: ./docker/Dockerfile
dockerfile_target: runtime
image_name: zebrad-mining-rpcs-testnet
tag_suffix: .experimental
network: Testnet
rpc_port: '18232'
with_mining_rpcs: true
checkpoint_sync: true
rust_backtrace: '1'
zebra_skip_ipv6_tests: '1'
Expand Down
23 changes: 17 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ ENV ZEBRA_SKIP_IPV6_TESTS ${ZEBRA_SKIP_IPV6_TESTS:-1}
ARG CHECKPOINT_SYNC
ENV CHECKPOINT_SYNC ${CHECKPOINT_SYNC:-true}

# Build zebrad with getblocktemplate-rpcs feature
ARG WITH_MINING_RPCS
ENV EXTRA_FEATURES ${WITH_MINING_RPCS:+",getblocktemplate-rpcs"}

# Build zebra tests with lightwalletd-grpc-tests feature
ARG WITH_LIGHTWALLETD_TESTS=${WITH_MINING_RPCS:-true}
ENV EXTRA_TEST_FEATURES ${WITH_LIGHTWALLETD_TESTS:+",lightwalletd-grpc-tests"}

ARG NETWORK
ENV NETWORK ${NETWORK:-Mainnet}

Expand All @@ -100,10 +108,10 @@ COPY --from=us-docker.pkg.dev/zealous-zebra/zebra/lightwalletd /opt/lightwalletd
# This is the caching Docker layer for Rust!
#
# TODO: is it faster to use --tests here?
RUN cargo chef cook --release --features sentry,lightwalletd-grpc-tests --workspace --recipe-path recipe.json
RUN cargo chef cook --release --features sentry${EXTRA_TEST_FEATURES}${EXTRA_FEATURES} --workspace --recipe-path recipe.json

COPY . .
RUN cargo test --locked --release --features lightwalletd-grpc-tests --workspace --no-run
RUN cargo test --locked --release --features ${EXTRA_TEST_FEATURES:1}${EXTRA_FEATURES} --workspace --no-run
RUN cp /opt/zebrad/target/release/zebrad /usr/local/bin

COPY ./docker/entrypoint.sh /
Expand All @@ -118,11 +126,11 @@ ENTRYPOINT [ "/entrypoint.sh" ]
# `test` stage. This step is a dependency for the `runtime` stage, which uses the resulting
# zebrad binary from this step.
FROM deps AS release
RUN cargo chef cook --release --features sentry --recipe-path recipe.json
RUN cargo chef cook --release --features sentry${EXTRA_FEATURES} --recipe-path recipe.json

COPY . .
# Build zebra
RUN cargo build --locked --release --features sentry --package zebrad --bin zebrad
RUN cargo build --locked --release --features sentry${EXTRA_FEATURES} --package zebrad --bin zebrad

# This stage is only used when deploying nodes or when only the resulting zebrad binary is needed
#
Expand All @@ -138,6 +146,7 @@ RUN apt-get update && \

ARG CHECKPOINT_SYNC=true
ARG NETWORK=Mainnet
ARG RPC_PORT

# Use a configurable dir and file for the zebrad configuration file
ARG ZEBRA_CONF_DIR=/etc/zebra
Expand Down Expand Up @@ -169,20 +178,22 @@ RUN set -ex; \
{ \
echo "[network]"; \
echo "network = '${NETWORK}'"; \
[ $NETWORK = "Testnet" ] && echo "listen_addr = '127.0.0.1:18233'"; \
echo "[consensus]"; \
echo "checkpoint_sync = ${CHECKPOINT_SYNC}"; \
echo "[state]"; \
echo "cache_dir = '/zebrad-cache'"; \
echo "[rpc]"; \
echo "#listen_addr = '127.0.0.1:8232'"; \
[ -n "$RPC_PORT" ] && echo "listen_addr = '127.0.0.1:${RPC_PORT}'"; \
echo "parallel_cpu_threads = 0"; \
echo "[metrics]"; \
echo "#endpoint_addr = '127.0.0.1:9999'"; \
echo "[tracing]"; \
echo "#endpoint_addr = '127.0.0.1:3000'"; \
} > "${ZEBRA_CONF_PATH}"

EXPOSE 8233 18233

EXPOSE 8233 18233 $RPC_PORT

ARG SHORT_SHA
ENV SHORT_SHA $SHORT_SHA
Expand Down
196 changes: 0 additions & 196 deletions docker/mining.Dockerfile

This file was deleted.

0 comments on commit ced6cbe

Please sign in to comment.