Skip to content

feat(configure): configure the tools each step runs from deploy.yml - #52

Draft
nilshamerlinck wants to merge 1 commit into
mainfrom
feat/tool-options-from-deploy-yml
Draft

nilshamerlinck wants to merge 1 commit into
mainfrom
feat/tool-options-from-deploy-yml

Conversation

@nilshamerlinck

@nilshamerlinck nilshamerlinck commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Problem

The venv and config steps built fixed command lines:

odoo-venv create --project-dir <dir> --preset project
odoo-config create --version <v> [--preset <p>] --instance-dir=<dir> -c <conf> <--key=value overrides…>

Nothing in deploy.yml could reach the rest of either tool's interface. An instance whose
Odoo source lives outside its own directory could not pass --odoo-dir/--addons-path, and
--enterprise, --from, --from-env, --env-prefix and --output-format were unreachable.

Solution

A tools section holds command-line options per tool:

odoo-v20e-demo:
  tools:
    odoo-venv:
      preset: demo
      odoo-dir: /opt/odoo/code/odoo/odoo/20.0/
      addons-path: /opt/odoo/code/odoo/odoo/20.0/addons,/opt/odoo/code/odoo/enterprise/20.0
    odoo-config:
      enterprise: true
      version: 20.0
odoo-venv create --project-dir /opt/odoo/odoo-v20e-demo --preset demo \
  --odoo-dir /opt/odoo/code/odoo/odoo/20.0/ --addons-path …

odoo-config create --version 20.0 --instance-dir /opt/odoo/odoo-v20e-demo \
  --config /opt/odoo/odoo-v20e-demo/config/odoo.conf --enterprise --db_user=… …

Keys are merged over the options deploy passes by default, so each option is passed exactly
once:

  • a key matching a default overrides it, in place
  • true renders a bare flag, false/null drops the option — including a default
  • a list repeats the option (from: [a, b]--from a --from b)
  • values are shell-quoted

tools.odoo-config.version additionally short-circuits version detection, which would
otherwise probe the codebase and prompt interactively for a version the config already gives.

Why tools.odoo-config is separate from config

odoo-config create runs with ignore_unknown_options, so anything it does not declare
becomes an odoo.conf value override — and a declared boolean passed as --enterprise=true
is rejected outright. CLI options and config values cannot share one namespace. config: is
unchanged and still writes values into odoo.conf.

Scope

update's odoo-venv update is deliberately untouched: --odoo-dir/--addons-path are
creation-time concerns that .odoo-venv.toml already persists.

Cosmetic change to existing deployments: -c is now spelled --config and
--instance-dir=x as --instance-dir x, so both are merge-addressable. Click treats them
identically.

Tests

Eleven tests covering both steps: unchanged commands without a tools section, options
appended, a built-in overridden, one dropped with false, a list repeated, values quoted,
a tools section naming only one tool, odoo.conf overrides still trailing, and version
detection skipped when tools.odoo-config.version is set.

Full suite: 103 passed. Ruff format clean; ruff check reports only the pre-existing UP042
on DeployType.

The venv and config steps built fixed command lines:

    odoo-venv create --project-dir <dir> --preset project
    odoo-config create --version <v> [--preset <p>] --instance-dir=<dir> -c <conf> <overrides>

Nothing in deploy.yml could reach the rest of either tool's interface, so an
instance whose Odoo source lives outside its own directory could not pass
--odoo-dir/--addons-path, and --enterprise, --from, --output-format and friends
were out of reach entirely.

A `tools` section now holds command-line options per tool, keyed by the name of
the command it configures:

    odoo-myproject-staging:
      tools:
        odoo-venv:
          odoo-dir: /opt/odoo/code/odoo/odoo/20.0/
          addons-path: /opt/odoo/code/odoo/odoo/20.0/addons
        odoo-config:
          enterprise: true
          version: 20.0

The keys are merged over the options deploy passes by default, so each option is
passed exactly once: a matching key overrides the default in place, `true` gives
a bare flag, `false`/null drops the option, a list repeats it, and values are
shell-quoted. `tools.odoo-config.version` also short-circuits version detection,
which would otherwise prompt for a version the config already supplies.

`tools.odoo-config` is deliberately separate from `config`: odoo-config treats
any option it does not declare as an odoo.conf value, so the two cannot share a
namespace. `update`'s `odoo-venv update` is untouched — --odoo-dir/--addons-path
are creation-time concerns that .odoo-venv.toml already persists.
@nilshamerlinck
nilshamerlinck force-pushed the feat/tool-options-from-deploy-yml branch from ee52795 to aa0f0c3 Compare September 22, 2026 10:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant