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

Method StartMultiple

pkg/devspace/devpod/manager.go:85–130  ·  view source on GitHub ↗
(ctx devspacecontext.Context, devPods []string, options Options)

Source from the content-addressed store, hash-verified

83}
84
85func (d *devPodManager) StartMultiple(ctx devspacecontext.Context, devPods []string, options Options) error {
86 devCtx, _ := values.DevContextFrom(ctx.Context())
87 select {
88 case <-devCtx.Done():
89 return devCtx.Err()
90 default:
91 }
92
93 cancelCtx, cancel := context.WithCancel(devCtx)
94 d.m.Lock()
95 d.cancels = append(d.cancels, cancel)
96 d.m.Unlock()
97 ctx = ctx.WithContext(cancelCtx)
98
99 initChans := []chan struct{}{}
100 errors := make(chan error, len(ctx.Config().Config().Dev))
101 for devPodName, devPod := range ctx.Config().Config().Dev {
102 if len(devPods) > 0 && !stringutil.Contains(devPods, devPodName) {
103 continue
104 }
105
106 initChan := make(chan struct{})
107 initChans = append(initChans, initChan)
108 go func(devPod *latest.DevPod) {
109 defer close(initChan)
110
111 _, err := d.Start(ctx, devPod, options)
112 if err != nil {
113 errors <- err
114 }
115 }(devPod)
116 }
117
118 aggregatedErrors := []error{}
119 for _, initChan := range initChans {
120 select {
121 case err := <-errors:
122 cancel()
123 aggregatedErrors = append(aggregatedErrors, err)
124 <-initChan
125 case <-initChan:
126 }
127 }
128
129 return utilerrors.NewAggregate(aggregatedErrors)
130}
131
132type DevPodAlreadyExists struct{}
133

Callers

nothing calls this directly

Calls 11

StartMethod · 0.95
DevContextFromFunction · 0.92
ContainsFunction · 0.92
closeFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
ContextMethod · 0.65
DoneMethod · 0.65
WithContextMethod · 0.65
ConfigMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected