diff --git a/Dockerfile-localnet b/Dockerfile-localnet index f9ff74d48a..24b98adf53 100644 --- a/Dockerfile-localnet +++ b/Dockerfile-localnet @@ -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 @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/Makefile b/Makefile index 177f064722..471c9af947 100644 --- a/Makefile +++ b/Makefile @@ -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"