Skip to content

Commit

Permalink
Move port forwarding after starting application
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jun 29, 2022
1 parent 58ceeff commit e7bc96f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/devfile/adapters/kubernetes/component/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,6 @@ func (a Adapter) Push(parameters common.PushParameters) (err error) {
}
s.End(true)

if podChanged {
a.portForwardClient.StopPortForwarding()
}

err = a.portForwardClient.StartPortForwarding(a.Devfile, a.ComponentName, a.randomPorts, a.errOut)
if err != nil {
return fmt.Errorf("fail starting the port forwarding: %w", err)
}

// PostStart events from the devfile will only be executed when the component
// didn't previously exist
if !componentExists && libdevfile.HasPostStartEvents(a.Devfile) {
Expand Down Expand Up @@ -392,6 +383,15 @@ func (a Adapter) Push(parameters common.PushParameters) (err error) {
err = libdevfile.ExecuteCommandByNameAndKind(a.Devfile, cmdName, cmdKind, &cmdHandler, false)
}

if podChanged {
a.portForwardClient.StopPortForwarding()
}

err = a.portForwardClient.StartPortForwarding(a.Devfile, a.ComponentName, a.randomPorts, a.errOut)
if err != nil {
return fmt.Errorf("fail starting the port forwarding: %w", err)
}

return err
}

Expand Down

0 comments on commit e7bc96f

Please sign in to comment.