Skip to content

Commit

Permalink
Helm Charts: Fix cross-device link error (#720)
Browse files Browse the repository at this point in the history
* Helm Charts: Fix cross-link error
Closes #719
By using `/tmp` as a pull target, we possibly pull to a different disk than the destination
This makes `os.Rename` impossible
To fix this, we can pull to a temporary dir within the destination instead

* Add changelog entry
  • Loading branch information
julienduchesne authored Jun 8, 2022
1 parent 7ed9709 commit 3d39cc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
**[#717](https://github.com/grafana/tanka/pull/717)**
- **helm**: Add validation at vendoring time for invalid chart names
**[#718](https://github.com/grafana/tanka/pull/718)**
- **helm**: Fix cross-device link error when tmp is mounted on a different device
**[#720](https://github.com/grafana/tanka/pull/720)**

## 0.22.0 (2022-06-03)

Expand Down
3 changes: 2 additions & 1 deletion pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func (e ExecHelm) Pull(chart, version string, opts PullOpts) error {
}
defer os.Remove(repoFile)

tempDir, err := os.MkdirTemp("", "charts-pull")
// Pull to a temp dir within the destination directory (not /tmp) to avoid possible cross-device issues when renaming
tempDir, err := os.MkdirTemp(opts.Destination, ".pull-")
if err != nil {
return err
}
Expand Down

0 comments on commit 3d39cc4

Please sign in to comment.