New 🌊 wave for @helm

Commit 2441cefc

2441cefc8ce3Merged

Svyatoslav Dumchenko <[email protected]> · 4 years ago · 15 files · +2 added · ~13 modified

Description

feat: download remote chart to .helmwave directory

Details

Commit
2441cefc8ce3
Parent
1583b1891419

pkg/helper/fs.goaddedView file

1+package helper
2+
3+import (
4+ "fmt"
5+ "os"
6+
7+ dir "github.com/otiai10/copy"
8+ log "github.com/sirupsen/logrus"
9+)
10+
11+// MoveFile moves files or directories. It also handles move between different mounts (copy + rm).
12+func MoveFile(src, dst string) error {
13+ // It doesnt work if workdir has been mounted.
14+ err := os.Rename(src, dst)
15+ if err != nil {
16+ err = dir.Copy(src, dst)
17+ if err != nil {
18+ return fmt.Errorf("failed to move file between filesystems: %w", err)
19+ }
20+ defer func(src string) {
21+ err := os.RemoveAll(src)
22+ if err != nil {
23+ log.WithError(err).Error("failed to remove source temporary directory")
24+ }
25+ }(src)
26+ }
27+
28+ return nil
29+}