Skip to content

Commit 262433c

Browse files
committed
feat: unify stand orchestration for pg-play
1 parent 4ca1e44 commit 262433c

18 files changed

Lines changed: 188 additions & 43 deletions

‎.github/workflows/publish.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
jobs:
1616
build:
1717
name: Test and build distributions
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
1919
timeout-minutes: 60
2020

2121
steps:
@@ -28,7 +28,9 @@ jobs:
2828
python-version: "3.10"
2929

3030
- name: Install test and build dependencies
31-
run: python -m pip install --upgrade pip build twine ".[test]"
31+
run: >-
32+
python -m pip install --upgrade 'pip>=24.3,<26'
33+
'build>=1.2,<2' 'twine>=6,<7' ".[test]"
3234
3335
- name: Verify tag matches package version
3436
shell: bash
@@ -88,7 +90,7 @@ jobs:
8890
publish:
8991
name: Publish distributions to PyPI
9092
needs: build
91-
runs-on: ubuntu-latest
93+
runs-on: ubuntu-24.04
9294
timeout-minutes: 15
9395
environment:
9496
name: pypi

‎.github/workflows/tests.yml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ name: tests
22

33
on:
44
push:
5+
branches:
6+
- "**"
57
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: tests-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
616

717
jobs:
818
unit:
9-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-24.04
1020
strategy:
1121
matrix:
1222
python-version: ["3.10", "3.12"]
@@ -21,7 +31,7 @@ jobs:
2131
- run: pytest
2232

2333
tls-integration:
24-
runs-on: ubuntu-latest
34+
runs-on: ubuntu-24.04
2535
needs: unit
2636
timeout-minutes: 25
2737
steps:

‎README.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Set the PostgreSQL major in `spec.postgres.version` or override it for one comma
193193
```bash
194194
pg-stand \
195195
-c configs/primary-standby-async.yaml \
196-
--postgres-version 18 \
196+
--pg-version 18 \
197197
up
198198
```
199199

@@ -262,7 +262,8 @@ are never passed to them. The `logs` command reads the active CSV file recorded
262262

263263
Managed builds validate image-schema, family, major, and base-image labels. Changing
264264
`base_image` therefore cannot silently reuse an incompatible local image with the same tag.
265-
The default PostgreSQL 10 base is `postgres:10-bullseye`; other versions use
265+
The default PostgreSQL 10 and 11 bases use `postgres:<version>-bullseye`, so managed-image
266+
builds do not depend on archived Debian Stretch repositories. Later versions use
266267
`postgres:<version>`.
267268

268269
## Certificate-only TLS
@@ -403,7 +404,7 @@ pg-stand -c CONFIG storage clean
403404

404405
## Stand lifecycle
405406

406-
Global options (`-c`, `--postgres-version`, `--tls`/`--no-tls`, and `--json`) precede the command.
407+
Global options (`-c`, `--pg-version`, `--tls`/`--no-tls`, and `--json`) precede the command. `--postgres-version` remains a compatibility alias.
407408

