-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[14.0] ADD upgrade_analysis #1941
[14.0] ADD upgrade_analysis #1941
Conversation
My PR here legalsylvain/openupgrade-framework#1 improves on some of the patches and it adds a mechanism to apply a collection of patches only when we need them. Would you consider taking some of these changes? I can propose a PR onto your branch here. |
Hi @StefanRijnhart. Yes, I like your |
You can find my PR into this branch here: legalsylvain#3 |
Hi @StefanRijnhart :
As far as I can understand there dict are used :
We have basically three options :
It adds the constraints to have the C) make a standalone module My point of view : I prefer to avoid A, because it is duplicating the data. I maybe prefer C, but B is also OK. I just think that most of the changes of this file are done when "upgrading", so anyway, it makes sense to set the data in the What do you think ? Note : it doesn't seems to be a huge trouble for the current migration (13 -> 14) because there does not seem to be any renaming or module merging between these two versions. Ref : OCA/OpenUpgrade#2190 |
Thanks for noting the travis breakage. Will look at that tonight. I think apriory belongs to openupgrade_scripts rather than the framework, because it is different for every edition. Maybe we should try to import apriori from |
yes you're right ! it seems the best solution. 👍
Not sure to understand your proposal.
For the time being, I see the following solution as the more simple
We can, in that case, add a warning in the logs like |
Not sure if |
Indeed, Is it an odoo module ? not really I confess, and there is no need to install it, and install it will do nothing. (as Then, the instruction for end user will be quite simple :
I've already talked about the importance of simplifying the use of openupgrade here. OCA/OpenUpgrade#2440 (comment) do you see any negative effects to encapsulate the migration scripts in an odoo module ? |
OK, disguising the scripts directory as a module is fine. I'll use its location on the file system as a default for upgrade_path instead of the configuration key then. |
I'm not sure of understanding about openupgrade_scripts, but if your intention is to encapsulate all migration scripts there, that's a very bad option. We should use upgrade-paths or similar argument line option, and respect the addon hierarchy in a separate repo with that scripts. We can even add migration scripts from other OCA addons. |
if it's not an odoo SA modules, (custom, OCA) the analysis file will be located as usual, in the |
Then I insist that shouldn't be the way to go. Scripts should be outside any Odoo module, and follow the same structure as previously: account/migrations/14.0.1.0/* and then use them with --migration-paths (or similar name) option when launching the upgrade. This is also the way Odoo does it. This allows to have a more intuitive structure, we can add more Odoo major version scripts from other OCA repos, etc. Controlling a mega-module with all the Odoo core scripts has no sense for me, it requires a big maintenance work, and even the version bumping you are commenting doesn't serve for anything. What a minor/major/patch version bumping means? |
@pedrobaeza thank you for that pointer. I see Odoo supports a --upgrade-path parameter for this. I agree we should use this for the core modules instead of a pseudo Odoo module. As for your suggestion to also store scripts here for OCA modules etc., I am not sure. I think keeping them within the actual module has its advantages. |
And apologies @legalsylvain for not recognizing what the |
I'm talking about only major Odoo versions of OCA modules. Advantages of this approach:
For major changes on the module that require migration scripts, of course they still should be included inside OCA module itself. Example: OCA/credit-control#86 |
For me, commiting the migration script together with the migration of the module code is 'having everything in the same place', as well as having the reviewers review both together. The other points you mention about the infrastructure overhead of the additional changes, I don't think they are a big problem because migration scripts for modules, even between major versions, are rare, especially if the migration script is committed together with the module code which must surely be the most common case. |
@StefanRijnhart migration scripts for a change of version are not committed at the same time as the migration module. The more recent example is in all the account related stuff: only when we have cleared the structure of the But meanwhile the module can be migrated for being used in the new version for those not migrating DB. And not only that, you can't demand a contributor to provide migration scripts for migrating the module from an old version when contributing the module migrated to the new one. About the CI overhead, I can assure you is not pleasant to wait 15/20 minutes for nothing. I commit directly sometimes for avoiding that thing and due to there's no real gain on running such CI. |
Everybody knows what it's like to wait on the CI. But that's not the same thing as the load that migration script PRs add to the total CI of the OCA. I'm sure that the merge of the invoice models in the move models caused a flurry of migration scripts when the first database migrations were being developed, but in general I think it's not unreasonable to expect the migration script in the code migration PR. I have seen that many times to be the case. |
OK, we can leave such part to the contributor decision of doing one way or another, as anyway they will need to provide the general upgrade path for doing the migration, and also the addons path for the OCA modules. |
Hi pedro & Stefan, 1) regarding pseudo moduleI think that there is some misunderstood.
My bad ! Indeed, for the time being, analysis is generated in
Yes, that is exactly what I propose ! running odoo with that option.
That is not incompatible. I propose to use a pseudo odoo module only to make the script more accessible and visible. But my objective is to stick to the standard and use the
I don't get it. What I propose is simply to put the main 2) Where are the migration scripts of the OCA modules ?
Well, it depends. Two situations :
Well, there are not a lot of migrations folders in the 2000+ OCA modules. I think it doesn't concern more than 5% of the modules in each version. Interesting point, but not a blocking one for me.
That could be great ! But it requires extra work to make a specific CI. But but there's another point you didn't address : mixted migration of instance on premise with EE modules (and contract) and OCA modules. (I may be wrong because I never used that service, so excuse me if it's not relevant)
But until now, user doesn't have to use openupgrade project for that purpose. if the final update is done without the openupgrade project, the migration will fail silently. We can assume that EE users doens't know very well the openupgrade project. |
I've submitted a PR on this PR's branch to fix the import error and refactor apriori handling. It is now imported from the --upgrade-path. It seemed safer to do this as JSON rather than a Python import. Meanwhile, the resulting analysis and an empty apriori.json are added here: legalsylvain/openupgrade-framework#2 (oh, and I'm very sorry but I removed the manifest from openupgrade_scripts because I can see another poll coming, or more than one). |
thanks !
I have to think about it.
Well, I would like to wait for valid counter-arguments from @pedrobaeza (or other people) that would indicate why a module is a bad idea. For the time being, I only see improvment explained here. #1941 (comment) |
I still don't see any advantage of using such complex scheme. You are saying it's better to have About your arguments for being better:
About my proposal for OCA modules, you have to do 2 PRs indeed, but you don't have to wait if you don't want, unless we enable a CI for such modules, but if we enable it, people will want to test such migration scripts and will prefer to do both PRs for that reason for sure. For EE migrations, there's also no theoretical problem: people still download whole OpenUpgrade repo and apply the same --upgrade-paths for the second round with Anyway, don't be naive: nearly 0 OCA modules migration scripts will work with EE migrations. Why? Because these migration scripts expect certain data scheme that belongs to OpenUpgrade, not the way Odoo EE handles the migration. Some examples:
Anyhow, I'm telling to do it as an option. Contributors that still want to bundle everything together, can do it as well. |
Sylvain mentions the visibility of the migration project, having the module with the scripts on the apps store for instance. I find that slightly misleading. But the visibility of the project could be a reason to keep the migration scripts in the module directories in the case of OCA modules, so as not to completely isolate the regular contributor from these scripts (and indeed, encourage them to contribute to those as well). |
🤔 I think what we need to answer before is: when you add |
AFAIK all are processed, no matter its source |
f301a4a
to
123c830
Compare
[IMP] guess upgrade_path, if config is not set, and openupgrade_scripts is available
Co-authored-by: David Beal <[email protected]>
0381c4a
to
d3d94f1
Compare
@yajo, @bealdav could you update your review. I think we can merge this PR, as all is green, and the generation of files are OK. (https://github.com/OCA/OpenUpgrade/tree/14.0/openupgrade_scripts/scripts) regards. |
@@ -1,2 +1,5 @@ | |||
# generated from manifests external_dependencies | |||
dataclasses | |||
odoorpc | |||
openupgradelib |
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.
Don't you need to do a git install from master for openupgradelib? AFAIK the pypi version is always bad...
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 confirm it's a bear trap to install openupgrade lib from pypi
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.
Well. Not sure to understand. When executing a migration with openupgrade project, yes we have to have the up to date library, because some function are oftently added / refactored / etc...
But for that module (upgrade_analysis
) it is using only a function table_exists
here and that function is quite simple & stable.
https://github.com/OCA/openupgradelib/blob/master/openupgradelib/openupgrade_tools.py#L30
But, if you prefer, I can replace openupgradelib
by git+https://github.com/OCA/openupgradelib.git@master
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.
It's better to always put the latest one, as we can even patch that method or improve this module using other methods of openupgradelib
when needed.
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.
done.
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.
Hi. I have a problem with that change. It is making fail the pre-commit process :
Generate requirements.txt for an addons directory........................Failed
- hook id: setuptools-odoo-get-requirements
- files were modified by this hook
Could you say me what to do ?
thanks !
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.
ah... 🤦🏼♂️
Could you please try just removing the openupgradelib line from here? I guess that dependency should be present in CIs always... (but I'm not sure)
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.
Well, I can not remove this line, because pre-commit readd this line ;-)
Generate requirements.txt for an addons directory
I so commited again what pre-commit suggests. (I mean openupgradelib
in requirements.txt
)
I propose to merge this PR as it. if someone see a better implementation, feel free to improve in another PR.
d3d94f1
to
5eeca3d
Compare
5eeca3d
to
92c7bca
Compare
/ocabot merge nobump |
On my way to merge this fine PR! |
Congratulations, your PR was merged at caee2df. Thanks a lot for contributing to OCA. ❤️ |
Work in progress. Do not review for the time being.
Done
openupgrade_records
intoupgrade_analysis
.openupgrade_records
andodoo_patch
, preserving author.upgrade.comparison.config
get the version of the target odoo.openupgrade.analysis.wizard
by a non transient modelupgrade.analysis
. it allows to make many analysis. it allows also to add in a second time, more metrics, (like number of changes, number of new models, ...)upgrade.install.wizard
, add the possibility to choose the modules to install (all the Odoo module, all the OCA modules, custom modules, etc...)get_module_path
, if it's a "non Odoo SA module" (OCA modules, custom modules) or in theupgrade_path
setting for the official modules. (this setting has to be present in the odoo.cfg file or with the option--upgrade-path
). (introduced here : [IMP] ORM: Add new --upgrade-path CLI option odoo/odoo#32650)quirk_standard_calendar_attendances
. (done here [RFR] Improve patchwork legalsylvain/server-tools#3 (comment)))Todo :
Usage :
upgrade_analysis