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
Signed-off-by: Kai Reichart <kai@reichart.dev>
  • Loading branch information
Reuuke authored and KaiReichart committed Aug 11, 2021
2 parents 55d1b87 + 2a7eab7 commit b0db64b
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 b0db64b

Please sign in to comment.