Emit waiting error when no changes occurred since last reconciliation

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
Paulo Gomes 2022-05-09 17:34:17 +01:00
parent 44e166e576
commit 87e03431b0
No known key found for this signature in database
GPG Key ID: 9995233870E99BEE
1 changed files with 2 additions and 7 deletions

View File

@ -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{
@ -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()))