Skip to content

Commit

Permalink
fix cli runtime bug (#24)
Browse files Browse the repository at this point in the history
* fix cli runtime bug

* update tests

* Update deps.go

---------

Co-authored-by: Vicente Eduardo Ferrer Garcia <[email protected]>
  • Loading branch information
ashpect and viferga authored Jun 20, 2024
1 parent db441ce commit 28d9ec8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cmd/builder/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func NewRuntimeCmd(o *RuntimeOptions) *cobra.Command {
Use: "runtime",
Short: "Build runtime image for MetaCall",
RunE: func(cmd *cobra.Command, args []string) error {
if o.RuntimeImageFlags.MetacallCli {
args = append(args,"node")
}
base := cmd.Context().Value(baseKey{}).(llb.State)
devBase := staging.RemoveBuild(staging.DevBase(base, branch, []string{}))
devBaseLang := staging.RemoveBuild(staging.DevBase(base, branch, args))
Expand All @@ -30,7 +33,7 @@ func NewRuntimeCmd(o *RuntimeOptions) *cobra.Command {
runtime := llb.Merge([]llb.State{runtimeBase, diffed})

if o.RuntimeImageFlags.MetacallCli {
runtime = staging.AddCli(devBase, runtime)
runtime = staging.AddCli(devBaseLang, runtime)
}

runtime, err := o.Run(runtime)
Expand Down
2 changes: 1 addition & 1 deletion pkg/staging/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func RuntimeBase(base llb.State, branch string, args []string) llb.State {
}

func AddCli(src llb.State, dst llb.State) llb.State {
return dst.With(copyFrom(src, "/usr/local/bin/metacallcli*", "/usr/local/bin/metacall"))
return dst.With(copyFrom(src, "/usr/local/bin/metacallcli*", "/usr/local/bin/metacallcli"))
}

func RemoveBuild(state llb.State) llb.State {
Expand Down
2 changes: 1 addition & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test() {
while [ ! "$(docker inspect --format '{{json .State.Health.Status }}' metacall_builder_registry)" = "\"healthy\"" ]; do
sleep 5
done
docker run --rm -v ./test/suites:/test -t localhost:5000/metacall/builder_output sh -c "metacallcli $1" | grep "$2"
docker run --rm -v ./test/suites:/test -t localhost:5000/metacall/builder_output sh -c "metacallcli $1"
${DOCKER_CMD} down
}

Expand Down

0 comments on commit 28d9ec8

Please sign in to comment.