[16.0][IMP] Scan multiple branches on a specific repository, allowing the collect of migration data on specific modules#95
Conversation
c89898c to
3091230
Compare
There was a problem hiding this comment.
A constraint regarding the name is welcome to get a better error message (as to be an Odoo version like 18.0), currently _recompute_sequence is crashing with a wrong value.
We could even rename odoo.branch to odoo.version but it's a big change that brings no value for now (will do that later).
There was a problem hiding this comment.
odoo.version is an improvement for code readability :)
There was a problem hiding this comment.
oh boy ! it's so hard to read branch = version some time but not always :)
There was a problem hiding this comment.
Yes I agree :/ I get lost sometimes myself. It's because I first wanted to represents branches that could be an Odoo version, then changed my mind.
c11d52a to
fd6bb8c
Compare
There was a problem hiding this comment.
Specific here is not clear.
In my case I have repositories:
- oca/sale-workflow
- shopinvader/odoo-shopinvader -- is it specific ?
- forgeFlow/stock-rma (not a fork of oca/rma)
- akretion/ak-cloud-france-oi -- public modules but not a fork of OCA -- is it specific ?
- akretion/private-repo-for-just-one-project -- a dedicated private repo for modules of one projet -- is it specific ?
And :
- (gitlab)/the-project -- the project structure + some modules in
./local-src--> i don't plan scan it.
There was a problem hiding this comment.
Specific is for repositories that are hosting modules specific to a project, and they could not follow the branch naming convention (14.0, 15.0, 16.0, ...).
In your case, the (gitlab)/the-project is the specific one. Maybe akretion/private-repo-for-just-one-project as well, I can't say.
But as soon as a module could be re-used by any project simply by including the repo as a submodule, it should be qualified as generic (specific = False). It doesn't matter if this repository is private or public.
In your example, oca/sale-workflow, shopinvader/odoo-shopinvader, forgeFlow/stock-rma and akretion/ak-cloud-france-oi are generic repositories containing generic modules, shared between several Odoo implementations, and following Odoo branches naming convention.
There was a problem hiding this comment.
still unclear to me.
akretion/manufacture (fork of oca/manufacture) contains generic modules and follow only partially odoo branches namming convention.
There was a problem hiding this comment.
"follow only partially odoo branches naming convention" => because you have dev branches there you mean. But such branches should not be scanned IMO, because the goal of such short-lifespan branches is to be merged in the main ones (16.0, 18.0...).
Specific repositories == Odoo projects repositories, they host the Odoo project, and could contain modules only tied to this project (not shared to other projects), like {customer}_sale. If you create a module that could be re-used by another project, you probably want to host it in a generic repository designed for that (OCA, or an internal one).
One thing we do not want is to configure every branches on every repositories, so with generic repositories (e.g. OCA, shopinvader...) we scan all odoo.branch available, while in specific repositories (often linked to a project, which exists in only 1 Odoo version, max 2 if you are currently migrating it), you probably use main/master as your production branch, and this one represents e.g. a 16.0 version (when specific = True, you can enter manually your odoo.repository.branch records to specify that).
TL;DR:
- with
specific=False(generic), branches scanned are the availableodoo.branchrecords - with
specific=True(i.e. projects), branches to scan are configured manually
It's a convention based on what exists, but of course if you have a generic repository where we name branches v16 / v17 / v18 this pattern doesn't work anymore and would need some updates.
Beside that, a specific module (so a module scanned in a specific repository) won't have the highest priority when it comes to find modules/dependencies here and there. E.g. you have a project A repo with specific module named m, and a project B repo with specific module also named m (it's possible because they are specific repos), if later a module is scanned elsewhere (in any other repo other than A or B), having a dependency against m, it won't find it on purpose, as a specific module can have reverse dependencies only in its own repository where it is hosted.
There was a problem hiding this comment.
Maybe we could split these two notions in two separate fields:
- a boolean field
scan_default_branchesto define if branches have to be scanned based onodoo.branch(Odoo naming convention) or based on user input with specific branch names (masteretc) - a boolean field
specificto ensure its modules will have its reverse dependencies in the same repo, so they cannot be used in other repo/project
Right now both are mixed 🤔
There was a problem hiding this comment.
But such branches should not be scanned IMO, because the goal of such short-lifespan branches is to be merged in the main ones (16.0, 18.0...).
Ah ah ! if only !
I plan to scan them one way or another. We have so many PR waiting (or closed!) because of external factors or individuals.
We have also projects still in 14.0, we target publishing in OCA 18.0 and keep a back-port up-to-date.
I've made a proto few months ago, but it's far from working. Here is the big picture:
From the project page, instead of copy /pasting the module list, I copy paste our "spec.yaml", it's the gitaggretor file with shorter syntax and a module list.
The module list is then used to create symbolic links in a directory in the addon_path.
For instance:
l10n-france:
modules:
- l10n_fr_siret
src: https://github.com/OCA/l10n-france 16.0
manufacture:
modules:
- mrp_bom_component_menu
- mrp_restrict_lot
- mrp_sale_info
src: https://github.com/OCA/manufacture 16.0
manufacture-config:
modules:
- mrp_bom_configurable
src: https://github.com/akretion/manufacture 16-bom-configurableWill transform to:
./external-src/l10n-france:
merges:
- origin 18.0
remotes:
origin: https://github.com/OCA/l10n-france
target: origin 18.0
./external-src/manufacture:
merges:
- origin 18.0
remotes:
origin: https://github.com/OCA/manufacture
target: origin 18.0
./external-src/manufacture-config:
merges:
- origin 18.0-bom-configurable
remotes:
origin: https://github.com/akretion/manufacture
target: origin 18.0-bom-configurableand is piped into gitaggregator.
So with this input, I create "forked repos":
- oca/manufacture
Fork=False - akretion/manufacture
Forked=oca/manufacture
And I create akretion/manufacture#18.0-bom-configurable branch.
This branch contains the module mrp_bom_configurable for 18.0
I don't oca-scan this branch. So I get only minimum information.
But it's good enough for
- discovering which project is using this not-yet-merged module
- follow migration avancement.
- generate a spec.yaml for the project
Specific repositories
Thanks for this explaination.
It's a convention based on what exists, but of course if you have a generic repository where we name branches v16 / v17 / v18 this pattern doesn't work anymore and would need some updates.
v16 / v17 ... I think it's ok to configure it manually
Specifc module have low priority. -> yes ! We have so many "custom_reports" modules 😮💨
So, to recap the behaviors are:
- low priority because there will be duplicate names
- follows branch naming convention: 16.0 /17.0 / 18.0...
- the scan is based on white list of branches / not on all existing branches
There was a problem hiding this comment.
Ok, I understand better your workflow there. So splitting the current specific field in two with scan_default_branches + specific will make sense there, because even on your fork I guess you don't want to scan all the branches of this fork, but only a bunch of them containing strategic WIP module(s) like 18.0-bom-configurable.
There was a problem hiding this comment.
@hparfr I added a new flag manual_branches (that is set to True during the upgrade if specific was set). You can now configure your own branches while keeping modules generic.
If you want to give the priority to modules hosted in such branch (long running development branches) when resolving dependencies you can set a higher priority/sequence to the repo. For now there is no possibility to choose which module version has to be included in a project if several are available.
There was a problem hiding this comment.
It is a technical field to list the available Odoo versions that have been scanned in this repository. It is used by odoo_project to filter available versions when selecting one.
There was a problem hiding this comment.
If your project is not linked to a repository, all Odoo versions are legit, you can select the one you want.
But if your project is linked to a repository, you are forced to select an Odoo version that is available based on the branches scanned in this repository (could be a master branch representing the 14.0 version, and a 18.0-mig representing the 18.0 version, then you could select 14.0 or 18.0 when creating such project).
There was a problem hiding this comment.
so if this project is linked to a repository containing branches: "master", "main", "staging", "feat/123", "feat/125"... "feat/9999"
What is the gain ?
There was a problem hiding this comment.
To not make mistake, the user creating the project in your odoo-repository instance should not be able to select as Odoo version 16.0 if the underlying repository is hosting only versions 14.0 (for instance on master) and a 18.0 currently in migration.
There was a problem hiding this comment.
And your branch feat/9999 won't be configured in the odoo.repository.branch record (<odoo.repository>.branch_ids field) to be scan I guess as it's a short-lifespan branch, that will land probably in master soon. The tool overall aims to scan only stable/production branches, and ongoing modules development should be find through PRs (this detection is a bit wobbly now and would need to be smarter BTW).
There was a problem hiding this comment.
is it in production version ?
There was a problem hiding this comment.
No, I still didn't have time to separate the notion of "Odoo project" and "Odoo project instance". For now, odoo.project represents an instance of a project. There is no flag ATM to qualify an instance as the production/main one.
odoo.project data model should be renamed later to odoo.project.instance (or another name), and we should create the data model odoo.project that groups the instances (=> "Customer Project", having a 14.0 + 18.0 instances, the 14.0 being the production version).
There was a problem hiding this comment.
With #98 , having one project is enough for me, at the moment.
|
thanks for adressing this. It's a lot of work ! I did a partial review; I takes hours to load all of this in my head :D |
6dce834 to
7b7a9cd
Compare
On repositories, the Odoo version and branch to clone can now be set manually in the `odoo.repository.branch` relation. This allows to set different Odoo versions/branches hosted in a repository instead of one.
…ories Now that multiple Odoo versions/branches can be set on a specific repository, we are able to collect the migration data of specific modules hosted in it.
7b7a9cd to
a5af0a3
Compare
|
@hparfr if you are OK with the last change, I'll merge this one |
| from odoo.exceptions import ValidationError | ||
|
|
||
|
|
||
| class OdooBranch(models.Model): |
There was a problem hiding this comment.
So in the end, you plan to rename this class to OdooVersion ?
There was a problem hiding this comment.
Or I can already rename the class if you prefer right now :)
But won't touch all M2O here and there for now
There was a problem hiding this comment.
Ok. I don't have time to test today. Let's merge and see :)
Address #67 (partially, the split of project / project version will be done in a separate PR later).
odoo.repositoryform: