Skip to content

Commit b41c717

Browse files
committed
controllers: emit event and log source up-to-date
Signed-off-by: Sunny <[email protected]>
1 parent 86860ec commit b41c717

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

api/v1beta2/condition_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,8 @@ const (
9393

9494
// SymlinkUpdateFailedReason signals a failure in updating a symlink.
9595
SymlinkUpdateFailedReason string = "SymlinkUpdateFailed"
96+
97+
// ArtifactUpToDateReason signals that an existing Artifact is up-to-date
98+
// with the Source.
99+
ArtifactUpToDateReason string = "ArtifactUpToDate"
96100
)

controllers/bucket_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ func (r *BucketReconciler) reconcileArtifact(ctx context.Context, obj *sourcev1.
526526

527527
// The artifact is up-to-date
528528
if obj.GetArtifact().HasRevision(artifact.Revision) {
529-
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", artifact.Revision)
529+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.ArtifactUpToDateReason, "artifact up-to-date with remote revision: '%s'", artifact.Revision)
530530
return sreconcile.ResultSuccess, nil
531531
}
532532

controllers/gitrepository_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context,
462462

463463
// The artifact is up-to-date
464464
if obj.GetArtifact().HasRevision(artifact.Revision) && !includes.Diff(obj.Status.IncludedArtifacts) {
465-
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", artifact.Revision)
465+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.ArtifactUpToDateReason, "artifact up-to-date with remote revision: '%s'", artifact.Revision)
466466
return sreconcile.ResultSuccess, nil
467467
}
468468

controllers/helmchart_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
638638

639639
// Return early if the build path equals the current artifact path
640640
if curArtifact := obj.GetArtifact(); curArtifact != nil && r.Storage.LocalPath(*curArtifact) == b.Path {
641-
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", artifact.Revision)
641+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.ArtifactUpToDateReason, "artifact up-to-date with remote revision: '%s'", artifact.Revision)
642642
return sreconcile.ResultSuccess, nil
643643
}
644644

controllers/helmrepository_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, obj *s
411411
}()
412412

413413
if obj.GetArtifact().HasRevision(artifact.Revision) {
414-
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", artifact.Revision)
414+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.ArtifactUpToDateReason, "artifact up-to-date with remote revision: '%s'", artifact.Revision)
415415
return sreconcile.ResultSuccess, nil
416416
}
417417

0 commit comments

Comments
 (0)