(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod)
| 129 | } |
| 130 | |
| 131 | func matchesImageSelector(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod) ([]string, error) { |
| 132 | var matchingContainers []string |
| 133 | if devPod.ImageSelector != "" { |
| 134 | imageSelector, err := runtimevar.NewRuntimeResolver(ctx.WorkingDir(), true).FillRuntimeVariablesAsImageSelector(ctx.Context(), devPod.ImageSelector, ctx.Config(), ctx.Dependencies()) |
| 135 | if err != nil { |
| 136 | return nil, err |
| 137 | } |
| 138 | |
| 139 | loader.EachDevContainer(devPod, func(devContainer *latest.DevContainer) bool { |
| 140 | for i := range pod.Spec.Containers { |
| 141 | if devContainer.Container != "" && pod.Spec.Containers[i].Name != devContainer.Container { |
| 142 | continue |
| 143 | } |
| 144 | |
| 145 | if imageselector.CompareImageNames(imageSelector.Image, pod.Spec.Containers[i].Image) { |
| 146 | matchingContainers = append(matchingContainers, pod.Spec.Containers[i].Name) |
| 147 | break |
| 148 | } |
| 149 | } |
| 150 | return true |
| 151 | }) |
| 152 | |
| 153 | return matchingContainers, nil |
| 154 | } |
| 155 | |
| 156 | return matchingContainers, nil |
| 157 | } |
no test coverage detected