@@ -2,6 +2,11 @@ package execution
2
2
3
3
import (
4
4
"fmt"
5
+ "github.com/diggerhq/digger/libs/iac_utils"
6
+ "github.com/diggerhq/digger/libs/locking"
7
+ "github.com/diggerhq/digger/libs/scheduler"
8
+ "github.com/diggerhq/digger/libs/storage"
9
+ "github.com/samber/lo"
5
10
"log/slog"
6
11
"os"
7
12
"path"
@@ -10,12 +15,6 @@ import (
10
15
"strconv"
11
16
"strings"
12
17
13
- "github.com/diggerhq/digger/libs/iac_utils"
14
- "github.com/diggerhq/digger/libs/locking"
15
- "github.com/diggerhq/digger/libs/scheduler"
16
- "github.com/diggerhq/digger/libs/storage"
17
- "github.com/samber/lo"
18
-
19
18
"github.com/diggerhq/digger/libs/comment_utils/reporting"
20
19
configuration "github.com/diggerhq/digger/libs/digger_config"
21
20
)
@@ -247,11 +246,13 @@ func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, strin
247
246
var stdout , stderr string
248
247
isEmptyPlan , stdout , stderr , err = d .TerraformExecutor .Plan (planArgs , d .CommandEnvVars , d .PlanPathProvider .LocalPlanFilePath (), d .PlanStage .FilterRegex )
249
248
if err != nil {
249
+ reportTerraformError (d .Reporter , stderr )
250
250
return nil , false , false , "" , "" , fmt .Errorf ("error executing plan: %v, stdout: %v, stderr: %v" , err , stdout , stderr )
251
251
}
252
252
253
253
plan , terraformPlanOutputJsonString , planSummary , isEmptyPlan , err = d .postProcessPlan (stdout )
254
254
if err != nil {
255
+ reportError (d .Reporter , err .Error ())
255
256
slog .Debug ("error post processing plan" ,
256
257
"error" , err ,
257
258
"plan" , plan ,
@@ -275,6 +276,7 @@ func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, strin
275
276
d .RunEnvVars ["DIGGER_PLANFILE" ] = d .PlanPathProvider .LocalPlanFilePath ()
276
277
_ , _ , err := d .CommandRunner .Run (d .ProjectPath , step .Shell , commands , d .RunEnvVars )
277
278
if err != nil {
279
+ reportError (d .Reporter , err .Error ())
278
280
return nil , false , false , "" , "" , fmt .Errorf ("error running command: %v" , err )
279
281
}
280
282
}
@@ -283,10 +285,12 @@ func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, strin
283
285
if ! hasPlanStep {
284
286
rawPlan , _ , err := d .TerraformExecutor .Show (make ([]string , 0 ), d .CommandEnvVars , d .PlanPathProvider .LocalPlanFilePath (), false )
285
287
if err != nil {
288
+ reportTerraformError (d .Reporter , err .Error ())
286
289
return nil , false , false , "" , "" , fmt .Errorf ("error running terraform show: %v" , err )
287
290
}
288
291
plan , terraformPlanOutputJsonString , planSummary , isEmptyPlan , err = d .postProcessPlan (rawPlan )
289
292
if err != nil {
293
+ reportError (d .Reporter , err .Error ())
290
294
slog .Debug ("error post processing plan" ,
291
295
"error" , err ,
292
296
"plan" , plan ,
0 commit comments