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

Allow specifying of relayer image #4534

Merged
merged 6 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
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
24 changes: 17 additions & 7 deletions e2e/relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,24 @@ func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclien
t.Helper()
switch cfg.Type {
case Rly:
return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network)
return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image)
case Hermes:
return newHermesRelayer(t, cfg.Tag, logger, dockerClient, network)
return newHermesRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image)
default:
panic(fmt.Sprintf("unknown relayer specified: %s", cfg.Type))
}
}

// newCosmosRelayer returns an instance of the go relayer.
// Options are used to allow for relayer version selection and specifying the default processing option.
func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer {
t.Helper()
customImageOption := relayer.CustomDockerImage(rlyRelayerRepository, tag, rlyRelayerUser)

if relayerImage == "" {
relayerImage = rlyRelayerRepository
}

customImageOption := relayer.CustomDockerImage(relayerImage, tag, rlyRelayerUser)
relayerProcessingOption := relayer.StartupFlags("-p", "events") // relayer processes via events

relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, customImageOption, relayerProcessingOption)
Expand All @@ -59,17 +64,22 @@ func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient
}

// newHermesRelayer returns an instance of the hermes relayer.
func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer {
t.Helper()
customImageOption := relayer.CustomDockerImage(hermesRelayerRepository, tag, hermesRelayerUser)

if relayerImage == "" {
relayerImage = hermesRelayerRepository
}

customImageOption := relayer.CustomDockerImage(relayerImage, tag, hermesRelayerUser)
relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, logger, customImageOption)

return relayerFactory.Build(
t, dockerClient, network,
)
}

// RelayerMap is a mapping from test names to a relayer set for that test.
// Map is a mapping from test names to a relayer set for that test.
type Map map[string]map[ibc.Wallet]bool

// AddRelayer adds the given relayer to the relayer set for the given test name.
Expand Down
2 changes: 1 addition & 1 deletion e2e/sample.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ chains:

relayer:
type: rly # override with RELAYER_TYPE
image: ghcr.io/cosmos/relayer
image: ghcr.io/cosmos/relayer # override with RELAYER_IMAGE
tag: latest # override with RELAYER_TAG

cometbft:
Expand Down
7 changes: 7 additions & 0 deletions e2e/testsuite/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const (
ChainBTagEnv = "CHAIN_B_TAG"
// RelayerTagEnv specifies the relayer version. Defaults to "main"
RelayerTagEnv = "RELAYER_TAG"
// RelayerImageEnv specifies the image that the relayer will use. If left unspecified, it will default
// to values set for hermesRelayerRepository or rlyRelayerRepository.
RelayerImageEnv = "RELAYER_IMAGE"
// RelayerTypeEnv specifies the type of relayer that should be used.
RelayerTypeEnv = "RELAYER_TYPE"
// ChainBinaryEnv binary is the binary that will be used for both chains.
Expand Down Expand Up @@ -206,6 +209,10 @@ func applyEnvironmentVariableOverrides(fromFile TestConfig) TestConfig {
fromFile.RelayerConfig.Type = envTc.RelayerConfig.Type
}

if os.Getenv(RelayerImageEnv) != "" {
fromFile.RelayerConfig.Image = envTc.RelayerConfig.Image
}

if os.Getenv(ChainUpgradePlanEnv) != "" {
fromFile.UpgradeConfig.PlanName = envTc.UpgradeConfig.PlanName
}
Expand Down
Loading