Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/launchplane-authz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ workflow_refs = [
event_names = ["workflow_dispatch"]
products = ["odoo"]
contexts = ["opw"]
actions = ["odoo_post_deploy.execute", "odoo_prod_rollback.execute"]
actions = ["odoo_post_deploy.execute", "odoo_prod_backup_gate.execute", "odoo_prod_rollback.execute"]

[[github_actions]]
repository = "cbusillo/odoo-tenant-cm"
Expand All @@ -132,7 +132,7 @@ workflow_refs = [
event_names = ["workflow_dispatch"]
products = ["odoo"]
contexts = ["cm"]
actions = ["odoo_post_deploy.execute", "odoo_prod_rollback.execute"]
actions = ["odoo_post_deploy.execute", "odoo_prod_backup_gate.execute", "odoo_prod_rollback.execute"]

[[github_actions]]
repository = "cbusillo/launchplane"
Expand Down
4 changes: 2 additions & 2 deletions config/launchplane-authz.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ workflow_refs = [
event_names = ["workflow_dispatch"]
products = ["odoo"]
contexts = ["opw"]
actions = ["odoo_post_deploy.execute", "odoo_prod_rollback.execute"]
actions = ["odoo_post_deploy.execute", "odoo_prod_backup_gate.execute", "odoo_prod_rollback.execute"]

[[github_actions]]
repository = "example-org/odoo-tenant-cm"
Expand All @@ -131,7 +131,7 @@ workflow_refs = [
event_names = ["workflow_dispatch"]
products = ["odoo"]
contexts = ["cm"]
actions = ["odoo_post_deploy.execute", "odoo_prod_rollback.execute"]
actions = ["odoo_post_deploy.execute", "odoo_prod_backup_gate.execute", "odoo_prod_rollback.execute"]

[[github_actions]]
repository = "example-org/launchplane"
Expand Down
42 changes: 42 additions & 0 deletions control_plane/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
OdooArtifactPublishRequest,
execute_odoo_artifact_publish,
)
from control_plane.workflows.odoo_prod_backup_gate import (
OdooProdBackupGateRequest,
execute_odoo_prod_backup_gate,
)
from control_plane.workflows.promote import (
build_executed_promotion_record,
build_promotion_record,
Expand Down Expand Up @@ -8720,6 +8724,11 @@ def odoo_artifacts() -> None:
"""Odoo artifact publish driver commands."""


@main.group("odoo-backup-gates")
def odoo_backup_gates() -> None:
"""Odoo backup-gate driver commands."""


@main.group()
def service() -> None:
"""Launchplane service commands."""
Expand Down Expand Up @@ -9251,6 +9260,39 @@ def odoo_artifacts_publish(
raise click.ClickException(result.error_message or "Odoo artifact publish failed.")


@odoo_backup_gates.command("capture")
@click.option(
"--database-url",
envvar=_DATABASE_URL_ENV_KEYS,
required=True,
help="Postgres connection string for Launchplane backup-gate and Dokploy target records.",
)
@click.option("--context", required=True)
@click.option("--instance", default="prod", show_default=True)
@click.option("--backup-record-id", required=True)
@click.option("--timeout", "timeout_seconds", type=int, default=None)
def odoo_backup_gates_capture(
database_url: str,
context: str,
instance: str,
backup_record_id: str,
timeout_seconds: int | None,
) -> None:
result = execute_odoo_prod_backup_gate(
control_plane_root=_control_plane_root(),
record_store=_store(Path("state"), database_url=database_url),
request=OdooProdBackupGateRequest(
context=context,
instance=instance,
backup_record_id=backup_record_id,
timeout_seconds=timeout_seconds,
),
)
click.echo(json.dumps(result.model_dump(mode="json"), indent=2, sort_keys=True))
if result.backup_status != "pass":
raise click.ClickException(result.error_message or "Odoo backup gate failed.")


@main.group("release-tuples")
def release_tuples() -> None:
"""Release tuple state commands."""
Expand Down
Loading