Repository navigation
Test chart upgrades - #103
Conversation
c9273e7 to
c0a0da5
Compare
64765e5 to
58a66b0
Compare
aa60f0f to
ca2cc9e
Compare
c5ae478 to
35c8aad
Compare
35c8aad to
1781e91
Compare
|
@unguiculus I'd appreciate a first pass when you have a chance! |
|
Thanks. Please give me some time to review and test this. From quickly skimming over it: Have you thought about installing the previous version from the repo instead of checking out the merge base? Doing so, you assume the merge base reflects the previous release. This doesn't necessarily have to be the case. |
|
I did consider pulling the previous published revision, but I think there are a couple problems with that:
|
unguiculus
left a comment
There was a problem hiding this comment.
I did a quick review across the code.
I'm still testing and debugging and trying to understand and validate the changes. We will also need documentation for this so the user understands what the tool does.
We don't necessarily know where the charts have been published -- I suppose we could handle this with a new configuration flag.
You can configure repos with --chart-repos. You can probably just install the latest version from the repo. This should IMO be the default with an option to use merge base.
| flags.String("helm-extra-args", "", heredoc.Doc(` | ||
| Additional arguments for Helm. Must be passed as a single quoted string | ||
| (e.g. "--timeout 500 --tiller-namespace tiller"`)) | ||
| flags.Bool("upgrade", true, heredoc.Doc(` |
There was a problem hiding this comment.
The default should be false in order to not break the existing behavior.
There was a problem hiding this comment.
I'm good with this, though I hope we can flip this to true in a release or two. It would be nice for end users to get all the benefits of ct out of the box without having to figure out which additional flags they need to enable.
| // Reset charts directory to last commit | ||
| t.git.CheckoutDir(dir, "HEAD") | ||
| // Schedule cleanup of untracked temp directory | ||
| defer t.git.CleanDir(prevRevisionDir) |
There was a problem hiding this comment.
defer should not be used inside a loop.
There was a problem hiding this comment.
To me the defer feels more maintainable since we schedule the cleanup action right after creating the temp directory, and we would need to do some additional bookkeeping for handling early returns otherwise.
Memory overhead here should be very low since we're only keeping track of the prevRevisionDir string, and disk usage scales linearly (if disk is a concern we'll need to do a little additional refactoring).
There was a problem hiding this comment.
If I understand this correctly, when using defer inside a loop we should wrap it in either an anonymous or a named function. See my note about previous version(s) above… this may cause the loop to pile up a lot more.
3c47da8 to
36e09ce
Compare
36e09ce to
821aea2
Compare
|
@jlegrone Please don't rebase and amend commits but add additional ones on top. This makes it easier to review and GitHub can show you the changes. We squash upon merge anyways. |
|
@unguiculus sure thing. For this PR I was thinking it would make sense not to squash since the integration test changes are so massive, but up to you. I'm working on adding a bit more documentation to the install command now. Regarding this comment:
This would work a lot of the time, but especially as we move to a more decentralized model it won't be unheard of to have multiple custom repositories, each with different versions of the same chart name. There has also not been a requirement to add custom repositories so far, unless you are pulling dependencies in from those repositories. For example, I could be pulling in the bitnami charts repository to take advantage of their We can definitely handle this case, and I'm interested in your thoughts on implementation. I think it would be best done as a future enhancement since this feature will likely need to introduce some new configuration options. Aside from the above, IMO testing against merge base makes sense as the default since
|
|
Makes sense. I haven't thought this through yet. Let's stick with merge-base for now which, I agree, is a reasonable default. Re. squashing: We don't necessarily have to squash everything. In this case, I'd suggest to make the history nice once we're ready to merge. Alternatively, you could factor out integration tests into a separate PR as you suggested earlier. |
|
@unguiculus sounds good, I'll rework the commit log once you give an initial approval and we can just do a merge commit. I'll remove the [WIP] tag when commits are in order. |
|
I talked with @scottrigby about it the other day. We agreed that it would be best to split out the integration tests into a separate PR. |
|
@unguiculus I've opened a separate PR as requested (#120). I'll keep that changeset rebased on top of this PR to verify that integration tests continue to pass. |
There was a problem hiding this comment.
Nice work @jlegrone! Only concern I have is – for each non-breaking change – we should be testing upgrade from every previous non-MAJOR release, not only the most recent one. I mentioned that here #25 (comment) but I should have reviewed this PR earlier (hopefully should not be too big a refactor). It will take longer for charts with lots of MINOR/PATCH versions… but it's common for users to skip versions during upgrade, and a chart may upgrade fine from the previous version but not the one before it.
| // Reset charts directory to last commit | ||
| t.git.CheckoutDir(dir, "HEAD") | ||
| // Schedule cleanup of untracked temp directory | ||
| defer t.git.CleanDir(prevRevisionDir) |
There was a problem hiding this comment.
If I understand this correctly, when using defer inside a loop we should wrap it in either an anonymous or a named function. See my note about previous version(s) above… this may cause the loop to pile up a lot more.
Upgrade testing will be run if the --upgrade flag is set (default true) and chart version increment does not indicate a breaking change according to the SemVer 2.0 spec. Any releases associated with previous chart versions which fail to roll out or for which an initial `helm test` fails will be ignored. Signed-off-by: Jacob LeGrone <[email protected]>
Signed-off-by: Jacob LeGrone <[email protected]>
Signed-off-by: Jacob LeGrone <[email protected]>
Signed-off-by: Jacob LeGrone <[email protected]>
Signed-off-by: Jacob LeGrone <[email protected]>
Co-Authored-By: jlegrone <[email protected]> Signed-off-by: Jacob LeGrone <[email protected]>
Signed-off-by: Jacob LeGrone <[email protected]>
|
LGTM but @scottrigby should also approve. |
scottrigby
left a comment
There was a problem hiding this comment.
@jlegrone @unguiculus I buried my comment in a resolved thread #103 (comment) - this looks good to me 👍
What this PR does / why we need it:
This PR enables testing in-place upgrades of charts that have non-breaking changes according to the semver spec.
The desired behavior of this PR and further discussion can be found here: #25 (comment)
Which issue this PR fixes
closes #25
closes #19
closes #99
closes #100
Special notes for your reviewer:
Some TODOs:
Change the(out of scope for this PR)Gitinterface to a "SCM" interface to avoid further tight coupling with git?Known caveats:
helm dependency buildmay fail or not produce the same result as the previous revisionRun integration tests with(see #120)go test -cover -tags=integration ./...