Skip to content

Commit

Permalink
Absolute path for Source dir (flyteorg#126)
Browse files Browse the repository at this point in the history
Signed-off-by: Ketan Umare <[email protected]>
  • Loading branch information
kumare3 authored and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent 50feb15 commit 2aa9f27
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flytectl/cmd/sandbox/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"

"github.com/flyteorg/flytectl/pkg/docker"

Expand Down Expand Up @@ -67,19 +68,25 @@ func startSandbox(ctx context.Context, cli docker.Docker, reader io.Reader) (*bu
}

if len(sandboxConfig.DefaultConfig.Source) > 0 {
source, err := filepath.Abs(sandboxConfig.DefaultConfig.Source)
if err != nil {
return nil, err
}
docker.Volumes = append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.Source,
Source: source,
Target: docker.FlyteSnackDir,
})
}

fmt.Printf("%v pulling docker image %s\n", emoji.Whale, docker.ImageName)
os.Setenv("KUBECONFIG", docker.Kubeconfig)
os.Setenv("FLYTECTL_CONFIG", docker.FlytectlConfig)
if err := docker.PullDockerImage(ctx, cli, docker.ImageName); err != nil {
return nil, err
}

fmt.Printf("%v booting Flyte-sandbox container\n", emoji.FactoryWorker)
exposedPorts, portBindings, _ := docker.GetSandboxPorts()
ID, err := docker.StartContainer(ctx, cli, docker.Volumes, exposedPorts, portBindings, docker.FlyteSandboxClusterName, docker.ImageName)
if err != nil {
Expand Down

0 comments on commit 2aa9f27

Please sign in to comment.