Skip to content

Commit

Permalink
Merge pull request #929 from 14rcole/groupsnapshot-reporting-panic
Browse files Browse the repository at this point in the history
fix: group snapshot error causing panic
  • Loading branch information
14rcole authored Nov 13, 2024
2 parents ff7a734 + 2f7f58f commit d5085ad
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/controller/buildpipeline/buildpipeline_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,14 @@ func (a *Adapter) notifySnapshotsInGroupAboutFailedBuild(pipelineRun *tektonv1.P
a.logger.Error(err, "Failed to fetch Snapshots for component", "component.Name", applicationComponent.Name)
return err
}
latestSnapshot := gitops.SortSnapshots(*allComponentSnapshotsInGroup)[0]
err = gitops.AnnotateSnapshot(a.context, &latestSnapshot, gitops.PRGroupCreationAnnotation,
buildPLRFailureMsg, a.client)
if err != nil {
return err

if len(*allComponentSnapshotsInGroup) > 0 {
latestSnapshot := gitops.SortSnapshots(*allComponentSnapshotsInGroup)[0]
err = gitops.AnnotateSnapshot(a.context, &latestSnapshot, gitops.PRGroupCreationAnnotation,
buildPLRFailureMsg, a.client)
if err != nil {
return err
}
}
}

Expand Down

0 comments on commit d5085ad

Please sign in to comment.