Skip to content

Commit

Permalink
Merge pull request #351 from fluxcd/fix-ignore-domain-gitrepo
Browse files Browse the repository at this point in the history
Configure ignore domain for GitRepository rules
  • Loading branch information
hiddeco authored Apr 23, 2021
2 parents 14cf348 + 8c27e0a commit a6f3458
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions controllers/gitrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -272,15 +273,16 @@ func (r *GitRepositoryReconciler) reconcile(ctx context.Context, repository sour
defer unlock()

// archive artifact and check integrity
ps, err := sourceignore.LoadIgnorePatterns(tmpGit, nil)
ignoreDomain := strings.Split(tmpGit, string(filepath.Separator))
ps, err := sourceignore.LoadIgnorePatterns(tmpGit, ignoreDomain)
if err != nil {
err = fmt.Errorf(".sourceignore error: %w", err)
return sourcev1.GitRepositoryNotReady(repository, sourcev1.StorageOperationFailedReason, err.Error()), err
}
if repository.Spec.Ignore != nil {
ps = append(ps, sourceignore.ReadPatterns(strings.NewReader(*repository.Spec.Ignore), nil)...)
ps = append(ps, sourceignore.ReadPatterns(strings.NewReader(*repository.Spec.Ignore), ignoreDomain)...)
}
if err := r.Storage.Archive(&artifact, tmpGit, SourceIgnoreFilter(ps, nil)); err != nil {
if err := r.Storage.Archive(&artifact, tmpGit, SourceIgnoreFilter(ps, ignoreDomain)); err != nil {
err = fmt.Errorf("storage archive error: %w", err)
return sourcev1.GitRepositoryNotReady(repository, sourcev1.StorageOperationFailedReason, err.Error()), err
}
Expand Down

0 comments on commit a6f3458

Please sign in to comment.