Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helmfile installs non-existent release version #815

Closed
Nuru opened this issue Aug 20, 2019 · 4 comments · Fixed by #820
Closed

Helmfile installs non-existent release version #815

Nuru opened this issue Aug 20, 2019 · 4 comments · Fixed by #820
Labels

Comments

@Nuru
Copy link

Nuru commented Aug 20, 2019

Bug in helmfile version v0.81.0

At the time of this writing, the latest release of cloudposse/helmfiles is 0.58.0. There is no 0.59.0 release. However, this happened:

$ helmfiles ⨠ helmfile -f 'git::https://github.com/cloudposse/helmfiles.git@releases/prometheus-pushgateway.yaml?ref=0.59.0' apply 
locate: get: error downloading 'https://github.com/cloudposse/helmfiles.git?ref=0.59.0': /usr/bin/git exited with 1: error: pathspec '0.59.0' did not match any file(s) known to git
$ helmfiles ⨠ helmfile -f 'git::https://github.com/cloudposse/helmfiles.git@releases/prometheus-pushgateway.yaml?ref=0.59.0' apply 
Adding repo stable https://kubernetes-charts.storage.googleapis.com
"stable" has been added to your repositories
...

In other words, the first time I tried to install the non-existent release, it failed, as it should. However, helmfile apparently created a .helmfile/cache/https_github_com_cloudposse_helmfiles_git.ref=0.59.0 directory and populated it with the latest release or current master branch (they are currently the same commit) of the repo. Then the second time I ran the command, helmfile found the cache and went ahead an installed it.

This lead to the wrong version of helmfiles being installed without warning.

Please fix this. If the tag does not exist, then the cache directory should not be created and populated, or at least it should be deleted when the error is detected.

@mumoshu mumoshu added the bug label Aug 20, 2019
@mumoshu
Copy link
Collaborator

mumoshu commented Aug 20, 2019

@Nuru Good catch! It does sound like a bug.

If you could have some time to work on this, would you try adding some code to remove the directory at cacheDirPath(while recursively removing the files in int) before returning an error here?

return "", err

Perhaps that's the only thing needed to fix it.

@mumoshu
Copy link
Collaborator

mumoshu commented Aug 20, 2019

something like this should work:

rmerr := os.RemoveAll(cacheDirPath)
if rmerr != nil {
  // some log to tell the user that helmfile was unable to remove the dir for whatever reason
}
return "", err

@Nuru
Copy link
Author

Nuru commented Aug 20, 2019

Sorry, @mumoshu, I don't have a golang build environment to build and test with.

@mumoshu
Copy link
Collaborator

mumoshu commented Aug 24, 2019

@Nuru Got it 👍I just reproduced this myself. Will fix it asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants