OCA / oca-ci

Container image to run OCA CI tests
MIT License
30 stars 42 forks source link

Question : how to install non-oca modules present in other repo ? #23

Closed legalsylvain closed 2 years ago

legalsylvain commented 2 years ago

Hi.

First, thanks a lot for this tools !

I tried to change the CI of my company for my custom repositories, using oca-ci with github workflow actions.

https://github.com/legalsylvain/grap-odoo-business/runs/4869488630?check_suite_focus=true#step:4:205

The CI can't install a module (produt_print_category) that is present in the first repo (grap-odoo-incubator, not odoo nor oca). it tries via pip. how can I change the call of oca_install_addons to have the possiblity to install modules present in non OCA repositories ? The repo is correctly referenced in the oca_dependencies.txt.

thanks in advance, and sorry if my question is not relevant.

sbidoul commented 2 years ago

Hi Sylvain,

The simplest is to add git references in the test-requirements.txt file of grap/grap-odoo-business, such as odoo12-addon-product_print_category @ git+https://github.com/grap/grap-odoo-incubator#subdirectory=setup/product_print_category. It's a bit chatty but should be easy to setup. That is what we do at Acsone in such situations.

Alternatively, you could setup an internal PEP 503 package index such as devpi and publish your addons there using the oca-github-bot. It's a bit more work to setup. Or you could even configure your bot to publish to PyPI.

Do you mind if I label this as a question and not a bug ?

legalsylvain commented 2 years ago

Hi @sbidoul.

First thanks for your quick answer.

1) your suggestion works ! thanks. It's in fact more verbose, but in the other hand, it is more possible to target various PR in some tricky cases. 2) AFAIU, github actions are fully replacing travis. (pre-commit, test, etc.) Do you know the reason to keep travis in oca repositories ? I just compared Travis and "Test" github action and the github action is faster. 3) if we use only github actions, the oca_dependencies.txt file seems totally obsolete. Right ?

Or you could even configure your bot to publish to PyPI.

I usually prevent to publish grap modules Odoo appstore. The reason is that some of the modules are incubated, but can be at some point shared under OCA umbrella. If it occures, it generates conflict on the stores and the old version remains the visible one. Should be the same problem with pypi i guess.

Do you mind if I label this as a question and not a bug ?

Of course not ! the current issue template only propose "bug report" or "feature request".

legalsylvain commented 2 years ago

Addendum : i continue to deploy this strategy. For the time being, I see a limitation :

That's quite a regression regarding the previous design with the file oca_dependencies.txt (1 line before)

Except that annoying point, implementing the oca-ci is very easy. Thanks !

legalsylvain commented 2 years ago

Hi @sbidoul.

