From f76b5818acbb9b9a7bc87f904f51b3c471ae3773 Mon Sep 17 00:00:00 2001 From: ducnt131 Date: Fri, 26 May 2023 10:18:33 +0700 Subject: [PATCH] Use feeapp:debug in local test --- .github/workflows/interchaintest.yaml | 7 +++++++ Makefile | 3 +++ tests/interchaintest/setup.go | 29 ++++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/interchaintest.yaml b/.github/workflows/interchaintest.yaml index a034002..158d2d9 100644 --- a/.github/workflows/interchaintest.yaml +++ b/.github/workflows/interchaintest.yaml @@ -49,6 +49,8 @@ jobs: uses: actions/checkout@v3 - run: make ictest-basic + env: + BRANCH_CI: "latest" test-ibc: runs-on: ubuntu-latest @@ -63,6 +65,9 @@ jobs: uses: actions/checkout@v3 - run: make ictest-ibc + env: + BRANCH_CI: "latest" + test-packet-forward: runs-on: ubuntu-latest needs: build-and-push-image @@ -76,4 +81,6 @@ jobs: uses: actions/checkout@v3 - run: make ictest-packet-forward + env: + BRANCH_CI: "latest" diff --git a/Makefile b/Makefile index b1d0d94..16eadf1 100644 --- a/Makefile +++ b/Makefile @@ -93,6 +93,9 @@ install: go.sum build: go build $(BUILD_FLAGS) -o bin/feeappd ./cmd/feeappd +docker-build-debug: + @DOCKER_BUILDKIT=1 docker build -t feeapp:debug -f Dockerfile . + ############################################################################### ### Interchain test ### ############################################################################### diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 9c7467d..f1d9d1b 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -1,6 +1,9 @@ package interchaintest import ( + "os" + "strings" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/types" balancertypes "github.com/notional-labs/fee-abstraction/tests/interchaintest/osmosistypes/gamm/balancer" @@ -26,11 +29,14 @@ const ( ) var ( - FeeabsMainRepo = "ghcr.io/notional-labs/fee-abstraction" + FeeabsMainRepo = "ghcr.io/notional-labs/fee-abstraction" + FeeabsICTestRepo = "ghcr.io/notional-labs/fee-abstraction-ictest" + + repo, version = GetDockerImageInfo() feeabsImage = ibc.DockerImage{ - Repository: "ghcr.io/notional-labs/fee-abstraction-ictest", - Version: "latest", + Repository: repo, + Version: version, UidGid: "1025:1025", } @@ -79,3 +85,20 @@ func osmosisEncoding() *simappparams.EncodingConfig { return cfg } + +// GetDockerImageInfo returns the appropriate repo and branch version string for integration with the CI pipeline. +// The remote runner sets the BRANCH_CI env var. If present, interchaintest will use the docker image pushed up to the repo. +// If testing locally, user should run `make docker-build-debug` and interchaintest will use the local image. +func GetDockerImageInfo() (repo, version string) { + branchVersion, found := os.LookupEnv("BRANCH_CI") + repo = FeeabsICTestRepo + if !found { + // make local-image + repo = "feeapp" + branchVersion = "debug" + } + + // github converts / to - for pushed docker images + branchVersion = strings.ReplaceAll(branchVersion, "/", "-") + return repo, branchVersion +}