1 package dev 2 3 import ( 4 "context" 5 "io" 6 7 "github.com/redhat-developer/odo/pkg/api" 8 ) 9 10 type StartOptions struct { 11 // IgnorePaths are files/directories to ignore when pushing files to the container. 12 IgnorePaths []string 13 // If Debug is true, executes the debug command, or the run command by default. 14 Debug bool 15 // If BuildCommand is set, this will look up the specified build command in the Devfile. Otherwise, it uses the default one. 16 BuildCommand string 17 // If RunCommand is set, this will look up the specified run command in the Devfile and execute it. Otherwise, it uses the default one. 18 RunCommand string 19 // If DebugCommand is set, this will look up the specified debug command in the Devfile and execute it. Otherwise, it uses the default one. 20 DebugCommand string 21 // SkipCommands indicates if commands (either Build, Run or Debug) will be skipped when starting the Dev Session. 22 // If SkipCommands is true, then the specified (or default) Build, Run, or Debug commands will not be executed. 23 SkipCommands bool 24 // if RandomPorts is set, will port forward on random local ports, else uses ports starting at 20001 25 RandomPorts bool 26 // CustomForwardedPorts define custom ports for port forwarding 27 CustomForwardedPorts []api.ForwardedPort 28 // CustomAddress defines a custom local address for port forwarding; default value is 127.0.0.1 29 CustomAddress string 30 // if WatchFiles is set, files changes will trigger a new sync to the container 31 WatchFiles bool 32 // IgnoreLocalhost indicates whether to proceed with port-forwarding regardless of any container ports being bound to the container loopback interface. 33 // Applicable to Podman only. 34 IgnoreLocalhost bool 35 // ForwardLocalhost is a flag indicating if we inject a side container that will make port-forwarding work with container apps listening on the loopback interface. 36 // Applicable to Podman only. 37 ForwardLocalhost bool 38 // Variables to override in the Devfile 39 Variables map[string]string 40 // PushWatcher is a channel that will emit an event when Pushing files to the component is requested 41 PushWatcher <-chan struct{} 42 43 Out io.Writer 44 ErrOut io.Writer 45 } 46 47 type Client interface { 48 // Start the resources defined in context's Devfile on the platform. It then pushes the files in path to the container. 49 // It then watches for any changes to the files under path. 50 // It logs messages and errors to out and errOut. 51 Start( 52 ctx context.Context, 53 options StartOptions, 54 ) error 55 56 Run( 57 ctx context.Context, 58 commandName string, 59 ) error 60 61 // CleanupResources deletes the component created using the context's devfile and writes any outputs to out 62 CleanupResources(ctx context.Context, out io.Writer) error 63 } 64