@@ -150,30 +150,34 @@ func (in *stackRunController) completeStackRun(status gqlclient.StackStatus, sta
150150 var output []* gqlclient.StackOutputAttributes
151151 var err error
152152
153- if in .tool != nil {
154- state , err = in .tool .State ()
155- if err != nil {
156- klog .ErrorS (err , "could not prepare state attributes" )
157- }
153+ serviceErrorAttributes := make ([]* gqlclient.ServiceErrorAttributes , 0 )
154+ if stackRunErr != nil {
155+ serviceErrorAttributes = append (serviceErrorAttributes , & gqlclient.ServiceErrorAttributes {
156+ Source : "harness" ,
157+ Message : stackRunErr .Error (),
158+ })
159+ }
158160
159- klog .V (log .LogLevelTrace ).InfoS ("generated console state" , "state" , state )
161+ if in .tool == nil {
162+ return stackrun .CompleteStackRun (in .consoleClient , in .stackRunID , & gqlclient.StackRunAttributes {
163+ Errors : serviceErrorAttributes ,
164+ })
165+ }
160166
167+ state , err = in .tool .State ()
168+ if err != nil {
169+ klog .ErrorS (err , "could not prepare state attributes" )
170+ }
171+ klog .V (log .LogLevelTrace ).InfoS ("generated console state" , "state" , state )
172+
173+ if ! in .stackRun .DryRun {
161174 output , err = in .tool .Output ()
162175 if err != nil {
163176 klog .ErrorS (err , "could not prepare output attributes" )
164177 }
165-
166178 klog .V (log .LogLevelTrace ).InfoS ("generated console output" , "output" , output )
167179 }
168180
169- serviceErrorAttributes := make ([]* gqlclient.ServiceErrorAttributes , 0 )
170- if stackRunErr != nil {
171- serviceErrorAttributes = append (serviceErrorAttributes , & gqlclient.ServiceErrorAttributes {
172- Source : "harness" ,
173- Message : stackRunErr .Error (),
174- })
175- }
176-
177181 return stackrun .CompleteStackRun (in .consoleClient , in .stackRunID , & gqlclient.StackRunAttributes {
178182 Errors : serviceErrorAttributes ,
179183 Output : output ,
0 commit comments