Skip to content

[ADD] postgis_extension copier flag for geo-dependent OCA repos - #354

Closed
dnplkndll wants to merge 1 commit into
OCA:masterfrom
ledoent:feat-postgis-extension-flag
Closed

[ADD] postgis_extension copier flag for geo-dependent OCA repos#354
dnplkndll wants to merge 1 commit into
OCA:masterfrom
ledoent:feat-postgis-extension-flag

Conversation

@dnplkndll

Copy link
Copy Markdown
Contributor

Why

OCA/geospatial 17.0 and 18.0 already ship postgis/postgis:13-3.4 as their CI postgres service so CREATE EXTENSION postgis succeeds at module install time. Every copier update wipes that override because the vanilla template hardcodes postgres:*, so every cohort PR has to re-patch .github/workflows/test.yml and defend it as in-scope. See OCA/geospatial#446 for the canonical example of a workflow-change defense thread.

This flag makes the override declarative — set postgis_extension: yes once in the repo's copier-answers.yml, and the workflow regenerates with the right image on every future copier update. Eliminates a recurring toil for geospatial-flavored OCA repos.

What

  • New copier.yml boolean postgis_extension, default no, gated to odoo_version >= 16 (postgis/postgis:9.6-* tags are EOL).
  • Conditional in src/.github/workflows/test.yml.jinja that swaps postgres:*postgis/postgis:<pg>-<postgis> when the flag is on:

Both PG versions are inside Odoo's documented PostgreSQL support window (Odoo 17/18 → PG 12-16, Odoo 19 → PG 13-17).

Validation

Aggregated the OCA/geospatial 19.0 cohort (#446 + #450 + #451 + #452 + #453) onto a single branch on the ledoent fork and ran CI with the equivalent workflow change:

https://github.com/ledoent/geospatial/actions/runs/26052247018

All three jobs pass green with postgis/postgis:14-3.5 driving install + tests for base_geoengine + geoengine_partner + geoengine_base_geolocalize + website_geoengine + website_geoengine_store_locator:

Job Result Time
test with Odoo ✓ pass 1m30s
test with OCB ✓ pass 1m36s
Detect unreleased dependencies ✓ pass 5s

Backwards compatibility

default: no — repos that don't opt in see zero diff on their next copier update. The vanilla postgres:* images stay exactly as today for every existing OCA repo. Only repos that explicitly set postgis_extension: yes (today: OCA/geospatial; in the future: any geo-flavored OCA repo) get the postgis variant.

Adds a boolean copier option (default: no) that swaps the CI postgres
service from the vanilla image to postgis/postgis:<pg>-<postgis> when
the repo installs Odoo modules that need PostGIS (geo_* field types,
base_geoengine, etc.).

WHY

Today, every PR on OCA/geospatial needs to hand-patch
.github/workflows/test.yml to swap the postgres image, otherwise
'CREATE EXTENSION postgis' fails at install time and the test job dies
with 'could not open extension control file postgis.control'.

The 17.0 and 18.0 branches of OCA/geospatial already shipped a
postgis/postgis:13-3.4 override, but each copier update wipes that
modification — so reviewers see the workflow patch as 'out of scope'
on every cohort PR and authors have to defend it (see e.g. OCA/geospatial#446
where the workflow change triggered a multi-turn thread).

This flag makes the override declarative — set 'postgis_extension: yes'
once in copier-answers.yml, and the workflow regenerates with the
right image on every future copier update.

IMAGE CHOICE

Conservative defaults aligned with the existing postgres-version ladder:
  - odoo_version < 16  -> postgis/postgis:13-3.4
  - 16 <= odoo_version < 19 -> postgis/postgis:13-3.4
  - odoo_version >= 19 -> postgis/postgis:14-3.5

VALIDATION

Tested against the integrated OCA/geospatial 19.0 cohort (PRs #446 + #450
+ #451 + #452 + #453) merged on a fork branch:
https://github.com/ledoent/geospatial/actions/runs/26052247018
All three test jobs (test with Odoo, test with OCB, Detect unreleased
dependencies) pass green with postgis/postgis:14-3.5 driving install
+ tests for base_geoengine + geoengine_partner + geoengine_base_geolocalize
+ website_geoengine + website_geoengine_store_locator.

OPT-IN BEHAVIOR

Default is 'no'. Repos with no geo modules see zero diff after copier
update; the postgres:* images stay exactly as today.
@dnplkndll

Copy link
Copy Markdown
Contributor Author

@sbidoul — worth a look? Tiny default-off flag mirroring enable_checklog_odoo /
include_wkhtmltopdf. Eliminates a recurring per-PR re-patch on OCA/geospatial.

Toil evidence: test.yml has been re-patched after every dotfiles regen — 17.0: 5
commits, 18.0: 3 commits, 19.0: #446 is patch attempt #1. @leNeo even opened a
standalone #447 just to bump the image
(closed after folding into #446)

@dnplkndll
dnplkndll marked this pull request as ready for review May 18, 2026 19:42
@sbidoul

sbidoul commented May 29, 2026

Copy link
Copy Markdown
Member

Thanks for this contrib. A somewhat simpler solution to achieve the same goal has been merged in #355.

@sbidoul sbidoul closed this May 29, 2026
@dnplkndll

Copy link
Copy Markdown
Contributor Author

nice, have not considered the other ext cases like pgvector. thanks for the update.

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.

2 participants