Skip to content

Commit a72badf

Browse files
committed
reconcilers: include artifact digest in event meta
Signed-off-by: Hidde Beydals <[email protected]>
1 parent 6e0a6f1 commit a72badf

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

controllers/bucket_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ func (r *BucketReconciler) notify(ctx context.Context, oldObj, newObj *sourcev1.
405405
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaRevisionKey): newObj.Status.Artifact.Revision,
406406
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaChecksumKey): newObj.Status.Artifact.Checksum,
407407
}
408+
if newObj.Status.Artifact.Digest != "" {
409+
annotations[sourcev1.GroupVersion.Group+"/digest"] = newObj.Status.Artifact.Digest
410+
}
408411

409412
var oldChecksum string
410413
if oldObj.GetArtifact() != nil {

controllers/gitrepository_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ func (r *GitRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *so
327327
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaRevisionKey): newObj.Status.Artifact.Revision,
328328
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaChecksumKey): newObj.Status.Artifact.Checksum,
329329
}
330+
if newObj.Status.Artifact.Digest != "" {
331+
annotations[sourcev1.GroupVersion.Group+"/digest"] = newObj.Status.Artifact.Digest
332+
}
330333

331334
var oldChecksum string
332335
if oldObj.GetArtifact() != nil {

controllers/helmchart_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ func (r *HelmChartReconciler) notify(ctx context.Context, oldObj, newObj *source
330330
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaRevisionKey): newObj.Status.Artifact.Revision,
331331
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaChecksumKey): newObj.Status.Artifact.Checksum,
332332
}
333+
if newObj.Status.Artifact.Digest != "" {
334+
annotations[sourcev1.GroupVersion.Group+"/digest"] = newObj.Status.Artifact.Digest
335+
}
333336

334337
var oldChecksum string
335338
if oldObj.GetArtifact() != nil {

controllers/helmrepository_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ func (r *HelmRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *s
291291
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaRevisionKey): newObj.Status.Artifact.Revision,
292292
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaChecksumKey): newObj.Status.Artifact.Checksum,
293293
}
294+
if newObj.Status.Artifact.Digest != "" {
295+
annotations[sourcev1.GroupVersion.Group+"/digest"] = newObj.Status.Artifact.Digest
296+
}
294297

295298
humanReadableSize := "unknown size"
296299
if size := newObj.Status.Artifact.Size; size != nil {

controllers/ocirepository_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,9 @@ func (r *OCIRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *so
11401140
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaRevisionKey): newObj.Status.Artifact.Revision,
11411141
fmt.Sprintf("%s/%s", sourcev1.GroupVersion.Group, eventv1.MetaChecksumKey): newObj.Status.Artifact.Checksum,
11421142
}
1143+
if newObj.Status.Artifact.Digest != "" {
1144+
annotations[sourcev1.GroupVersion.Group+"/digest"] = newObj.Status.Artifact.Digest
1145+
}
11431146

11441147
var oldChecksum string
11451148
if oldObj.GetArtifact() != nil {

0 commit comments

Comments
 (0)