Skip to content

Commit

Permalink
add make and docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
krehermann committed Feb 6, 2024
1 parent c3038c3 commit b732394
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ chainlink-local-start:
install-medianpoc: ## Build & install the chainlink-medianpoc binary.
go install $(GOFLAGS) ./plugins/cmd/chainlink-medianpoc

.PHONY: install-mercury-loop
install-mercury-loop: ## Build & install the chainlink-medianpoc binary.
go install $(GOFLAGS) ./plugins/cmd/chainlink-mercury


.PHONY: docker ## Build the chainlink docker image
docker:
docker buildx build \
Expand Down
3 changes: 2 additions & 1 deletion core/services/ocr2/plugins/mercury/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewServices(
saver := ocrcommon.NewResultRunSaver(pipelineRunner, lggr, cfg.MaxSuccessfulRuns(), cfg.ResultWriteQueueDepth())
srvs = append(srvs, saver)

loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Env.Get()
loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Cmd.Get()

// this is the factory that will be used to create the mercury plugin
var factory ocr3types.MercuryPluginFactory
Expand Down Expand Up @@ -203,6 +203,7 @@ func NewServices(
}

func initLoop(cmd string, cfg Config, feedID utils.FeedID, lggr logger.Logger) (func() *exec.Cmd, loop.GRPCOpts, logger.Logger, error) {
lggr.Debug("Initializing loop for Mercury with command", cmd)
mercuryLggr := lggr.Named(fmt.Sprintf("MercuryV%d", feedID.Version())).Named(feedID.String())
envVars, err := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get())
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions plugins/chainlink.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ RUN make install-chainlink
# Install medianpoc binary
RUN make install-medianpoc

# Install the mercury binary
RUN make install-mercury-loop

# Link LOOP Plugin source dirs with simple names
RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds | xargs -I % ln -s % /chainlink-feeds
RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana | xargs -I % ln -s % /chainlink-solana
Expand Down
19 changes: 19 additions & 0 deletions plugins/cmd/chainlink-mercury/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This directory house the Mercury LOOPP

# Running Integration Tests Locally

Running the tests is as simple as
- building this binary
- setting the CL_MERCURY_CMD env var to the *fully resolved* binary path
- running the test(s)


The interesting tests are `TestIntegration_MercuryV*` in ` github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury`

In detail:
```
sh
make install-mercury-loop # builds `mercury` binary in this dir
CL_MERCURY_CMD=<YOUR_REPO_ROOT_DIR>/plugins/cmd/mercury/mercury go test -v -timeout 120s -run ^TestIntegration_MercuryV github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury 2>&1 | tee /tmp/mercury_loop.log
```
File renamed without changes.
File renamed without changes.

0 comments on commit b732394

Please sign in to comment.