From 61cfcaa1dd0ec84f9c1bbf071a00e8f87b7f7bb6 Mon Sep 17 00:00:00 2001 From: RafilxTenfen Date: Mon, 29 Jul 2024 13:27:41 -0300 Subject: [PATCH] chore: only add upgrade if build with e2e tag --- Makefile | 3 ++- app/app.go | 7 ++----- app/e2e_include_upgrades.go | 9 +++++++++ contrib/images/Makefile | 4 ++++ contrib/images/babylond/Dockerfile | 1 + go.mod | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 app/e2e_include_upgrades.go diff --git a/Makefile b/Makefile index aadf3bde4..058d5fc9c 100644 --- a/Makefile +++ b/Makefile @@ -427,7 +427,8 @@ dockerNetworkList=$($(DOCKER) network ls --filter name=bbn-testnet --format {{.I build-docker: ## Build babylond Docker image $(MAKE) -C contrib/images babylond -build-docker-e2e: build-docker +build-docker-e2e: + $(MAKE) -C contrib/images babylond-e2e $(MAKE) -C contrib/images babylond-before-upgrade $(MAKE) -C contrib/images e2e-init-chain diff --git a/app/app.go b/app/app.go index 4e019d25c..541bcd8d3 100644 --- a/app/app.go +++ b/app/app.go @@ -94,7 +94,6 @@ import ( "github.com/spf13/cast" "github.com/babylonlabs-io/babylon/app/upgrades" - "github.com/babylonlabs-io/babylon/app/upgrades/vanilla" bbn "github.com/babylonlabs-io/babylon/types" appkeepers "github.com/babylonlabs-io/babylon/app/keepers" @@ -159,10 +158,8 @@ var ( } // software upgrades and forks - Upgrades = []upgrades.Upgrade{ - vanilla.Upgrade, - } - Forks = []upgrades.Fork{} + Upgrades = []upgrades.Upgrade{} + Forks = []upgrades.Fork{} ) func init() { diff --git a/app/e2e_include_upgrades.go b/app/e2e_include_upgrades.go new file mode 100644 index 000000000..9d6af8d51 --- /dev/null +++ b/app/e2e_include_upgrades.go @@ -0,0 +1,9 @@ +//go:build e2e + +package app + +import "github.com/babylonlabs-io/babylon/app/upgrades/vanilla" + +func init() { + Upgrades = append(Upgrades, vanilla.Upgrade) +} diff --git a/contrib/images/Makefile b/contrib/images/Makefile index 214ebbe5a..c0afef21b 100644 --- a/contrib/images/Makefile +++ b/contrib/images/Makefile @@ -7,6 +7,10 @@ all: babylond cosmos-relayer babylond: babylond-rmi docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_FULL_PATH} +babylond-e2e: babylond-rmi + docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_FULL_PATH} \ + --build-arg BUILD_TAGS="e2e" + babylond-before-upgrade: docker rmi babylonlabs-io/babylond-before-upgrade 2>/dev/null; true && \ docker build --tag babylonlabs-io/babylond-before-upgrade -f babylond/Dockerfile \ diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 76c315562..50f7857b8 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -3,6 +3,7 @@ FROM golang:1.21 AS build-env # Version to build. Default is empty ARG VERSION +ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" # Cosmos build options ARG COSMOS_BUILD_OPTIONS="" diff --git a/go.mod b/go.mod index e8ba3e373..9ab2153c5 100644 --- a/go.mod +++ b/go.mod @@ -64,6 +64,7 @@ require ( github.com/vulpine-io/io-test v1.0.0 go.uber.org/zap v1.26.0 golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 + golang.org/x/sync v0.7.0 google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de ) @@ -247,7 +248,6 @@ require ( golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect - golang.org/x/sync v0.7.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.20.0 // indirect google.golang.org/api v0.162.0 // indirect