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
13 changes: 13 additions & 0 deletions scripts/cf_maildesk_cf_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import os
from pathlib import Path
import shlex
import subprocess
import sys
import time
Expand Down Expand Up @@ -150,6 +151,17 @@ def expected_storage(spec: dict[str, Any]) -> dict[str, str]:
return {key: str(storage.get(key) or "") for key in keys if storage.get(key)}


def storage_preview_command(key: str, name: str) -> str | None:
quoted_name = shlex.quote(name)
if key in {"d1_database", "d1_preview_database"}:
return f"cfctl wrangler d1 create {quoted_name} --plan"
if key in {"r2_raw_mail_bucket", "r2_raw_mail_preview_bucket"}:
return f"cfctl wrangler r2 bucket create {quoted_name} --plan"
if key == "queue":
return f"cfctl wrangler queues create {quoted_name} --plan"
return None


def normalize_alias(alias: Any, domain: str) -> str:
value = str(alias or "").strip().lower()
if not value:
Expand Down Expand Up @@ -538,6 +550,7 @@ def build_checks(
"Storage resource is missing",
expected,
sorted(present_names),
storage_preview_command(key, expected),
)
)

Expand Down
5 changes: 5 additions & 0 deletions scripts/verify_maildesk_cf_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ jq -e '
and (.drift_classes | index("missing_resource")) != null
and (.drift_classes | index("email_routing_alias_drift")) != null
and (.drift_classes | index("dns_authentication_drift")) != null
and any(.plan.operations[]; .surface == "d1.database" and .preview_command == "cfctl wrangler d1 create maildesk-cf-db --plan" and .blocked == null)
and any(.plan.operations[]; .surface == "d1.database" and .preview_command == "cfctl wrangler d1 create maildesk-cf-preview-db --plan" and .blocked == null)
and any(.plan.operations[]; .surface == "r2.bucket" and .preview_command == "cfctl wrangler r2 bucket create maildesk-cf-raw-mail --plan" and .blocked == null)
and any(.plan.operations[]; .surface == "r2.bucket" and .preview_command == "cfctl wrangler r2 bucket create maildesk-cf-raw-mail-preview --plan" and .blocked == null)
and any(.plan.operations[]; .surface == "queue" and .preview_command == "cfctl wrangler queues create maildesk-cf-jobs --plan" and .blocked == null)
' "${missing_artifact_path}" >/dev/null || die "missing-resource drift classes did not match"

cfctl_output="$(
Expand Down
Loading