MCPcopy Index your code
hub / github.com/devspace-sh/devspace / startServices

Method startServices

pkg/devspace/devpod/devpod.go:501–558  ·  view source on GitHub ↗
(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, opts Options, parent *tomb.Tomb)

Source from the content-addressed store, hash-verified

499}
500
501func (d *devPod) startServices(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, opts Options, parent *tomb.Tomb) error {
502 pluginErr := hook.ExecuteHooks(ctx, map[string]interface{}{}, "devCommand:before:sync", "dev.beforeSync", "devCommand:before:portForwarding", "dev.beforePortForwarding")
503 if pluginErr != nil {
504 return pluginErr
505 }
506
507 // Start sync
508 syncDone := parent.NotifyGo(func() error {
509 if opts.DisableSync {
510 return nil
511 }
512
513 // add prefix
514 ctx := ctx.WithLogger(ctx.Log().WithPrefixColor("sync ", "yellow+b"))
515 err := sync.StartSync(ctx, devPod, selector, parent)
516 return err
517 })
518
519 // Start Port Forwarding
520 portForwardingDone := parent.NotifyGo(func() error {
521 if opts.DisablePortForwarding {
522 return nil
523 }
524
525 ctx := ctx.WithLogger(ctx.Log().WithPrefixColor("ports ", "yellow+b"))
526 return portforwarding.StartPortForwarding(ctx, devPod, selector, parent)
527 })
528
529 // wait for both to finish
530 <-syncDone
531 <-portForwardingDone
532
533 // Start SSH
534 sshDone := parent.NotifyGo(func() error {
535 // add ssh prefix
536 ctx := ctx.WithLogger(ctx.Log().WithPrefixColor("ssh ", "yellow+b"))
537 return ssh.StartSSH(ctx, devPod, selector, parent)
538 })
539
540 // Start Reverse Commands
541 reverseCommandsDone := parent.NotifyGo(func() error {
542 // add proxy prefix
543 ctx := ctx.WithLogger(ctx.Log().WithPrefixColor("proxy ", "yellow+b"))
544 return proxycommands.StartProxyCommands(ctx, devPod, selector, parent)
545 })
546
547 // wait for ssh and reverse commands
548 <-sshDone
549 <-reverseCommandsDone
550
551 // execute hooks
552 pluginErr = hook.ExecuteHooks(ctx, map[string]interface{}{}, "devCommand:after:sync", "dev.afterSync", "devCommand:after:portForwarding", "dev.afterPortForwarding")
553 if pluginErr != nil {
554 return pluginErr
555 }
556
557 return nil
558}

Callers 1

startMethod · 0.95

Calls 9

ExecuteHooksFunction · 0.92
StartSyncFunction · 0.92
StartPortForwardingFunction · 0.92
StartSSHFunction · 0.92
StartProxyCommandsFunction · 0.92
NotifyGoMethod · 0.80
WithLoggerMethod · 0.65
WithPrefixColorMethod · 0.65
LogMethod · 0.65

Tested by

no test coverage detected