@@ -73,8 +73,6 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
7373 slog .Debug ("Variable info" , "TG_PROVIDER_CACHE_DIR" , os .Getenv ("TG_PROVIDER_CACHE_DIR" ))
7474 slog .Debug ("Variable info" , "TERRAGRUNT_PROVIDER_CACHE_DIR" , os .Getenv ("TERRAGRUNT_PROVIDER_CACHE_DIR" ))
7575
76- runStartedAt := time .Now ()
77-
7876 exectorResults := make ([]execution.DiggerExecutorResult , len (jobs ))
7977 appliesPerProject := make (map [string ]bool )
8078
@@ -98,13 +96,9 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
9896 continue
9997 }
10098
101- executorResult , output , err := run (command , job , policyChecker , orgService , SCMOrganisation , SCMrepository , job .PullRequestNumber , job .RequestedBy , reporter , lock , prService , job .Namespace , workingDir , planStorage , appliesPerProject )
99+ executorResult , _ , err := run (command , job , policyChecker , orgService , SCMOrganisation , SCMrepository , job .PullRequestNumber , job .RequestedBy , reporter , lock , prService , job .Namespace , workingDir , planStorage , appliesPerProject )
102100 if err != nil {
103101 slog .Error ("error while running command for project" , "command" , command , "projectname" , job .ProjectName , "error" , err )
104- reportErr := backendApi .ReportProjectRun (SCMOrganisation + "-" + SCMrepository , job .ProjectName , runStartedAt , time .Now (), "FAILED" , command , output )
105- if reportErr != nil {
106- slog .Error ("error reporting project Run err." , "error" , reportErr )
107- }
108102 appliesPerProject [job .ProjectName ] = false
109103 if executorResult != nil {
110104 exectorResults [i ] = * executorResult
@@ -114,10 +108,6 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
114108 }
115109 exectorResults [i ] = * executorResult
116110
117- err = backendApi .ReportProjectRun (SCMOrganisation + "-" + SCMrepository , job .ProjectName , runStartedAt , time .Now (), "SUCCESS" , command , output )
118- if err != nil {
119- slog .Error ("Error reporting project Run" , "error" , err )
120- }
121111 }
122112 }
123113
@@ -573,7 +563,6 @@ func RunJob(
573563 driftNotification * core_drift.Notification ,
574564 workingDir string ,
575565) error {
576- runStartedAt := time .Now ()
577566 SCMOrganisation , SCMrepository := utils .ParseRepoNamespace (repo )
578567 slog .Info ("Running commands for project" , "commands" , job .Commands , "project name" , job .ProjectName )
579568
@@ -591,10 +580,6 @@ func RunJob(
591580 slog .Error ("Error publishing comment." , "error" , err )
592581 }
593582 slog .Error (msg )
594- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "FORBIDDEN" , command , msg )
595- if err != nil {
596- slog .Error ("Error reporting Run." , "error" , err )
597- }
598583 return errors .New (msg )
599584 }
600585
@@ -652,61 +637,37 @@ func RunJob(
652637 if err != nil {
653638 slog .Error ("Failed to send usage report." , "error" , err )
654639 }
655- _ , _ , _ , plan , planJsonOutput , err := diggerExecutor .Plan ()
640+ _ , _ , _ , _ , planJsonOutput , err := diggerExecutor .Plan ()
656641 if err != nil {
657642 msg := fmt .Sprintf ("Failed to Run digger plan command. %v" , err )
658643 slog .Error (msg )
659- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "FAILED" , command , msg )
660- if err != nil {
661- slog .Error ("Error reporting Run." , "error" , err )
662- }
663644 return fmt .Errorf ("%s" , msg )
664645 }
665646 planIsAllowed , messages , err := policyChecker .CheckPlanPolicy (SCMrepository , SCMOrganisation , job .ProjectName , job .ProjectDir , planJsonOutput )
666647 slog .Info (strings .Join (messages , "\n " ))
667648 if err != nil {
668649 msg := fmt .Sprintf ("Failed to validate plan %v" , err )
669650 slog .Error (msg )
670- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "FAILED" , command , msg )
671- if err != nil {
672- slog .Error ("Error reporting Run." , "error" , err )
673- }
674651 return fmt .Errorf ("%s" , msg )
675652 }
676653 if ! planIsAllowed {
677654 msg := fmt .Sprintf ("Plan is not allowed" )
678655 slog .Error (msg )
679- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "FAILED" , command , msg )
680- if err != nil {
681- slog .Error ("Error reporting Run." , "error" , err )
682- }
683656 return fmt .Errorf ("%s" , msg )
684657 } else {
685- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "SUCCESS" , command , plan )
686- if err != nil {
687- slog .Error ("Error reporting Run." , "error" , err )
688- }
689658 }
690659
691660 case "digger apply" :
692661 err := usage .SendUsageRecord (requestedBy , job .EventName , "apply" )
693662 if err != nil {
694663 slog .Error ("Failed to send usage report." , "error" , err )
695664 }
696- _ , _ , output , err : = diggerExecutor .Apply ()
665+ _ , _ , _ , err = diggerExecutor .Apply ()
697666 if err != nil {
698667 msg := fmt .Sprintf ("Failed to Run digger apply command. %v" , err )
699668 slog .Error (msg )
700- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "FAILED" , command , msg )
701- if err != nil {
702- slog .Error ("Error reporting Run." , "error" , err )
703- }
704669 return fmt .Errorf ("%s" , msg )
705670 }
706- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "SUCCESS" , command , output )
707- if err != nil {
708- slog .Error ("Error reporting Run." , "error" , err )
709- }
710671 case "digger destroy" :
711672 err := usage .SendUsageRecord (requestedBy , job .EventName , "destroy" )
712673 if err != nil {
@@ -719,14 +680,10 @@ func RunJob(
719680 }
720681
721682 case "digger drift-detect" :
722- output , err : = runDriftDetection (policyChecker , SCMOrganisation , SCMrepository , job .ProjectName , requestedBy , job .EventName , diggerExecutor , driftNotification )
683+ _ , err = runDriftDetection (policyChecker , SCMOrganisation , SCMrepository , job .ProjectName , requestedBy , job .EventName , diggerExecutor , driftNotification )
723684 if err != nil {
724685 return fmt .Errorf ("failed to Run digger drift-detect command. %v" , err )
725686 }
726- err = backendApi .ReportProjectRun (repo , job .ProjectName , runStartedAt , time .Now (), "SUCCESS" , command , output )
727- if err != nil {
728- slog .Error ("Error reporting Run." , "error" , err )
729- }
730687 }
731688
732689 }
0 commit comments