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

fix(storage): when pruning release versions, never delete the last deployed revision #4978

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

ultimateboy
Copy link

@ultimateboy ultimateboy commented Nov 28, 2018

When tiller-max-history has been set, let's say to 3, if you attempt 3 releases that fail, you end up with a release with no deployed releases.

This doesn't make sense. By changing the prune function to never delete the most recent successfully deployed revision, we never enter a case where a release has no deployed revisions.

See the test case for a good example of this.

@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 28, 2018
Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ultimateboy This is looking good. I know there wasn't an existing test for this, but could you add a test for this new functionality? This seems like something that would be easy to miss later and cause a regression

@@ -210,6 +226,16 @@ func (s *Storage) removeLeastRecent(name string, max int) error {
}
}

func (s *Storage) deleteReleaseVersion(name string, version int32) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the nice refactor into its own function!

@bacongobbler bacongobbler added this to the 2.12.0 - Features milestone Nov 28, 2018
@thomastaylor312 thomastaylor312 added the bug Categorizes issue or PR as related to a bug. label Nov 28, 2018
Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. I was looking at code in another window on the wrong branch and missed the test

@bacongobbler
Copy link
Member

hey @ultimateboy! In the last month or so, we switched from a CLA to a DCO. This means that the commit will need to be signed off in order to agree to the DCO. Would you mind amending your commit to add that in?

More details on how to generate the signoff line here: https://github.com/helm/helm/pull/4978/checks?check_run_id=35785210

Thanks!

@helm-bot helm-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 28, 2018
Copy link
Member

@bacongobbler bacongobbler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We can merge once the tests pass. This should definitely help out users who end up in a state with no deployable releases with TILLER_HISTORY_MAX set. Thanks @ultimateboy! :)

@ultimateboy
Copy link
Author

It wont help users who are already in that state, but it should prevent users from getting into that state in the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants