parent
							
								
									a584aeab2e
								
							
						
					
					
						commit
						cd5d906afb
					
				
							
								
								
									
										2
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										2
									
								
								go.mod
								
								
								
								
							|  | @ -16,7 +16,7 @@ require ( | ||||||
| 	github.com/tatsushid/go-prettytable v0.0.0-20141013043238-ed2d14c29939 | 	github.com/tatsushid/go-prettytable v0.0.0-20141013043238-ed2d14c29939 | ||||||
| 	github.com/urfave/cli v0.0.0-20160620154522-6011f165dc28 | 	github.com/urfave/cli v0.0.0-20160620154522-6011f165dc28 | ||||||
| 	go.uber.org/atomic v1.3.2 // indirect | 	go.uber.org/atomic v1.3.2 // indirect | ||||||
| 	go.uber.org/multierr v1.1.0 // indirect | 	go.uber.org/multierr v1.1.0 | ||||||
| 	go.uber.org/zap v1.8.0 | 	go.uber.org/zap v1.8.0 | ||||||
| 	gopkg.in/yaml.v2 v2.2.1 | 	gopkg.in/yaml.v2 v2.2.1 | ||||||
| 	gotest.tools v2.2.0+incompatible | 	gotest.tools v2.2.0+incompatible | ||||||
|  |  | ||||||
|  | @ -6,8 +6,10 @@ import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/hashicorp/go-getter" | 	"github.com/hashicorp/go-getter" | ||||||
| 	"github.com/hashicorp/go-getter/helper/url" | 	"github.com/hashicorp/go-getter/helper/url" | ||||||
|  | 	"go.uber.org/multierr" | ||||||
| 	"go.uber.org/zap" | 	"go.uber.org/zap" | ||||||
| 	"gopkg.in/yaml.v2" | 	"gopkg.in/yaml.v2" | ||||||
|  | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"strings" | 	"strings" | ||||||
| ) | ) | ||||||
|  | @ -180,8 +182,10 @@ func (r *Remote) Fetch(goGetterSrc string) (string, error) { | ||||||
| 
 | 
 | ||||||
| 	cached := false | 	cached := false | ||||||
| 
 | 
 | ||||||
|  | 	// e.g. .helmfile/cache/https_github_com_cloudposse_helmfiles_git.ref=0.xx.0
 | ||||||
| 	getterDst := filepath.Join(cacheBaseDir, cacheKey) | 	getterDst := filepath.Join(cacheBaseDir, cacheKey) | ||||||
| 
 | 
 | ||||||
|  | 	// e.g. $PWD/.helmfile/cache/https_github_com_cloudposse_helmfiles_git.ref=0.xx.0
 | ||||||
| 	cacheDirPath := filepath.Join(r.Home, getterDst) | 	cacheDirPath := filepath.Join(r.Home, getterDst) | ||||||
| 
 | 
 | ||||||
| 	r.Logger.Debugf("home: %s", r.Home) | 	r.Logger.Debugf("home: %s", r.Home) | ||||||
|  | @ -217,6 +221,10 @@ func (r *Remote) Fetch(goGetterSrc string) (string, error) { | ||||||
| 		r.Logger.Debugf("downloading %s to %s", getterSrc, getterDst) | 		r.Logger.Debugf("downloading %s to %s", getterSrc, getterDst) | ||||||
| 
 | 
 | ||||||
| 		if err := r.Getter.Get(r.Home, getterSrc, getterDst); err != nil { | 		if err := r.Getter.Get(r.Home, getterSrc, getterDst); err != nil { | ||||||
|  | 			rmerr := os.RemoveAll(cacheDirPath) | ||||||
|  | 			if rmerr != nil { | ||||||
|  | 				return "", multierr.Append(err, rmerr) | ||||||
|  | 			} | ||||||
| 			return "", err | 			return "", err | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue