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
9 changes: 6 additions & 3 deletions scripts/cf_hostname_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ def default_spec_file() -> Path:
def resolve_spec_path(value: str | None) -> Path:
if value:
path = Path(value)
if not path.is_absolute():
path = ROOT / path
return path
if path.is_absolute():
return path
caller_path = Path.cwd() / path
if caller_path.exists():
return caller_path
return ROOT / path
return default_spec_file()


Expand Down
9 changes: 6 additions & 3 deletions scripts/cf_maildesk_cf_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ def default_spec_file() -> Path:
def resolve_spec_path(value: str | None) -> Path:
if value:
path = Path(value)
if not path.is_absolute():
path = ROOT / path
return path
if path.is_absolute():
return path
caller_path = Path.cwd() / path
if caller_path.exists():
return caller_path
return ROOT / path
return default_spec_file()


Expand Down
19 changes: 18 additions & 1 deletion scripts/verify_maildesk_cf_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ require_source_line() {
fixture_file="$(mktemp "${TMPDIR:-/tmp}/maildesk-cf-fixture.XXXXXX")"
missing_fixture_file="$(mktemp "${TMPDIR:-/tmp}/maildesk-cf-missing-fixture.XXXXXX")"
unverified_sender_fixture_file="$(mktemp "${TMPDIR:-/tmp}/maildesk-cf-unverified-sender.XXXXXX")"
trap 'rm -f "${fixture_file}" "${missing_fixture_file}" "${unverified_sender_fixture_file}"' EXIT
caller_spec_dir="$(mktemp -d "${TMPDIR:-/tmp}/maildesk-cf-caller-spec.XXXXXX")"
trap 'rm -f "${fixture_file}" "${missing_fixture_file}" "${unverified_sender_fixture_file}"; rm -rf "${caller_spec_dir}"' EXIT

require_source_line "worker evidence lane" '"worker.script": run_cfctl(["list", "worker.script"], lane="global"),' "${ROOT_DIR}/scripts/cf_maildesk_cf_lifecycle.py"
require_source_line "d1 evidence lane" '"d1.database": run_cfctl(["list", "d1.database"], lane="global"),' "${ROOT_DIR}/scripts/cf_maildesk_cf_lifecycle.py"
Expand Down Expand Up @@ -211,6 +212,22 @@ jq -e '
and .summary.mail_ready == true
' <<< "${cfctl_output}" >/dev/null || die "cfctl provision --plan envelope did not match"

cp "${ROOT_DIR}/state/maildesk-cf/example.json" "${caller_spec_dir}/caller-relative.json"
caller_spec_physical_dir="$(cd -P "${caller_spec_dir}" && pwd)"
caller_relative_output="$(
cd "${caller_spec_dir}"
MAILDESK_CF_EVIDENCE_FILE="${fixture_file}" \
"${ROOT_DIR}/cfctl" maildesk-cf verify --file caller-relative.json
)"
jq -e \
--arg expected_spec "${caller_spec_physical_dir}/caller-relative.json" \
'
.ok == true
and .summary.spec_path == $expected_spec
and .summary.edge_ready == true
and .summary.mail_ready == true
' <<< "${caller_relative_output}" >/dev/null || die "caller-relative maildesk-cf spec path did not resolve"

standards_output="$("${ROOT_DIR}/cfctl" standards maildesk-cf)"
jq -e '
.ok == true
Expand Down
Loading