Skip to content

Commit

Permalink
chore(local): remove deploy path argument
Browse files Browse the repository at this point in the history
  • Loading branch information
pinglin committed Oct 4, 2023
1 parent c871d4d commit ee3cf29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
13 changes: 3 additions & 10 deletions pkg/cmd/local/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/MakeNowJust/heredoc"
"github.com/cli/safeexec"
"github.com/go-playground/validator/v10"
"github.com/mgutz/ansi"
"github.com/spf13/cobra"

Expand All @@ -36,7 +35,7 @@ type DeployOptions struct {
Config config.Config
MainExecutable string
Interactive bool
Path string `validate:"required,dirpath" example:"/home/inst"`
Path string
checkUpdate func(ExecDep, string, string) (*releaseInfo, error)
isDeployed func(ExecDep) error
}
Expand All @@ -53,8 +52,7 @@ func NewDeployCmd(f *cmdutil.Factory, runF func(*DeployOptions) error) *cobra.Co
Use: "deploy",
Short: "Deploy a local Instill Core instance",
Example: heredoc.Doc(`
# deploy to /home/me/inst
$ inst local deploy --path /home/me/inst
$ inst local deploy
`),
RunE: func(cmd *cobra.Command, args []string) error {
cfg, err := f.Config()
Expand All @@ -79,8 +77,7 @@ func NewDeployCmd(f *cmdutil.Factory, runF func(*DeployOptions) error) *cobra.Co
if err != nil {
logger.Error("Couldn't get Home directory", err)
}
dir := filepath.Join(d, ".local", "inst") + string(os.PathSeparator)
cmd.Flags().StringVarP(&opts.Path, "path", "p", dir, "Destination directory")
opts.Path = filepath.Join(d, ".local", "instill") + string(os.PathSeparator)

return cmd
}
Expand All @@ -90,10 +87,6 @@ func runDeploy(opts *DeployOptions) error {
var err error
path := opts.Path
start := time.Now()
err = validator.New().Struct(opts)
if err != nil {
return fmt.Errorf("ERROR: wrong input, %w", err)
}

// check the deps
apps := []string{"bash", "docker", "make", "git", "jq", "grep", "curl"}
Expand Down
14 changes: 3 additions & 11 deletions pkg/cmd/local/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestLocalDeployCmd(t *testing.T) {
if err != nil {
logger.Error("Couldn't get home directory", err)
}
dir := filepath.Join(d, ".local", "inst") + string(os.PathSeparator)
dir := filepath.Join(d, ".local", "instill") + string(os.PathSeparator)
tests := []struct {
name string
stdin string
Expand All @@ -37,14 +37,6 @@ func TestLocalDeployCmd(t *testing.T) {
},
isErr: false,
},
{
name: "local deploy --path /home",
input: " --path /home",
output: DeployOptions{
Path: "/home",
},
isErr: false,
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -165,11 +157,11 @@ func TestLocalDeployCmdRun(t *testing.T) {
Config: config.ConfigStub{},
checkUpdate: checkFoUpdateMock,
isDeployed: func(ed ExecDep) error {
return nil
return fmt.Errorf("")
},
},
stdout: "",
isErr: true,
isErr: false,
},
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/cmd/local/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strings"

"github.com/MakeNowJust/heredoc"
"github.com/go-playground/validator/v10"
"github.com/spf13/cobra"

"github.com/instill-ai/cli/internal/config"
Expand Down Expand Up @@ -68,10 +67,6 @@ func NewStatusCmd(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Co
// TODO separate health statuses per API
func runStatus(opts *StatusOptions) error {

if err := validator.New().Struct(opts); err != nil {
return fmt.Errorf("ERROR: wrong input, %w", err)
}

deployed := "NO"
started := "NO"
healthy := "NO"
Expand Down

0 comments on commit ee3cf29

Please sign in to comment.