(ctx devspacecontext.Context, devPods []string, options Options)
| 83 | } |
| 84 | |
| 85 | func (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 | |
| 132 | type DevPodAlreadyExists struct{} |
| 133 |
nothing calls this directly
no test coverage detected