@@ -465,7 +465,7 @@ func Run(options ...RunOption) {
465465
466466	if  cfg .isHeadless () {
467467		wg .Add (1 )
468- 		go  stopWhenTasksAreDone (ctx ,  & wg , shutdown , tasksSuccessChan )
468+ 		go  stopWhenTasksAreDone (& wg ,  cfg , shutdown , tasksSuccessChan )
469469	} else  if  ! opts .RunGP  {
470470		wg .Add (1 )
471471		go  portMgmt .Run (ctx , & wg )
@@ -1593,15 +1593,20 @@ func tunnelOverSSH(ctx context.Context, tunneled *ports.TunneledPortsService, ne
15931593	<- ctx .Done ()
15941594}
15951595
1596- func  stopWhenTasksAreDone (ctx  context. Context ,  wg  * sync.WaitGroup , shutdown  chan  ShutdownReason , successChan  <- chan  taskSuccess ) {
1596+ func  stopWhenTasksAreDone (wg  * sync.WaitGroup ,  cfg   * Config , shutdown  chan  ShutdownReason , successChan  <- chan  taskSuccess ) {
15971597	defer  wg .Done ()
15981598	defer  close (shutdown )
15991599
16001600	success  :=  <- successChan 
16011601	if  success .Failed () {
1602+ 		var  msg  []byte 
1603+ 		if  cfg .isImageBuild () {
1604+ 			msg  =  []byte ("image build failed with "  +  string (success ) +  ". For further logs, try executing `gp validate` inside of a workspace" )
1605+ 		} else  {
1606+ 			msg  =  []byte ("headless task failed: "  +  string (success ) +  ". I have no idea if this is an image build or not 🤷♂️" )
1607+ 		}
16021608		// we signal task failure via kubernetes termination log 
1603- 		msg  :=  []byte ("headless task failed: "  +  string (success ))
1604- 		err  :=  ioutil .WriteFile ("/dev/termination-log" , msg , 0o644 )
1609+ 		err  :=  os .WriteFile ("/dev/termination-log" , msg , 0o644 )
16051610		if  err  !=  nil  {
16061611			log .WithError (err ).Error ("err while writing termination log" )
16071612		}
0 commit comments