Skip to content

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

Merged
thomastaylor312 merged 1 commit into
helm:masterfrom
ultimateboy:dont-delete-deployed
Nov 28, 2018
Merged

thomastaylor312 merged 1 commit into
helm:masterfrom
ultimateboy:dont-delete-deployed

Conversation

@ultimateboy

@ultimateboy ultimateboy commented Nov 28, 2018 •

Copy link
Copy Markdown

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

@thomastaylor312 thomastaylor312 left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread pkg/storage/storage.go
}
}

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

Copy link
Copy Markdown
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

@thomastaylor312 thomastaylor312 left a comment •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@bacongobbler bacongobbler left a comment •

Copy link
Copy Markdown
Member

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
Copy Markdown
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