Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
feat: remove plugin build_from
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantpaez committed Aug 29, 2023
1 parent 73db22e commit c6e0530
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 941 deletions.
31 changes: 0 additions & 31 deletions cli/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func PluginCmd(d daemon.Daemon) *cobra.Command {
instanceId string
noDestroyImage bool
host bool
buildArgs map[string]string
pluginArgs []string
volumes []string
)
Expand Down Expand Up @@ -48,23 +47,6 @@ func PluginCmd(d daemon.Daemon) *cobra.Command {
This will mount the /tmp directory of the host inside the plugin container at
/tmp, and the plugin-v volume at /data.
- Using build arguments:
For the cases that the plugin is build from a relative path inside the package
or a remote context, the plugin image is built each time the plugin is executed.
To pass build arguments to the plugin image, use the "--build-arg" flag, which
is a map of key-value pairs. For example:
$ eigenlayer plugin \
--build-arg arg1=value1 \
--build-arg arg2=value2 \
mock-avs-default \
--port 8080
The "--build-arg" flag can be used multiple times to pass multiple build
arguments. Should be declared before the instance ID to be recognized as a
plugin build argument, and not as a plugin execution argument.
`,

PreRunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -78,19 +60,11 @@ func PluginCmd(d daemon.Daemon) *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
var bArgs map[string]*string
if buildArgs != nil {
bArgs = make(map[string]*string)
for k, v := range buildArgs {
bArgs[k] = stringPtr(v)
}
}
runPluginOptions := daemon.RunPluginOptions{
NoDestroyImage: noDestroyImage,
HostNetwork: host,
Volumes: make(map[string]string),
Binds: make(map[string]string),
BuildArgs: bArgs,
}
for _, v := range volumes {
vSplit := strings.Split(v, ":")
Expand All @@ -112,11 +86,6 @@ func PluginCmd(d daemon.Daemon) *cobra.Command {
cmd.Flags().BoolVar(&noDestroyImage, "no-rm-image", false, "Do not remove the plugin image after plugin execution")
cmd.Flags().BoolVar(&host, "host", false, "Run the plugin on the host network instead of the AVS network")
cmd.Flags().StringSliceVarP(&volumes, "volume", "v", []string{}, "Bind mount a volume. Format: <volume_name>:<path> or <path>:<path>. Can be specified multiple times")
cmd.Flags().StringToStringVar(&buildArgs, "build-arg", nil, "arguments to pass to the plugin image build")
cmd.Flags().SetInterspersed(false)
return &cmd
}

func stringPtr(s string) *string {
return &s
}
26 changes: 0 additions & 26 deletions cli/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,32 +166,6 @@ func TestPluginCmd(t *testing.T) {
)
},
},
func(t *testing.T) testCase {
return testCase{
name: "--build-arg flag",
args: []string{"--build-arg", "arg1=value1", "--build-arg", "arg2=value2", "instance1", "arg1"},
err: nil,
daemonMock: func(d *daemonMock.MockDaemon) {
gomock.InOrder(
d.EXPECT().HasInstance("instance1").Return(true),
d.EXPECT().RunPlugin("instance1", []string{"arg1"}, gomock.Any()).DoAndReturn(func(instanceId string, args []string, options daemon.RunPluginOptions) error {
assert.Len(t, options.BuildArgs, 2)
for k, v := range options.BuildArgs {
switch k {
case "arg1":
assert.Equal(t, "value1", *v)
case "arg2":
assert.Equal(t, "value2", *v)
default:
assert.Fail(t, "unexpected build arg")
}
}
return nil
}),
)
},
}
}(t),
}

for _, tc := range ts {
Expand Down
4 changes: 2 additions & 2 deletions e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

const (
mockAVSRepo = "https://github.com/NethermindEth/mock-avs"
latestMockAVSVersion = "v5.0.0"
latestMockAVSCommitHash = "933143894724e0c3867a2c9469b837d49ee6e063"
latestMockAVSVersion = "v5.1.0"
latestMockAVSCommitHash = "75c0bf6f08bb2bf5a0404061a94e0fe0366c6f4c"
)

func TestInstall_WithoutArguments(t *testing.T) {
Expand Down
Loading

0 comments on commit c6e0530

Please sign in to comment.