Skip to content

Commit 027f0a4

Browse files
authored
patch error while posting comment too large (#1908)
* patch error while posting comment too large
1 parent a13fefd commit 027f0a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli/pkg/digger/digger.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,19 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
126126
}
127127

128128
if allAppliesSuccess == true && reportFinalStatusToBackend == true {
129+
currentJob := jobs[0]
130+
129131
_, jobPrCommentUrl, err := reporter.Flush()
130132
if err != nil {
131133
log.Printf("error while sending job comments %v", err)
132-
return false, false, fmt.Errorf("error while sending job comments %v", err)
134+
cmt, cmt_err := prService.PublishComment(*currentJob.PullRequestNumber, fmt.Sprintf(":yellow_circle: Warning: failed to post report for project %v, received error: %v.\n\n you may review details in the job logs", currentJob.ProjectName, err))
135+
if cmt_err != nil {
136+
log.Printf("Error while posting error comment: %v", err)
137+
return false, false, fmt.Errorf("failed to post reporter error comment, aborting. Error: %v", err)
138+
}
139+
jobPrCommentUrl = cmt.Url
133140
}
134141

135-
currentJob := jobs[0]
136142
projectNameForBackendReporting := currentJob.ProjectName
137143
// TODO: handle the apply result summary as well to report it to backend. Possibly reporting changed resources as well
138144
// Some kind of generic terraform operation summary might need to be introduced

0 commit comments

Comments
 (0)