77 "io"
88
99 devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
10- "github.com/loft-sh/devspace/pkg/devspace/pipeline/engine"
1110 "github.com/loft-sh/devspace/pkg/devspace/pipeline/engine/basichandler"
1211 "github.com/loft-sh/devspace/pkg/devspace/pipeline/engine/pipelinehandler/commands"
1312 enginetypes "github.com/loft-sh/devspace/pkg/devspace/pipeline/engine/types"
@@ -19,11 +18,17 @@ import (
1918
2019// PipelineCommands are commands that can only be run within a pipeline and have special functionality in there
2120var PipelineCommands = map [string ]func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
21+ "exec_container" : func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
22+ return commands .ExecContainer (devCtx , args )
23+ },
2224 "get_image" : func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
2325 return commands .GetImage (devCtx , args )
2426 },
2527 "run_command" : func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
26- return runCommand (devCtx , pipeline , args )
28+ return commands .RunCommand (devCtx , pipeline , args , NewPipelineExecHandler )
29+ },
30+ "run_default_pipeline" : func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
31+ return commands .RunDefaultPipeline (devCtx , pipeline , args , NewPipelineExecHandler )
2732 },
2833 "run_pipelines" : func (devCtx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
2934 return commands .RunPipelines (devCtx , pipeline , args )
@@ -128,27 +133,6 @@ func (e *execHandler) executePipelineCommand(ctx context.Context, command string
128133 return true , handleError (ctx , command , commandFn ())
129134}
130135
131- func runCommand (ctx * devspacecontext.Context , pipeline types.Pipeline , args []string ) error {
132- hc := interp .HandlerCtx (ctx .Context )
133- if len (args ) == 0 {
134- return fmt .Errorf ("please specify a command to run" )
135- }
136-
137- // try to find command
138- for _ , command := range ctx .Config .Config ().Commands {
139- if command .Name == args [0 ] {
140- if len (command .Args ) > 0 {
141- return fmt .Errorf ("calling commands that use args is not supported currently" )
142- }
143-
144- _ , err := engine .ExecutePipelineShellCommand (ctx .Context , command .Command , args [1 :], ctx .WorkingDir , false , hc .Stdout , hc .Stderr , hc .Stdin , hc .Env , NewPipelineExecHandler (ctx , hc .Stdout , pipeline ))
145- return err
146- }
147- }
148-
149- return fmt .Errorf ("couldn't find command %v" , args [0 ])
150- }
151-
152136func handleError (ctx context.Context , command string , err error ) error {
153137 if err == nil {
154138 return interp .NewExitStatus (0 )
0 commit comments