@@ -123,7 +123,7 @@ func ExecuteTaskInEnvironment(task Task, prePost string) error {
123123 fmt .Printf ("##############################################\n BEGIN %s %s\n ##############################################\n " , prePost , task .Name )
124124 st := time .Now ()
125125
126- err := ExecTaskInPod (task , command , false ) //(task.Service, task.Namespace, command, false, task.Container, task.ScaleWaitTime, task.ScaleMaxIterations)
126+ err := ExecTaskInPod (task , command , false )
127127
128128 if err != nil {
129129 fmt .Printf ("Failed to execute task `%v` due to reason `%v`\n " , task .Name , err .Error ())
@@ -270,15 +270,28 @@ func ExecTaskInPod(
270270 return fmt .Errorf ("error while creating Executor: %v" , err )
271271 }
272272
273- err = exec .Stream (remotecommand.StreamOptions {
273+ // After replacing exec.Stream with exec.StreamWithContext, we can now pass a context to the stream
274+ // this will allow us, eventually, to set limits on how long the exec can run, among other things.
275+ err = exec .StreamWithContext (context .TODO (), remotecommand.StreamOptions {
274276 Stdout : os .Stdout ,
275277 Stderr : os .Stderr ,
276278 Tty : tty ,
277279 })
280+
278281 if err != nil {
279282 return fmt .Errorf ("Error returned: %v" , err )
280283 }
281284
285+ if debug {
286+ fmt .Printf ("Task '%v' executed in pod %v \n " , task .Name , pod .Name )
287+ if numIterations > 1 {
288+ fmt .Printf ("Scaled up pods to %d replicas before executing task\n " , numIterations )
289+ }
290+ if task .ScaleWaitTime > 0 {
291+ fmt .Printf ("Waited %d seconds before executing task\n " , task .ScaleWaitTime )
292+ }
293+ }
294+
282295 return nil
283296
284297}
0 commit comments