Skip to content

Commit

Permalink
imp: support docker compose v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed Aug 29, 2023
1 parent aeb850f commit ac4afca
Show file tree
Hide file tree
Showing 15 changed files with 361 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
entry: poetry
args: ["check"]
files: pyproject\.toml$
pass_filenames: no
pass_filenames: false
language: system
- id: forbidden-files
name: forbidden files
Expand Down
31 changes: 17 additions & 14 deletions .pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
rev: 23.7.0
hooks:
- id: black
additional_dependencies: ["click<8.1.0"]
additional_dependencies: ["click<=8.1.7"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
Expand All @@ -79,10 +79,8 @@ repos:
name: prettier + plugin-xml
additional_dependencies:
# HACK https://github.com/prettier/pre-commit/issues/16#issuecomment-713474520
- [email protected]
- "@prettier/[email protected]"
args:
- --plugin=@prettier/plugin-xml
- [email protected]
- "@prettier/[email protected]"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand All @@ -107,35 +105,40 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==20.1.4", "importlib-metadata<5.0.0"]
name: flake8 except __init__.py, __manifest__.py
exclude: /__(?:init|manifest)__\.py$
additional_dependencies: ["flake8-bugbear==23.7.10", "importlib-metadata<=6.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==20.1.4", "importlib-metadata<5.0.0"]
additional_dependencies: ["flake8-bugbear==23.7.10", "importlib-metadata<=6.8.0"]
- id: flake8
name: flake8 only __manifest__.py
args: ["--extend-ignore=B018"] # ignore found useless expression in __manifest__.py
files: /__manifest__\.py$
additional_dependencies: ["flake8-bugbear==23.7.10", "importlib-metadata<=6.8.0"]
- repo: https://github.com/pycqa/pylint
rev: v2.15.10
rev: v2.13.5
hooks:
- id: pylint
name: pylint with optional checks
args:
- --valid-odoo-versions={{ "%.1f"|format(odoo_version) }}
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies:
- isort==5.12.0
- pylint-odoo==8.0.19
- pylint-odoo==8.0.0
- id: pylint
name: pylint with mandatory checks
args:
- --valid-odoo-versions={{ "%.1f"|format(odoo_version) }}
- --rcfile=.pylintrc-mandatory
- odoo/auto/addons
verbose: true
additional_dependencies:
- isort==5.12.0
- pylint-odoo==8.0.19
- pylint-odoo==8.0.0
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.47.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ This project itself is just the template, but you need to install these tools to
- [Docker](https://docs.docker.com/)
- [Compose V2 plugin](https://docs.docker.com/compose/)
- [git](https://git-scm.com/) 2.24 or newer
- [invoke](https://www.pyinvoke.org/) installed in Python 3.6+ (and the binary must be
- [invoke](https://www.pyinvoke.org/) installed in Python 3.8.1+ (and the binary must be
called `invoke` — beware if your distro installs it as `invoke3` or similar).
- [pre-commit](https://pre-commit.com/)
- [python](https://www.python.org/) 3.6+
- [python](https://www.python.org/) 3.8.1+
- [venv](https://docs.python.org/3/library/venv.html)

Install non-python apps with your distro's recommended package manager. The recommended
Expand Down
22 changes: 17 additions & 5 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _envops:
variable_start_string: "{{"

# Other Copier configurations
_min_copier_version: "7.0.1"
_min_copier_version: "8.1.0"
_exclude:
- _macros
- _traefik*_labels.yml
Expand Down Expand Up @@ -168,6 +168,7 @@ odoo_oci_image:
you are not using a registry.
Example: docker.io/myteam/example-odoo
default: ""

project_author:
type: str
Expand Down Expand Up @@ -215,6 +216,7 @@ gitlab_url:
💡 If you don't use Gitlab, leave this empty and ignore all other Gitlab questions.
Example: `https://gitlab.com/Tecnativa/your-doodba-project`.
default: ""

domains_prod:
type: yaml
Expand Down Expand Up @@ -270,6 +272,7 @@ domains_prod:
💡 The 1st host from the 1st domain that has no `path_prefixes` will be considered
the main one. In the example above, it'd be `www.main.com`.
default: ""

domains_test:
type: yaml
Expand Down Expand Up @@ -325,6 +328,7 @@ domains_test:
💡 The 1st host from the 1st domain that has no `path_prefixes` will be considered
the main one. In the example above, it'd be `demo1.main.com`.
default: ""

paths_without_crawlers:
multiline: true
Expand Down Expand Up @@ -366,10 +370,10 @@ postgres_version:
"14": "14"
"15": "15"
validator: >-
{% if postgres_version|int > 0 %} {% if (odoo_version >= 16.0 and
{% if postgres_version|int > 0 %} {% if (odoo_version >= 16.0 and
postgres_version|int < 12) or (odoo_version >= 14.0 and postgres_version|int < 10)
%} The postgres version is too low for the selected Odoo version. {% elif
odoo_version <= 12.0 and postgres_version|int > 14 %} The postgres version is too
odoo_version <= 12.0 and postgres_version|int > 13 %} The postgres version is too
high for the selected Odoo version. {% endif %} {% endif %}
postgres_username:
Expand Down Expand Up @@ -433,6 +437,7 @@ smtp_default_from:
In case an email coming out from odoo doesn't have a valid `From:` header address,
which address should be the default one that sends the email?
default: ""

smtp_relay_host:
type: str
Expand All @@ -448,6 +453,7 @@ smtp_relay_host:
So, what is your SMTP host?
Example: mail.example.com
default: ""

smtp_relay_port:
type: int
Expand All @@ -465,6 +471,7 @@ smtp_relay_user:
Indicate the user to connect in the SMTP server you just defined.
For Odoo to work fine, this user needs to be able to do mail spoofing.
default: ""

smtp_relay_password:
secret: true
Expand Down Expand Up @@ -500,6 +507,7 @@ smtp_canonical_default:
(https://en.wikipedia.org/wiki/SRS).
What's your canonical domain?
default: ""

smtp_canonical_domains:
when: *has_smtp
Expand All @@ -511,6 +519,7 @@ smtp_canonical_domains:
You do not need to repeat the canonical domain you indicated above.
Example: [examplemail.com, example.org]
default: ""

backup_dst:
type: str
Expand All @@ -526,6 +535,7 @@ backup_dst:
If you don't want backups, leave this empty.
Where should the backups be stored?
default: ""

backup_image_version:
type: str
Expand All @@ -548,12 +558,14 @@ backup_email_from:
configured.
What email address should it use to send them?
default: ""

backup_email_to:
type: str
when: *backup_present
help: >-
Where to send those backup reports?
default: ""

backup_deletion:
default: false
Expand All @@ -579,15 +591,15 @@ backup_tz:
backup_aws_access_key_id:
secret: true
type: str
default: null
default: ""
when: &backup_aws "{{ 's3:' in backup_dst|string }}"
help: >-
If you're using AWS S3 to store backups, provide here your access key ID.
backup_aws_secret_access_key:
secret: true
type: str
default: null
default: ""
when: *backup_aws
help: >-
If you're using AWS S3 to store backups, provide here your secret access key.
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Template maintenance tasks.
These tasks are to be executed with https://www.pyinvoke.org/ in Python 3.6+
These tasks are to be executed with https://www.pyinvoke.org/ in Python 3.8.1+
and are related to the maintenance of this template project, not the child
projects generated with it.
"""
Expand Down
6 changes: 4 additions & 2 deletions tasks_downstream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Doodba child project tasks.
This file is to be executed with https://www.pyinvoke.org/ in Python 3.6+.
This file is to be executed with https://www.pyinvoke.org/ in Python 3.8.1+.
Contains common helpers to develop using this child project.
"""
Expand Down Expand Up @@ -46,7 +46,9 @@
"build"
]["args"]["ODOO_VERSION"]
)
DOCKER_COMPOSE_CMD = shutil.which("docker-compose") or "docker compose"
DOCKER_COMPOSE_CMD = (
shutil.which("docker-compose") or f"{shutil.which('docker')} compose"
)

_logger = getLogger(__name__)

Expand Down
Loading

0 comments on commit ac4afca

Please sign in to comment.