-
Notifications
You must be signed in to change notification settings - Fork 248
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
add optional schema migrations; default to olm.bundle.object instead of olm.csv.metadata #1384
add optional schema migrations; default to olm.bundle.object instead of olm.csv.metadata #1384
Conversation
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
Skipping CI for Draft Pull Request. |
ddb6959
to
f9c6877
Compare
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
f9c6877
to
85a012c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1384 +/- ##
=======================================
Coverage 48.14% 48.14%
=======================================
Files 134 136 +2
Lines 12752 12780 +28
=======================================
+ Hits 6139 6153 +14
- Misses 5575 5593 +18
+ Partials 1038 1034 -4 ☔ View full report in Codecov by Sentry. |
That sounds like a breaking change. We could make
|
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
Edit: we elected to
|
|
4b0ab63
to
1779861
Compare
a915c81
to
b50b1a8
Compare
/hold |
b50b1a8
to
f6f9eb1
Compare
/hold cancel |
alpha/action/migrate_test.go
Outdated
@@ -126,6 +182,10 @@ func TestMigrate(t *testing.T) { | |||
require.Equal(t, expectedData, string(actualData)) | |||
return nil | |||
}) | |||
|
|||
if s.migrationCount != 0 { | |||
require.Equal(t, s.migrationCount, migrationPre+s.migrationCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very well could be misunderstanding this code, but this will fail if migrationPre
is ever non-zero, right?
And the only reason it doesn't fail now is because there's only one spec that increments the counter?
I'm having trouble conjuring an approach that remains simple and overcomes this problem, but I'll clone and tinker later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this does an explicit compare against the counter value in the test spec... which will only work when the count of TCs attempting this feat is one.
It should be verifying that the count went up by the amount in the test spec, instead:
require.Equal(t, migrationCounter, migrationPre+s.migrationCount)
name string | ||
migrators *Migrations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about adding input
and expectedOutput
struct fields here instead of the evaluators
indirection?
If we did that, the test code would turn into something like:
assert.NoError(t, migators.Migrate(t.input))
assert.Empty(t, cmp.Diff(t.input, t.expectedOutput))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evaluators solves the problem of validating the sequence of migrators indicated by a migration label, whereas a test case may invoke multiple migrators (since the migrators label indicates a sequence [1..n] rather than a single value). It's 1:1 with the available migrators so we can attest to no side effects as we progress through a migrator chain, not 1:1 test-spec.
i.e.
input --> none(unmutated) --> csvMetadata(mutated) --> futureMigration(mutatedagain).
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
f6f9eb1
to
916366e
Compare
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
bd36d17
to
3997726
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grokspawn, joelanford The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c80e875
Description of the change:
Introduces the concept of optional schema migrations to
opm
available to the render and migrate actions, and template expansions (basic and semver). This includes a sequencing and extension mechanism since we presume that successive schema migrations might be dependent on the successful execution of prior ones.Schema migrations represent a level, are explicitly requested by name, and the sequence of all migrations up to and including the named one will be executed in sequence.
If any schema migration fails, it is immediately terminal to the sequence.
The existing
--migrate
flag foropm render
is equivalent to specifying the last possible--migrate-level
:Information on available migrations can be obtained from the help for associated migrate/render/semver/basic commands, for e.g.:
Motivation for the change:
When we introduced the new bundle metadata type
olm.csv.metadata
and made it the default, we started hearing of authors having to select non-latest versions ofopm
in order to preserve their pipelines' functionality. This is an anti-pattern, since we want to ensure that authors can safely use versions ofopm
that have the most fixes.Reviewer Checklist
/docs