forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'appset-resource-tree' of https://github.com/alexymantha…
…/argo-cd into alexy-appset-resource-tree
- Loading branch information
Showing
50 changed files
with
2,671 additions
and
1,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ import ( | |
"github.com/argoproj/argo-cd/v2/util/io" | ||
) | ||
|
||
//go:generate go run github.com/vektra/mockery/[email protected] --name=RepositoryDB | ||
|
||
// RepositoryDB Is a lean facade for ArgoDB, | ||
// Using a lean interface makes it easier to test the functionality of the git generator | ||
type RepositoryDB interface { | ||
|
@@ -25,13 +27,15 @@ type argoCDService struct { | |
newFileGlobbingEnabled bool | ||
} | ||
|
||
//go:generate go run github.com/vektra/mockery/[email protected] --name=Repos | ||
|
||
type Repos interface { | ||
|
||
// GetFiles returns content of files (not directories) within the target repo | ||
GetFiles(ctx context.Context, repoURL string, revision string, pattern string) (map[string][]byte, error) | ||
GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache bool) (map[string][]byte, error) | ||
|
||
// GetDirectories returns a list of directories (not files) within the target repo | ||
GetDirectories(ctx context.Context, repoURL string, revision string) ([]string, error) | ||
GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache bool) ([]string, error) | ||
} | ||
|
||
func NewArgoCDService(db db.ArgoDB, submoduleEnabled bool, repoClientset apiclient.Clientset, newFileGlobbingEnabled bool) (Repos, error) { | ||
|
@@ -43,7 +47,7 @@ func NewArgoCDService(db db.ArgoDB, submoduleEnabled bool, repoClientset apiclie | |
}, nil | ||
} | ||
|
||
func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision string, pattern string) (map[string][]byte, error) { | ||
func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache bool) (map[string][]byte, error) { | ||
repo, err := a.repositoriesDB.GetRepository(ctx, repoURL) | ||
if err != nil { | ||
return nil, fmt.Errorf("error in GetRepository: %w", err) | ||
|
@@ -55,6 +59,7 @@ func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision s | |
Revision: revision, | ||
Path: pattern, | ||
NewGitFileGlobbingEnabled: a.newFileGlobbingEnabled, | ||
NoRevisionCache: noRevisionCache, | ||
} | ||
closer, client, err := a.repoServerClientSet.NewRepoServerClient() | ||
if err != nil { | ||
|
@@ -69,7 +74,7 @@ func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision s | |
return fileResponse.GetMap(), nil | ||
} | ||
|
||
func (a *argoCDService) GetDirectories(ctx context.Context, repoURL string, revision string) ([]string, error) { | ||
func (a *argoCDService) GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache bool) ([]string, error) { | ||
repo, err := a.repositoriesDB.GetRepository(ctx, repoURL) | ||
if err != nil { | ||
return nil, fmt.Errorf("error in GetRepository: %w", err) | ||
|
@@ -79,6 +84,7 @@ func (a *argoCDService) GetDirectories(ctx context.Context, repoURL string, revi | |
Repo: repo, | ||
SubmoduleEnabled: a.submoduleEnabled, | ||
Revision: revision, | ||
NoRevisionCache: noRevisionCache, | ||
} | ||
|
||
closer, client, err := a.repoServerClientSet.NewRepoServerClient() | ||
|
Oops, something went wrong.