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

Function StartSSH

pkg/devspace/services/ssh/ssh.go:30–54  ·  view source on GitHub ↗

StartSSH starts the ssh functionality

(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, parent *tomb.Tomb)

Source from the content-addressed store, hash-verified

28
29// StartSSH starts the ssh functionality
30func StartSSH(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, parent *tomb.Tomb) (retErr error) {
31 if ctx == nil || ctx.Config() == nil || ctx.Config().Config() == nil {
32 return fmt.Errorf("DevSpace config is nil")
33 }
34
35 // init done array is used to track when sync was initialized
36 initDoneArray := []chan struct{}{}
37 loader.EachDevContainer(devPod, func(devContainer *latest.DevContainer) bool {
38 if devContainer.SSH == nil || (devContainer.SSH.Enabled != nil && !*devContainer.SSH.Enabled) {
39 return true
40 }
41
42 initDone := parent.NotifyGo(func() error {
43 return startSSH(ctx, devPod.Name, string(devContainer.Arch), devContainer.SSH, selector.WithContainer(devContainer.Container), parent)
44 })
45 initDoneArray = append(initDoneArray, initDone)
46 return true
47 })
48
49 // wait for init chans to be finished
50 for _, initDone := range initDoneArray {
51 <-initDone
52 }
53 return nil
54}
55
56func startSSH(ctx devspacecontext.Context, name, arch string, sshConfig *latest.SSH, selector targetselector.TargetSelector, parent *tomb.Tomb) error {
57 if ctx.IsDone() {

Callers 1

startServicesMethod · 0.92

Calls 6

EachDevContainerFunction · 0.92
startSSHFunction · 0.85
NotifyGoMethod · 0.80
ConfigMethod · 0.65
WithContainerMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected