-
Notifications
You must be signed in to change notification settings - Fork 27
Make change to allow for LUA type migrations in the upgrade operations #111
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mothslaw
reviewed
May 1, 2020
platform/src/main/python/dlpx/virtualization/platform/_upgrade.py
Outdated
Show resolved
Hide resolved
platform/src/main/python/dlpx/virtualization/platform/migration_helper.py
Show resolved
Hide resolved
platform/src/main/python/dlpx/virtualization/platform/migration_helper.py
Show resolved
Hide resolved
jeffngo
reviewed
May 1, 2020
platform/src/main/python/dlpx/virtualization/platform/_upgrade.py
Outdated
Show resolved
Hide resolved
platform/src/main/python/dlpx/virtualization/platform/import_validations.py
Outdated
Show resolved
Hide resolved
platform/src/main/python/dlpx/virtualization/platform/import_validations.py
Outdated
Show resolved
Hide resolved
platform/src/test/python/dlpx/virtualization/test_migration_helper.py
Outdated
Show resolved
Hide resolved
ravi-cm
reviewed
May 4, 2020
platform/src/main/python/dlpx/virtualization/platform/migration_helper.py
Show resolved
Hide resolved
tools/src/main/python/dlpx/virtualization/_internal/validation_schemas/plugin_importer.yaml
Show resolved
Hide resolved
mothslaw
approved these changes
May 6, 2020
ravi-cm
approved these changes
May 6, 2020
Contributor
ravi-cm
left a comment
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.
Looks good. Thanks for the additional changes in fake/test plugins.
jeffngo
approved these changes
May 6, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request checklist
Please check if your PR fulfills the following requirements:
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Currently the SDK does not support upgrading from lua toolkits up to a python plugin. It only supports python to python upgrade. There is no way to denote a migration is a different type other than a plugin migration.
What is the new behavior?
The new protobuf changes made in Tom's diff makes the request include an optional string lua_upgrade_version which, if not null, represents the lua version the upgrade is actually from. the SDK takes this lua version and figures out which migrations need to be run based on this version and concats that list with the list of migration ids passed over in the protobuf message. Then we loop through this list and run all the migrations.
The way we expect a plugin author to denote a lua migration is by setting a second parameter in the decorator: MigrationType.LUA. This lua migration will be saved during the dvp build into a different object specifically for lua migrations. The two migration helper objects do slightly different things:
A Platform migration will contain a set that validates all migration ids are unique. The format checked is also different, and we canonicalize the id into a array if ints so the representation is always the same. The platform migration also returns back the ordered list of migration ids so that the artifact's manifest has a list of all migration ids.
A Lua migration will not contain a set because each of the different objects types (repo, source config, linked source, virtual source, snapshot) can potentially have the same version. Instead the validation will make sure that it's in a major.minor format (the same way it's split on the DE). We also canonicalize the version down to two ints (so something like 1.01 -> 1.1). Lastly we get a list of the sorted lua versions starting from the lua version that is passed in. so for example if there were versions 1.2, 2.3, 0.1, 3.4 and we queried this function with
1.2the function should return back['1.2', '2.3', '3.4'].I ran the following tooling to fix formatting:
Does this introduce a breaking change?
Testing
Manually tested that a lua toolkit was upgraded to a python plugin and the migrations were actually run so that optional fields that were added in the python plugin was also modified in the real objects.
Add environments, install lua toolkit, and then link and provision.
Attempt to upgrade to python toolkit with correct lua migrations + luaName set but get this:
Then disable both dsource and vdb.
Attempt to upload to new python plugin again. This time it should go through:
Now enable the the dsource and vdb and verify that it works (I had to remove the asserts to get this to work, but I imagine if I knew what to update the fields to it would have worked fine)
Also added a bunch of unit tests that makes sure the right migrations get run in the right order when the protobuf request has a lua_upgrade_version.
Fixes #71