Skip to content

Commit ea47217

Browse files
motatoescursoragentmo-digger
authored
Investigate bug root cause (#2005)
* Fix nil pointer dereference in comment updater for terragrunt projects Co-authored-by: mo <[email protected]> * Fix nil pointer dereference in comment updater workflow URL handling Co-authored-by: mo <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: mo <[email protected]>
1 parent ec77f5b commit ea47217

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ee/cli/pkg/comment_updater/updater.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ func (a AdvancedCommentUpdater) UpdateComment(jobs []scheduler.SerializedJob, pr
3838
}
3939
isPlan := jobSpec.IsPlan()
4040

41+
// Safe handling of WorkflowRunUrl pointer
42+
workflowUrl := "#"
43+
if job.WorkflowRunUrl != nil {
44+
workflowUrl = *job.WorkflowRunUrl
45+
}
46+
4147
message = message + fmt.Sprintf("<!-- PROJECTHOLDER %v -->\n", job.ProjectName)
42-
message = message + fmt.Sprintf("%v **%v** <a href='%v'>%v</a>%v %v\n", job.Status.ToEmoji(), jobSpec.ProjectName, *job.WorkflowRunUrl, job.Status.ToString(), job.ResourcesSummaryString(isPlan), DriftSummaryString(job.ProjectName, issuesMap))
48+
message = message + fmt.Sprintf("%v **%v** <a href='%v'>%v</a>%v %v\n", job.Status.ToEmoji(), jobSpec.ProjectName, workflowUrl, job.Status.ToString(), job.ResourcesSummaryString(isPlan), DriftSummaryString(job.ProjectName, issuesMap))
4349
message = message + fmt.Sprintf("<!-- PROJECTHOLDEREND %v -->\n", job.ProjectName)
4450
}
4551

libs/comment_utils/summary/updater.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ func (b BasicCommentUpdater) UpdateComment(jobs []scheduler.SerializedJob, prNum
4141
for i, job := range jobs {
4242
jobSpec := jobSpecs[i]
4343
prCommentUrl := job.PRCommentUrl
44+
45+
// Safe handling of WorkflowRunUrl pointer
46+
workflowUrl := "#"
47+
if job.WorkflowRunUrl != nil {
48+
workflowUrl = *job.WorkflowRunUrl
49+
}
50+
4451
message = message + fmt.Sprintf("|%v **%v** |<a href='%v'>%v</a> | <a href='%v'>%v</a> | %v | %v | %v|\n",
4552
job.Status.ToEmoji(),
4653
jobSpec.ProjectName,
47-
*job.WorkflowRunUrl,
54+
workflowUrl,
4855
job.Status.ToString(),
4956
prCommentUrl,
5057
jobTypeTitle,

0 commit comments

Comments
 (0)