Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Rename flytesnacks flag to sourcesPath (#116)
Browse files Browse the repository at this point in the history
Signed-off-by: Haytham Abuelfutuh <[email protected]>
  • Loading branch information
EngHabu authored Jun 24, 2021
1 parent 6ef7eb2 commit f091117
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ PACKAGE ?=github.com/flyteorg/flytestdlib

LD_FLAGS="-s -w -X $(PACKAGE)/version.Version=$(GIT_VERSION) -X $(PACKAGE)/version.Build=$(GIT_HASH) -X $(PACKAGE)/version.BuildTime=$(TIMESTAMP)"



define PIP_COMPILE
pip-compile $(1) --upgrade --verbose
endef
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/subcommand/sandbox/config_flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/config/subcommand/sandbox/config_flags_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/config/subcommand/sandbox/sandbox_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var (
DefaultConfig = &Config{}
)

// Config
// Config represents the config parameters exposed for the `sandbox` command.
type Config struct {
SnacksRepo string `json:"flytesnacks" pflag:", Path of your flytesnacks repository"`
SourcesPath string `json:"sourcesPath" pflag:",Path to your source code path where flyte workflows and tasks are."`
}
6 changes: 3 additions & 3 deletions cmd/sandbox/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Start will run the flyte sandbox cluster inside a docker container and setup the
Mount your flytesnacks repository code inside sandbox
::
bin/flytectl sandbox start --flytesnacks=$HOME/flyteorg/flytesnacks
bin/flytectl sandbox start --sourcesPath=$HOME/flyteorg/flytesnacks
Usage
`
)
Expand Down Expand Up @@ -65,10 +65,10 @@ func startSandbox(ctx context.Context, cli docker.Docker, reader io.Reader) (*bu
return nil, err
}

if len(sandboxConfig.DefaultConfig.SnacksRepo) > 0 {
if len(sandboxConfig.DefaultConfig.SourcesPath) > 0 {
docker.Volumes = append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
}
Expand Down
28 changes: 14 additions & 14 deletions cmd/sandbox/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -97,10 +97,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -133,10 +133,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -177,10 +177,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -213,10 +213,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -249,10 +249,10 @@ func TestStartSandboxFunc(t *testing.T) {
errCh := make(chan error)
bodyStatus := make(chan container.ContainerWaitOKBody)
mockDocker := &mocks.Docker{}
sandboxConfig.DefaultConfig.SnacksRepo = f.UserHomeDir()
sandboxConfig.DefaultConfig.SourcesPath = f.UserHomeDir()
volumes := append(docker.Volumes, mount.Mount{
Type: mount.TypeBind,
Source: sandboxConfig.DefaultConfig.SnacksRepo,
Source: sandboxConfig.DefaultConfig.SourcesPath,
Target: docker.FlyteSnackDir,
})
mockDocker.OnContainerCreate(ctx, &container.Config{
Expand Down Expand Up @@ -312,7 +312,7 @@ func TestStartSandboxFunc(t *testing.T) {
}).Return(reader, nil)
mockDocker.OnContainerWaitMatch(ctx, mock.Anything, container.WaitConditionNotRunning).Return(bodyStatus, errCh)
docker.Client = mockDocker
sandboxConfig.DefaultConfig.SnacksRepo = ""
sandboxConfig.DefaultConfig.SourcesPath = ""
err := startSandboxCluster(ctx, []string{}, cmdCtx)
assert.Nil(t, err)
})
Expand Down Expand Up @@ -348,7 +348,7 @@ func TestStartSandboxFunc(t *testing.T) {
}).Return(reader, nil)
mockDocker.OnContainerWaitMatch(ctx, mock.Anything, container.WaitConditionNotRunning).Return(bodyStatus, errCh)
docker.Client = mockDocker
sandboxConfig.DefaultConfig.SnacksRepo = ""
sandboxConfig.DefaultConfig.SourcesPath = ""
err := startSandboxCluster(ctx, []string{}, cmdCtx)
assert.NotNil(t, err)
})
Expand Down
4 changes: 2 additions & 2 deletions docs/source/gen/flytectl_sandbox_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Start will run the flyte sandbox cluster inside a docker container and setup the
Mount your flytesnacks repository code inside sandbox
::

bin/flytectl sandbox start --flytesnacks=$HOME/flyteorg/flytesnacks
bin/flytectl sandbox start --sourcesPath=$HOME/flyteorg/flytesnacks
Usage


Expand All @@ -31,7 +31,7 @@ Options

::

--flytesnacks string Path of your flytesnacks repository
--sourcesPath string Path to your source code path where flyte workflows and tasks are.
-h, --help help for start

Options inherited from parent commands
Expand Down

0 comments on commit f091117

Please sign in to comment.