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

Gaia integration tests with local sdk #737

Merged
merged 6 commits into from
Mar 8, 2023
Merged
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
31 changes: 24 additions & 7 deletions Dockerfile.gaia
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# syntax=docker/dockerfile:1

# build latest tagged gaia
FROM golang:1.18-alpine AS gaia-builder
FROM golang:1.18-alpine AS gaia-builder
# WORKDIR is set to /go by default
ARG USE_GAIA_TAG
ENV GAIA_TAG=${USE_GAIA_TAG}

Expand All @@ -12,10 +13,30 @@ ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOFLAGS="-buildvcs=false"

# Copy host machine's working directory into the container under /interchain-security
ADD . /interchain-security

RUN git clone https://github.com/cosmos/gaia.git
WORKDIR /go/gaia

# fetch gaia from tag and build it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also be ideal if we could pass a local build of gaia

Copy link
Contributor Author

@shaspitz shaspitz Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, @MSalopek or I could prob knock this out pretty quickly by just pattern matching the way -use-local-sdk flag does things

RUN if [ -z ${GAIA_TAG} ] ; then git clone https://github.com/cosmos/gaia.git && cd gaia && git checkout $(git tag | tail -1) && make build; else git clone https://github.com/cosmos/gaia.git && cd gaia && git checkout ${GAIA_TAG} && make build ; fi
RUN if [ -n "${GAIA_TAG}" ]; \
then git checkout "${GAIA_TAG}"; \
# if GAIA_TAG is not set, build the latest tagged version
else \
git checkout $(git tag | tail -1); \
fi

# Also replace sdk version in the go.mod if specified
RUN if [ -d "/interchain-security/cosmos-sdk" ]; then \
go mod edit -replace github.com/cosmos/cosmos-sdk=/interchain-security/cosmos-sdk && \
echo "local sdk version used in gaia build"; \
fi

# if GAIA_TAG is not set, build the latest tagged version
RUN go mod tidy
# Print the version of the sdk used in the build
RUN go list -m github.com/cosmos/cosmos-sdk
RUN make build

FROM golang:1.18-alpine AS is-builder

Expand All @@ -31,10 +52,6 @@ ADD . /interchain-security

WORKDIR /interchain-security

# Do not specify version here. It leads to odd replacement behavior
RUN if [ -d "./cosmos-sdk" ]; then go mod edit -replace github.com/cosmos/cosmos-sdk=./cosmos-sdk; fi
RUN go mod tidy

# Install interchain security binary
RUN make install

Expand Down