Skip to content

Commit

Permalink
Emit waiting error when no changes occurred since last reconciliation
Browse files Browse the repository at this point in the history
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
  • Loading branch information
Paulo Gomes committed May 9, 2022
1 parent 53a308c commit c9bcc7e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions controllers/gitrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
if err != nil {
var v git.NoChangesError
if errors.As(err, &v) {
return sreconcile.ResultSuccess, nil
return sreconcile.ResultSuccess,
&serror.Waiting{Err: v, Reason: v.Message}
}

e := &serror.Event{
Expand Down Expand Up @@ -506,12 +507,6 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
// object are set, and the symlink in the Storage is updated to its path.
func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context,
obj *sourcev1.GitRepository, commit *git.Commit, includes *artifactSet, dir string) (sreconcile.Result, error) {
// If reconciliation resulted in git.NoChangesError,
// avoid reconciling artifact, as this was already done
// on a previous reconciliation.
if commit == nil || commit.Hash.String() == "" {
return sreconcile.ResultSuccess, nil
}

// Create potential new artifact with current available metadata
artifact := r.Storage.NewArtifactFor(obj.Kind, obj.GetObjectMeta(), commit.String(), fmt.Sprintf("%s.tar.gz", commit.Hash.String()))
Expand Down

0 comments on commit c9bcc7e

Please sign in to comment.