Skip to content

Commit

Permalink
fix extra values when chart located in git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuuke committed Jul 29, 2021
1 parent 333c40f commit 2a7eab7
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,38 @@ func (s *Service) runRepoOperation(
defer settings.sem.Release(1)
}

if source.Helm != nil && source.Helm.ExternalValueFiles != nil {
// load values files from external git repo
for _, exVal := range source.Helm.ExternalValueFiles {
exRepo := v1alpha1.Repository{Repo: exVal.RepoURL}
if helmExternalValueCreds != nil {
creds := getRepoCredential(helmExternalValueCreds, exVal.RepoURL)
if creds != nil {
exRepo.CopyCredentialsFrom(creds)
}
}

exGitClient, exRevision, err := s.newClientResolveRevision(&exRepo, exVal.TargetRevision, git.WithCache(s.cache, !settings.noRevisionCache && !settings.noCache))
if err != nil {
return err
}

err = DoGitCheckoutOperationForRepoOperation(
s,
exGitClient,
exRevision,
settings,
cacheFn,
nil,
verifyCommit,
"",
)
if err != nil {
return err
}
}
}

if source.IsHelm() {
if settings.noCache {
err = helmClient.CleanChartCache(source.Chart, revision)
Expand All @@ -246,38 +278,6 @@ func (s *Service) runRepoOperation(
}
defer io.Close(closer)

if source.Helm != nil && source.Helm.ExternalValueFiles != nil {
// load values files from external git repo
for _, exVal := range source.Helm.ExternalValueFiles {
exRepo := v1alpha1.Repository{Repo: exVal.RepoURL}
if helmExternalValueCreds != nil {
creds := getRepoCredential(helmExternalValueCreds, exVal.RepoURL)
if creds != nil {
exRepo.CopyCredentialsFrom(creds)
}
}

exGitClient, exRevision, err := s.newClientResolveRevision(&exRepo, exVal.TargetRevision, git.WithCache(s.cache, !settings.noRevisionCache && !settings.noCache))
if err != nil {
return err
}

err = DoGitCheckoutOperationForRepoOperation(
s,
exGitClient,
exRevision,
settings,
cacheFn,
nil,
verifyCommit,
"",
)
if err != nil {
return err
}
}
}

return operation(chartPath, revision, revision, func() (*operationContext, error) {
return &operationContext{chartPath, ""}, nil
})
Expand Down

0 comments on commit 2a7eab7

Please sign in to comment.