Skip to content

Commit

Permalink
Merge pull request #2223 from FabianKramm/main
Browse files Browse the repository at this point in the history
refactor: allow arbitrary pipeline args
  • Loading branch information
FabianKramm authored Aug 15, 2022
2 parents 6f85879 + b0b323e commit 1b97023
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ devspace deploy
devspace deploy -n some-namespace
devspace deploy --kube-context=deploy-context
#######################################################`,
Args: cobra.NoArgs,
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd, args, f, "deployCommand")
},
Expand Down
1 change: 0 additions & 1 deletion cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func NewDevCmd(f factory.Factory, globalFlags *flags.GlobalFlags, rawConfig *Raw
#######################################################
Starts your project in development mode
#######################################################`,
Args: cobra.NoArgs,
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd, args, f, "devCommand")
},
Expand Down
1 change: 0 additions & 1 deletion cmd/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Deletes the deployed kubernetes resources:
devspace purge
#######################################################`,
Args: cobra.NoArgs,
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd, args, f, "purgeCommand")
},
Expand Down
15 changes: 4 additions & 11 deletions cmd/run_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,11 @@ func (cmd *RunPipelineCmd) RunDefault(f factory.Factory) error {

// Run executes the command logic
func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory.Factory, hookName string) error {
dashArgs := []string{}
if cobraCmd != nil && cobraCmd.ArgsLenAtDash() > -1 {
dashArgs = args[cobraCmd.ArgsLenAtDash():]
args = args[:cobraCmd.ArgsLenAtDash()]
}

if len(args) > 1 {
return fmt.Errorf("please specify only 1 pipeline to execute (got %v). E.g. devspace run-pipeline my-pipe -- other args", args)
} else if len(args) == 0 && cmd.Pipeline == "" {
if len(args) == 0 && cmd.Pipeline == "" {
return fmt.Errorf("please specify a pipeline through --pipeline or argument")
} else if len(args) == 1 && cmd.Pipeline == "" {
} else if len(args) > 0 && cmd.Pipeline == "" {
cmd.Pipeline = args[0]
args = args[1:]
}

if cmd.Log == nil {
Expand Down Expand Up @@ -259,7 +252,7 @@ func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory
}

return runWithHooks(ctx, hookName, func() error {
return runPipeline(ctx, dashArgs, options)
return runPipeline(ctx, args, options)
})
}

Expand Down

0 comments on commit 1b97023

Please sign in to comment.