Skip to content

Commit 5e45e54

Browse files
authored
Merge pull request #125 from fluxcd/bugfix/storage-helm
2 parents 0ae11b6 + 2c4dcfe commit 5e45e54

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

controllers/helmchart_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"net/url"
2424
"os"
2525
"path"
26+
"path/filepath"
2627
"strings"
2728
"time"
2829

@@ -383,7 +384,7 @@ func (r *HelmChartReconciler) reconcileFromGitRepository(ctx context.Context,
383384

384385
// package chart
385386
pkg := action.NewPackage()
386-
pkg.Destination = artifact.Path
387+
pkg.Destination = filepath.Dir(artifact.Path)
387388
_, err = pkg.Run(chartPath, nil)
388389
if err != nil {
389390
err = fmt.Errorf("chart package error: %w", err)

controllers/storage.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ func (s *Storage) RemoveAllButCurrent(artifact sourcev1.Artifact) error {
120120
return nil
121121
}
122122

123-
// ArtifactExist returns a boolean indicating whether the artifact file exists in storage
123+
// ArtifactExist returns a boolean indicating whether the artifact exists in storage and is a
124+
// regular file.
124125
func (s *Storage) ArtifactExist(artifact sourcev1.Artifact) bool {
125-
if _, err := os.Stat(artifact.Path); os.IsNotExist(err) {
126+
fi, err := os.Lstat(artifact.Path)
127+
if err != nil {
126128
return false
127129
}
128-
return true
130+
return fi.Mode().IsRegular()
129131
}
130132

131133
// Archive creates a tar.gz to the artifact path from the given dir excluding any VCS specific

0 commit comments

Comments
 (0)