add credentials in getfilecontent (#2591)

* add credentials in getfilecontent
pull/3545/head
Kapil Garg 2024-08-26 19:23:28 +00:00 committed by Harness
parent ffd999eaff
commit 7af28da479
4 changed files with 4 additions and 1 deletions

View File

@ -196,6 +196,7 @@ func (s GitnessSCM) ResolveCredentials(
func (s GitnessSCM) GetFileContent(ctx context.Context,
gitspaceConfig types.GitspaceConfig,
filePath string,
_ *ResolvedCredentials,
) ([]byte, error) {
repo, err := s.repoStore.FindByRef(ctx, *gitspaceConfig.CodeRepo.Ref)
if err != nil {

View File

@ -55,6 +55,7 @@ func (s *GenericSCM) ListReporisotries(_ context.Context,
func (s GenericSCM) GetFileContent(ctx context.Context,
gitspaceConfig types.GitspaceConfig,
filePath string,
_ *ResolvedCredentials,
) ([]byte, error) {
gitWorkingDirectory := "/tmp/git/"
cloneDir := gitWorkingDirectory + uuid.New().String()

View File

@ -130,7 +130,7 @@ func (s scm) GetSCMRepoDetails(
ResolvedCredentials: resolvedCredentials,
}
catFileOutputBytes, err := scmProvider.GetFileContent(ctx, gitspaceConfig, filePath)
catFileOutputBytes, err := scmProvider.GetFileContent(ctx, gitspaceConfig, filePath, resolvedCredentials)
if err != nil {
return nil, fmt.Errorf("failed to read devcontainer file : %w", err)
}

View File

@ -28,6 +28,7 @@ type Provider interface {
ctx context.Context,
gitspaceConfig types.GitspaceConfig,
filePath string,
credentials *ResolvedCredentials,
) ([]byte, error)
ListReporisotries(ctx context.Context,
filter *RepositoryFilter,