Skip to content

Commit

Permalink
Fix: Move randomPorts and errOut as PushParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jul 5, 2022
1 parent 3e51559 commit f6c7d54
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
4 changes: 4 additions & 0 deletions pkg/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (o *DevClient) Watch(
buildCommand string,
runCommand string,
variables map[string]string,
randomPorts bool,
errOut io.Writer,
) error {
envSpecificInfo, err := envinfo.NewEnvSpecificInfo(path)
if err != nil {
Expand All @@ -116,6 +118,8 @@ func (o *DevClient) Watch(
DevfileRunCmd: runCommand,
DebugPort: envSpecificInfo.GetDebugPort(),
Variables: variables,
RandomPorts: randomPorts,
ErrOut: errOut,
}

return o.watchClient.WatchAndPush(out, watchParameters, ctx)
Expand Down
2 changes: 2 additions & 0 deletions pkg/dev/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type Client interface {
buildCommand string,
runCommand string,
variables map[string]string,
randomPorts bool,
errOut io.Writer,
) error
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/dev/mock.go

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

27 changes: 25 additions & 2 deletions pkg/odo/cli/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,17 @@ func (o *DevOptions) Run(ctx context.Context) (err error) {
"odo version: "+version.VERSION)

log.Section("Deploying to the cluster in developer mode")
err = o.clientset.DevClient.Start(devFileObj, platformContext, o.ignorePaths, path, o.debugFlag, o.buildCommandFlag, o.runCommandFlag, o.randomPortsFlag, o.errOut)
err = o.clientset.DevClient.Start(
devFileObj,
platformContext,
o.ignorePaths,
path,
o.debugFlag,
o.buildCommandFlag,
o.runCommandFlag,
o.randomPortsFlag,
o.errOut,
)
if err != nil {
return err
}
Expand All @@ -245,7 +255,20 @@ func (o *DevOptions) Run(ctx context.Context) (err error) {
randomPorts: o.randomPortsFlag,
errOut: o.errOut,
}
err = o.clientset.DevClient.Watch(devFileObj, path, o.ignorePaths, o.out, &d, o.ctx, o.debugFlag, o.buildCommandFlag, o.runCommandFlag, o.variables)
err = o.clientset.DevClient.Watch(
devFileObj,
path,
o.ignorePaths,
o.out,
&d,
o.ctx,
o.debugFlag,
o.buildCommandFlag,
o.runCommandFlag,
o.variables,
o.randomPortsFlag,
o.errOut,
)
}
return err
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ type WatchParameters struct {
DebugPort int
// Variables override Devfile variables
Variables map[string]string
// RandomPorts is true to forward containers ports on local random ports
RandomPorts bool
// ErrOut is a Writer to output forwarded port information
ErrOut io.Writer
}

// evaluateChangesFunc evaluates any file changes for the events by ignoring the files in fileIgnores slice and removes
Expand Down Expand Up @@ -351,6 +355,8 @@ func processEvents(changedFiles, deletedPaths []string, parameters WatchParamete
EnvSpecificInfo: *parameters.EnvSpecificInfo,
Debug: parameters.Debug,
DebugPort: parameters.DebugPort,
RandomPorts: parameters.RandomPorts,
ErrOut: parameters.ErrOut,
}
err := parameters.DevfileWatchHandler(pushParams, parameters)
if err != nil {
Expand Down

0 comments on commit f6c7d54

Please sign in to comment.