diff --git a/controllers/gitrepository_controller.go b/controllers/gitrepository_controller.go index 58519306..204823b4 100644 --- a/controllers/gitrepository_controller.go +++ b/controllers/gitrepository_controller.go @@ -561,6 +561,9 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, obj *sou conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "IncludeChange", "included artifacts differ from last observed includes") } + + // Persist the artifactSet. + *includes = artifacts return sreconcile.ResultSuccess, nil } diff --git a/controllers/gitrepository_controller_test.go b/controllers/gitrepository_controller_test.go index 6a0325d5..792495a8 100644 --- a/controllers/gitrepository_controller_test.go +++ b/controllers/gitrepository_controller_test.go @@ -1029,6 +1029,9 @@ func TestGitRepositoryReconciler_reconcileInclude(t *testing.T) { got, err := r.reconcileInclude(ctx, obj, &artifact, &includes, tmpDir) g.Expect(obj.GetConditions()).To(conditions.MatchConditions(tt.assertConditions)) g.Expect(err != nil).To(Equal(tt.wantErr)) + if err == nil { + g.Expect(len(includes)).To(Equal(len(tt.includes))) + } g.Expect(got).To(Equal(tt.want)) for _, i := range tt.includes { if i.toPath != "" {