@@ -183,14 +183,19 @@ func build(
183183 return fmt .Errorf ("creating builder pod (%s)" , err )
184184 }
185185
186- if err := waitForPod (kubeClient , newPod .Namespace , newPod .Name , conf .SessionIdleInterval (), conf .BuilderPodTickDuration (), conf .BuilderPodWaitDuration ()); err != nil {
186+ pw := k8s .NewPodWatcher (kubeClient , "deis" )
187+ stopCh := make (chan struct {})
188+ defer close (stopCh )
189+ go pw .Controller .Run (stopCh )
190+
191+ if err := waitForPod (pw , newPod .Namespace , newPod .Name , conf .SessionIdleInterval (), conf .BuilderPodTickDuration (), conf .BuilderPodWaitDuration ()); err != nil {
187192 return fmt .Errorf ("watching events for builder pod startup (%s)" , err )
188193 }
189194
190195 req := kubeClient .Get ().Namespace (newPod .Namespace ).Name (newPod .Name ).Resource ("pods" ).SubResource ("log" ).VersionedParams (
191196 & api.PodLogOptions {
192197 Follow : true ,
193- }, api .Scheme )
198+ }, api .ParameterCodec )
194199
195200 rc , err := req .Stream ()
196201 if err != nil {
@@ -213,7 +218,7 @@ func build(
213218 )
214219 // check the state and exit code of the build pod.
215220 // if the code is not 0 return error
216- if err := waitForPodEnd (kubeClient , newPod .Namespace , newPod .Name , conf .BuilderPodTickDuration (), conf .BuilderPodWaitDuration ()); err != nil {
221+ if err := waitForPodEnd (pw , newPod .Namespace , newPod .Name , conf .BuilderPodTickDuration (), conf .BuilderPodWaitDuration ()); err != nil {
217222 return fmt .Errorf ("error getting builder pod status (%s)" , err )
218223 }
219224 log .Debug ("Done" )
0 commit comments