I have a trouble with one of my repository. I managed to migrate all my repo with this new syntax and it works. (for exemple : https://github.com/grap/grap-odoo-business/blob/12.0/test-requirements.txt). However, for the last repo, my CI is red here : https://github.com/grap/grap-odoo-custom/pull/217

ERROR: Could not find a version that satisfies the requirement odoo12-addon-technical_partner_access (from odoo12-addon-fiscal-company-base) (from versions: none)
ERROR: No matching distribution found for odoo12-addon-technical_partner_access
INFO: pip is looking at multiple versions of odoo12-addon-name-search-reset-res-partner to determine which version is compatible with other requirements. This could take a while.

It seems similar to https://github.com/OCA/website/issues/588#issuecomment-518017846 but :

do you have any idea ?

Note : if you find it interesting, maybe I can write a piece of OCA documentation following our exchanges, to share these answers to recurrent questions... (in that repo, or in other place, I don't know)

sbidoul commented 2 years ago

ERROR: No matching distribution found for odoo12-addon-technical_partner_access

Where is technical_partner_access supposed to come from ? Is it an OCA module or a grap module ? If it is a grap module in a different repo it should be in your test-requirements.txt.

if you find it interesting, maybe I can write a piece of OCA documentation following our exchanges, to share these answers to recurrent questions...

Sure, that would be great !

(in that repo, or in other place, I don't know)

Improving the README of this project would certainly be useful. For instance with an example GitHub workflow that uses it and a mention of test-requirements.txt, etc.

The OCA Guidelines will also need updating to mention these, and at some point, remove Travis-specific stuff.

AFAIU, github actions are fully replacing travis. (pre-commit, test, etc.) Do you know the reason to keep travis in oca repositories ? I just compared Travis and "Test" github action and the github action is faster.

For OCA 15.0 there is no more Travis. For 13 and 14, PSC can run copier update and answer GitHub instead of Travis for the CI question. For older branches, we need to implement the copier template first (https://github.com/OCA/oca-addons-repo-template/issues/103). But yeah, at some point we are going to shutdown Travis for all branches, that is the plan.

LoisRForgeFlow commented 2 years ago

Hi @legalsylvain and @sbidoul

I have run into a similar issue while setting up a CI pipeline for a private repository, using the test-requirements as you suggest works as long as you have control of the private repository the dependencies are in, because you can create the setup folder and use the syntax you suggested in the test-requirements.

However, when the repository is not under your control (odoo/enterprise) you have no way to install dependencies with pip.

Do you have any workaround for this?

Apart from this problem, the project works really well and it is faster than its predecesor.

Thanks for you help.

sbidoul commented 2 years ago

@LoisRForgeFlow actually, it is possible to package multiple addons (such as odoo/enterprise) with setuptools-odoo. This is explained in the docs. You can create your own setup.py and with a symlink structure you can package odoo/enterprise. That is what we do for our enterprise projects, so we can pip freeze it and such...

But that is not strictly necessary. If you can bring odoo/enterprise in the test image, you can simply update the Odoo addons-path in $ODOO_RC to point to it. Pip install of addons is compatible with addons path and you can mix both.

LoisRForgeFlow commented 2 years ago

@sbidoul Interesting, but if you depend in an enterprise addon you cannot package multiple addons according to the documentation (https://pypi.org/project/setuptools-odoo/#packaging-multiple-addons).

The second proposal was the hint I needed, it is working perfectly. Many thanks!

sbidoul commented 2 years ago

if you depend in an enterprise addon you cannot package multiple addons

Not sure what you mean with that ? Actually you can, because setuptools-odoo has built-in knowledge of all the CE and EE addon names and considers that dependencies on these addons are satisfied by the odoo package.

LoisRForgeFlow commented 2 years ago

@sbidoul I did not try, I just red this in the docs:

Addons that are intended to be reused or depended upon by other addons MUST be packaged individually

I understood that from that sentence, but if you do it, I have no doubt it works.

sbidoul commented 2 years ago

@LoisRForgeFlow hm, indeed that calls for a clarification. I'm adding a section to the setuptools-odoo documentation in https://github.com/acsone/setuptools-odoo/pull/79.

celm1990 commented 2 years ago

Hi,

I have same problem as @legalsylvain applied same configuration but in my case my repo is private image

For testing purpose i make the repo as public and working, any idea to working in private repo?

image

Thanks for any suggestion

sbidoul commented 2 years ago

You need to use git+ssh// URLs and find a way to bring in the ssh private key. Or you can mount your private repo in the container.

OpenCode commented 2 years ago

@LoisRForgeFlow actually, it is possible to package multiple addons (such as odoo/enterprise) with setuptools-odoo. This is explained in the docs. You can create your own setup.py and with a symlink structure you can package odoo/enterprise. That is what we do for our enterprise projects, so we can pip freeze it and such...

But that is not strictly necessary. If you can bring odoo/enterprise in the test image, you can simply update the Odoo addons-path in $ODOO_RC to point to it. Pip install of addons is compatible with addons path and you can mix both.

Hi @sbidoul. Do you have any suggestions or examples on how to add enterprise modules among those available for testing?

legalsylvain commented 2 years ago

I'm closing this issue because the question is solved. Regarding EE modules, please open a new issue.

regards.