Skip to content

Commit

Permalink
ci: optimize upgrade tests by downloading binaries (#2433)
Browse files Browse the repository at this point in the history
* ci: optimize upgrade tests by pulling image

* invert conditional and parameterize
  • Loading branch information
gartnera authored Jul 10, 2024
1 parent fcf5a4f commit b602ded
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
28 changes: 19 additions & 9 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ FROM base-runtime AS latest-runtime
COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=latest-build /go/bin/zetacored /go/bin/zetaclientd /go/bin/zetaclientd-supervisor /go/bin/zetae2e /usr/local/bin

# optional old version build. This old build is used as the genesis version in the upgrade tests.
# use --target latest-runtime to skip
#
# TODO: just download binaries from github release now that we're using glibc
# we can't do this right now since we do not have a v16 release candidate
# https://github.com/zeta-chain/node/issues/2179
FROM base-build as old-build
# Optional old version build (from source). This old build is used as the genesis version in the upgrade tests.
# Use --target latest-runtime to skip.
FROM base-build as old-build-source

ARG OLD_VERSION
RUN git clone https://github.com/zeta-chain/node.git
Expand All @@ -74,8 +70,22 @@ RUN cd node && git fetch
RUN cd node && git checkout ${OLD_VERSION}
RUN cd node && make install

FROM base-runtime AS old-runtime-source

COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=old-build-source /go/bin/zetacored /go/bin/zetaclientd /usr/local/bin
COPY --from=latest-build /go/bin/zetaclientd-supervisor /usr/local/bin

# Optional old version build (from binary).
# Use --target latest-runtime to skip.
FROM base-runtime AS old-runtime

ARG OLD_VERSION
ARG BUILDARCH

COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=old-build /go/bin/zetacored /go/bin/zetaclientd /usr/local/bin
COPY --from=latest-build /go/bin/zetaclientd-supervisor /usr/local/bin
COPY --from=latest-build /go/bin/zetaclientd-supervisor /usr/local/bin
RUN curl -Lo /usr/local/bin/zetacored ${OLD_VERSION}/zetacored-linux-${BUILDARCH} && \
chmod 755 /usr/local/bin/zetacored && \
curl -Lo /usr/local/bin/zetaclientd ${OLD_VERSION}/zetaclientd-linux-${BUILDARCH} && \
chmod 755 /usr/local/bin/zetaclientd
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,18 @@ start-stress-test: zetanode
### Upgrade Tests ###
###############################################################################


# build from source only if requested
ifdef UPGRADE_TEST_FROM_SOURCE
zetanode-upgrade: zetanode
@echo "Building zetanode-upgrade"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v17' .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
@echo "Building zetanode-upgrade from source"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime-source --build-arg OLD_VERSION='release/v17' .
.PHONY: zetanode-upgrade
else
zetanode-upgrade: zetanode
@echo "Building zetanode-upgrade from binaries"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='https://github.com/zeta-chain/ci-testing-node/releases/download/v17.0.1-internal' .
.PHONY: zetanode-upgrade
endif

start-upgrade-test: zetanode-upgrade
@echo "--> Starting upgrade test"
Expand Down

0 comments on commit b602ded

Please sign in to comment.