docker-compose build: /bin/sh -c /opt/odoo/private/fetch_repos_addons' returned a non-zero code: 1
nqb opened this issue · 4 comments
Hello,
When trying to start a Odoo production instance with "start odoo docker prod" handler, I got following error:
Step 1/13 : FROM lefilament/odoo:14.0 as odoo_addons
14.0: Pulling from lefilament/odoo
Digest: sha256:6ff2bf26d97b922c31f03fcc3cdcd22a28976a08a57aa82e60eb35c0d2fec94a
Status: Downloaded newer image for lefilament/odoo:14.0
---> b4590a638272
Step 2/13 : LABEL stage=builder
---> Running in 7539bfd41a45
Removing intermediate container 7539bfd41a45
---> 100978816659
Step 3/13 : USER root
---> Running in 1acd66284642
Removing intermediate container 1acd66284642
---> be91405c8b34
Step 4/13 : COPY ./private/* /opt/odoo/private/
---> 35ea218bdc87
Step 5/13 : RUN chown -R root:root /opt/odoo/additional_addons /opt/odoo/private_addons
---> Running in fd1af14d034d
Removing intermediate container fd1af14d034d
---> 79591eb66387
Step 6/13 : RUN /opt/odoo/private/fetch_repos_addons
---> Running in b826a5903317
ost recent call last):
odule>
port urlsplit
ed 'urlparse'
msg: 'Error starting project (<Service: odoo>, "The command ''/bin/sh -c /opt/odoo/private/fetch_repos_addons'' returned a non-zero code: 1")'
Cause of the issue: /home/docker/odoo/odoo/private/repos.yaml
and /home/docker/odoo/odoo/private/repos-addons.yaml
are empty.
I think there is a bug in the way Ansible generate templates.
In fact, test and prod instances use same template files:
- https://github.com/lefilament/ansible_role_odoo_docker/blob/7e7180c1ed38ab75b168f803b2fcc1bbaa65386d/templates/repos.yaml.j2
- https://github.com/lefilament/ansible_role_odoo_docker/blob/7e7180c1ed38ab75b168f803b2fcc1bbaa65386d/templates/repos-addons.yaml.j2
but when deploying test instances, we use a loop on all instances which is not the case for production instance.
Consequently, variables used inside templates when deploying a production instance are not usable.
With patch provided in #6, default settings for a prod instance and odoo_version: 14.0
, I got following files deployed:
prod-repos.yaml
automatic_bank_statement_import:
url: "git@sources.le-filament.com:lefilament/automatic_bank_statement_import.git"
branch: "14.0"
lefilament_account:
url: "git@sources.le-filament.com:lefilament/lefilament_account.git"
branch: "14.0"
lefilament_export_journal:
url: "git@sources.le-filament.com:lefilament/lefilament_export_journal.git"
branch: "14.0"
lefilament_generic_reports:
url: "git@sources.le-filament.com:lefilament/lefilament_generic_reports.git"
branch: "14.0"
lefilament_account:
url: "git@sources.le-filament.com:lefilament/lefilament_account.git"
branch: "14.0"
filament:
url: git@github.com:lefilament/link_sale_project_tasks.git
branch: "14.0"
prod-repos-addons.yaml
https://github.com/lefilament/bank-statement-import.git:
branch: "12.0-mig-account_bank_statement_import_ofx"
modules:
- account_bank_statement_import_ofx
https://github.com/OCA/knowledge.git:
branch: "14.0"
modules:
- document_page_approval
https://github.com/OCA/server-tools.git:
branch: "14.0"
modules:
- auto_backup
https://github.com/OCA/social.git:
branch: "14.0"
modules:
- mail_attach_existing_attachment
https://github.com/OCA/website-cms.git:
branch: "14.0"
modules:
- cms_delete_content
- cms_form
- cms_info
- cms_status_message
but I still got same error. Need to check but I'm almost sure this is caused by the fact that 14.0
branches doesn't exist for targeted repos.
Related to usage of 14.0 version image
Hi @nqb my bad, I forgot to push a fix for that.
I have pushed 8db26b6 for passing item to these files as well
The idea is that you should not have on the same server these files deployed for test and prod instances but only for test one (you build your image for test, you test if, if OK you use the same image in prod).
I have added the lines to be able to push files for building in prod for the case of servers where you would only deploy a prod instance and no test one, which is why you have the following when clauses on these tasks :
when: odoo_nonprod_instances is not defined and odoo_prod is defined
Let me know if it makes sense for you ?
Also none of the repo you have listed in your configuration are (yet) available for v14.0 which is most probably why your build is failing.
I have also added a fix in 2a3d95b in order to use https clone instead of ssh one by default (since ssh one requires ssh keys defined on github/gitlab)
It works, thanks for your fix.