408409
```bash
409410
pg-stand init [--directory PATH] [--force]
@@ -673,7 +674,7 @@ docker image ls \
673674
--filter label=io.pg-stand.managed=true \
674675
--filter label=io.pg-stand.resource-kind=managed-image
675676

676-
docker image inspect pg-stand/postgres:17-pg-stand-managed
677+
docker image inspect pg-stand/postgres:18-pg-stand-managed
677678

678679
docker system df -v
679680
```
@@ -899,7 +900,7 @@ python -m build
899900
python -m twine check dist/*
900901
```
901902

902-
A tag matching the package version, for example `v0.2.0`, runs unit and Docker integration
903+
A tag matching the package version, for example `v0.2.1`, runs unit and Docker integration
903904
tests, builds the wheel and source distribution, smoke-tests the installed wheel, and publishes
904905
through PyPI Trusted Publishing. The GitHub `pypi` environment and a PyPI trusted publisher for
905906
`O2eg/pg_stand` and `.github/workflows/publish.yml` must be configured before the first release.

‎docs/pg_play-integration.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ observation commands remain the supported human interface.
66
`pg_stand` supports the hidden `pg_play/component/v1` machine transport:
77

88
```bash
9-
pg-stand --machine --request-id stand-001 capabilities
9+
pg-stand --machine --request-id stand-001 --component-capabilities
1010
pg-stand --machine --request-id stand-002 --config stand.yaml validate
1111
pg-stand --machine --request-id stand-003 --config stand.yaml plan
1212
```
1313

14+
The capability document uses `pg_play/capabilities/v1`. Every command declares
15+
the common boolean fields `mutates_target`, `machine_output`, and
16+
`accepts_plan_hash`. The public `capabilities` subcommand remains available.
17+
The `machine_interface` object records the canonical hidden option names.
18+
1419
To plan a generated `pg_configurator` candidate without rewriting the stand
1520
source, pass a JSON parameter mapping through standard input:
1621

‎pyproject.toml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pg-stand"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
description = "Declarative Docker PostgreSQL stand manager"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -36,14 +36,16 @@ dependencies = [
3636

3737
[project.optional-dependencies]
3838
test = [
39-
"pytest>=7.4",
39+
"pytest>=8.3,<9",
4040
"tomli>=2.0; python_version < '3.11'",
4141
]
4242
dev = [
43-
"pytest>=7.4",
44-
"pytest-cov>=4.1",
45-
"ruff>=0.6",
43+
"build>=1.2,<2",
44+
"pytest>=8.3,<9",
45+
"pytest-cov>=6,<8",
46+
"ruff>=0.12,<1",
4647
"tomli>=2.0; python_version < '3.11'",
48+
"twine>=6,<7",
4749
]
4850

4951
[project.scripts]

‎src/pg_stand/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
from pg_stand.config import MANAGED_POSTGRES_PARAMETERS
44

5-
__version__ = "0.2.0"
5+
__version__ = "0.2.1"
66

77
__all__ = ["MANAGED_POSTGRES_PARAMETERS", "__version__"]

‎src/pg_stand/cli.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ def _run_machine(args: argparse.Namespace) -> int:
502502
def main(argv: Sequence[str] | None = None) -> int:
503503
parser = _parser()
504504
args = parser.parse_args(argv)
505+
if args.component_capabilities:
506+
args.command = "capabilities"
507+
elif args.command is None:
508+
parser.error("a command is required")
505509
if args.machine:
506510
return _run_machine(args)
507511
try:

‎src/pg_stand/cli_parser.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def _parser() -> argparse.ArgumentParser:
6363
help="path to a pg_stand/v1 YAML configuration; optional only for active",
6464
)
6565
parser.add_argument(
66+
"--pg-version",
6667
"--postgres-version",
68+
dest="postgres_version",
6769
type=int,
6870
help="override spec.postgres.version without editing the configuration",
6971
)
@@ -87,8 +89,13 @@ def _parser() -> argparse.ArgumentParser:
8789
"--parameters-json",
8890
help=argparse.SUPPRESS,
8991
)
92+
parser.add_argument(
93+
"--component-capabilities",
94+
action="store_true",
95+
help=argparse.SUPPRESS,
96+
)
9097

91-
commands = parser.add_subparsers(dest="command", required=True)
98+
commands = parser.add_subparsers(dest="command")
9299
commands.add_parser("active", help="discover the active pg-stand lease without a config")
93100
init = commands.add_parser(
94101
"init", help="write editable example profiles and the JSON Schema into a project"

‎src/pg_stand/config.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def image_name(self) -> str:
9393
def base_image_name(self) -> str:
9494
if self.base_image:
9595
return self._resolve_image_template(self.base_image, "postgres.base_image")
96-
if self.version == 10:
97-
return "postgres:10-bullseye"
96+
if self.version in {10, 11}:
97+
return f"postgres:{self.version}-bullseye"
9898
return f"postgres:{self.version}"
9999

100100
@property

‎src/pg_stand/configs/primary-standby-async.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66

77
spec:
88
postgres:
9-
version: 17
9+
version: 18
1010
superuser: postgres
1111
initdb_args: "--data-checksums --auth-host=scram-sha-256"
1212
tls:

0 commit comments

Comments
 (0)