Skip to content

Commit

Permalink
Merge pull request #133 from notional-labs/ducnt/dockerimage
Browse files Browse the repository at this point in the history
Use banksy:debug in local test
  • Loading branch information
vuong177 committed May 26, 2023
2 parents 9861325 + b3357ef commit 0424d69
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/interchaintest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
uses: actions/checkout@v3

- run: make ictest-start-cosmos
env:
BRANCH_CI: "latest"

test-start-polkadot-chain:
runs-on: ubuntu-latest
Expand All @@ -63,6 +65,8 @@ jobs:
uses: actions/checkout@v3

- run: make ictest-start-polkadot
env:
BRANCH_CI: "latest"

# test-ibc-transfer:
# runs-on: ubuntu-latest
Expand All @@ -77,6 +81,8 @@ jobs:
# uses: actions/checkout@v3

# - run: make ictest-ibc
# env:
# BRANCH_CI: "latest"

test-push-wasm:
runs-on: ubuntu-latest
Expand All @@ -90,4 +96,6 @@ jobs:
- name: checkout code
uses: actions/checkout@v3

- run: make ictest-push-wasm
- run: make ictest-push-wasm
env:
BRANCH_CI: "latest"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ build:
go build $(BUILD_FLAGS) -o bin/banksyd ./cmd/banksyd

docker-build-debug:
@DOCKER_BUILDKIT=1 docker build -t composable-testnet:debug -f Dockerfile .
@DOCKER_BUILDKIT=1 docker build -t banksy:debug -f Dockerfile .

###############################################################################
### Proto ###
Expand Down
14 changes: 4 additions & 10 deletions tests/interchaintest/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,10 @@ func TestBanksyPicassoIBCTransfer(t *testing.T) {
},
{
ChainConfig: ibc.ChainConfig{
Type: "cosmos",
Name: "banksy",
ChainID: "banksyd",
Images: []ibc.DockerImage{
{
Repository: "ghcr.io/notional-labs/banksy",
Version: "2.0.1",
UidGid: "1025:1025",
},
},
Type: "cosmos",
Name: "banksy",
ChainID: "banksyd",
Images: []ibc.DockerImage{BanksyImage},
Bin: "banksyd",
Bech32Prefix: "banksy",
Denom: "stake",
Expand Down
14 changes: 4 additions & 10 deletions tests/interchaintest/push_wasm_client_code_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,10 @@ func TestPushWasmClientCode(t *testing.T) {
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
ChainConfig: ibc.ChainConfig{
Type: "cosmos",
Name: "banksy",
ChainID: "banksyd",
Images: []ibc.DockerImage{
{
Repository: "ghcr.io/notional-labs/banksy",
Version: "2.0.1",
UidGid: "1025:1025",
},
},
Type: "cosmos",
Name: "banksy",
ChainID: "banksyd",
Images: []ibc.DockerImage{BanksyImage},
Bin: "banksyd",
Bech32Prefix: "banksy",
Denom: "stake",
Expand Down
29 changes: 26 additions & 3 deletions tests/interchaintest/setup.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package interchaintest

import (
"os"
"strings"

"github.com/strangelove-ventures/interchaintest/v7/ibc"
)

var (
BanksyMainRepo = "ghcr.io/notional-labs/banksy"
BanksyMainRepo = "ghcr.io/notional-labs/banksy"
BanksyICTestRepo = "ghcr.io/notional-labs/banksy-ictest"

repo, version = GetDockerImageInfo()

BanksyImage = ibc.DockerImage{
Repository: "ghcr.io/notional-labs/banksy-ictest",
Version: "latest",
Repository: repo,
Version: version,
UidGid: "1025:1025",
}

Expand All @@ -30,3 +36,20 @@ var (
ConfigFileOverrides: nil,
}
)

// 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 = BanksyICTestRepo
if !found {
// make local-image
repo = "banksy"
branchVersion = "debug"
}

// github converts / to - for pushed docker images
branchVersion = strings.ReplaceAll(branchVersion, "/", "-")
return repo, branchVersion
}

0 comments on commit 0424d69

Please sign in to comment.