@@ -21,6 +21,7 @@ import (
21
21
"errors"
22
22
"fmt"
23
23
"os"
24
+ "path/filepath"
24
25
"strings"
25
26
"time"
26
27
@@ -496,19 +497,20 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context,
496
497
defer unlock ()
497
498
498
499
// Load ignore rules for archiving
499
- ps , err := sourceignore .LoadIgnorePatterns (dir , nil )
500
+ ignoreDomain := strings .Split (dir , string (filepath .Separator ))
501
+ ps , err := sourceignore .LoadIgnorePatterns (dir , ignoreDomain )
500
502
if err != nil {
501
503
return sreconcile .ResultEmpty , & serror.Event {
502
504
Err : fmt .Errorf ("failed to load source ignore patterns from repository: %w" , err ),
503
505
Reason : "SourceIgnoreError" ,
504
506
}
505
507
}
506
508
if obj .Spec .Ignore != nil {
507
- ps = append (ps , sourceignore .ReadPatterns (strings .NewReader (* obj .Spec .Ignore ), nil )... )
509
+ ps = append (ps , sourceignore .ReadPatterns (strings .NewReader (* obj .Spec .Ignore ), ignoreDomain )... )
508
510
}
509
511
510
512
// Archive directory to storage
511
- if err := r .Storage .Archive (& artifact , dir , SourceIgnoreFilter (ps , nil )); err != nil {
513
+ if err := r .Storage .Archive (& artifact , dir , SourceIgnoreFilter (ps , ignoreDomain )); err != nil {
512
514
e := & serror.Event {
513
515
Err : fmt .Errorf ("unable to archive artifact to storage: %w" , err ),
514
516
Reason : sourcev1 .ArchiveOperationFailedReason ,
0 commit comments