From 28d9ec8dc43beee8bd8c835bc73312a0745886a2 Mon Sep 17 00:00:00 2001 From: Ashish <93992470+ashpect@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:17:56 +0530 Subject: [PATCH] fix cli runtime bug (#24) * fix cli runtime bug * update tests * Update deps.go --------- Co-authored-by: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> --- cmd/builder/runtime.go | 5 ++++- pkg/staging/deps.go | 2 +- test/test.sh | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/builder/runtime.go b/cmd/builder/runtime.go index a3f5276..df1dc28 100644 --- a/cmd/builder/runtime.go +++ b/cmd/builder/runtime.go @@ -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)) @@ -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) diff --git a/pkg/staging/deps.go b/pkg/staging/deps.go index d59d382..9c9fb81 100644 --- a/pkg/staging/deps.go +++ b/pkg/staging/deps.go @@ -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 { diff --git a/test/test.sh b/test/test.sh index 1ec873a..25ba921 100755 --- a/test/test.sh +++ b/test/test.sh @@ -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 }