Publish the annia webhook through the Cloudflare Tunnel #88
Labels
No labels
blocked
bug
duplicate
effort
high
effort
low
effort
medium
effort
minimal
enhancement
help wanted
invalid
pr
feedback
pr
reviewing
question
status
backlog
status
document
status
done
status
implement
status
pending
status
planning
status
reviewing
waiting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tepichord/milner#88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Naina:
Overview
Publish
annia.vando.dev/api/hookthrough the existing Cloudflare Tunnel so Forgejo can deliver webhooks to annia's enqueuer. The change is one entry incloudflare/main.tf'swebhook_routes; DNS, the tunnel ingress, and the WAF rules all derive from that list, so nothing else in the root moves.local.hook_pathsalready contains/api/hook(Woodpecker)1, so the WAF expression stays byte-identical.Technical Approach
Add the route to
cloudflare/main.tf'swebhook_routesdefaultThe Service name/namespace/port are a contract with #89 — renaming is a two-place change.2
Re-index
run "ingress_publishes_only_the_hook_path"incloudflare/tests/plan.tftest.hcl3length(...config.ingress)34("three webhook routes plus the required catch-all")alltrueloopslice(..., 0, 2)slice(..., 0, 3)== 2== 3(same new slice)ingress[2]ingress[3]Add the new-route assertion after the Flux pair
Leave these two untouched — they are the proof the design holds
rate_limit_rule_is_free_plan_legalasserts the literal expression; if it fails,distinct()did not absorb the new path.45tests/test_gitops.py::test_flux_receiver_is_published_through_the_tunnelreads paths frommain.tf; the set stays{/api/hook, /hook/}.6Update the three documentation surfaces789
cloudflare/README.md— addannia.vando.devrow to the zone-shape table; extend the route list and "Adding a webhook endpoint" example to three routes.OPERATIONS.md§1 —Public webhook endpointsrow gains`annia.vando.dev/api/hook`.ARCHITECTURE.md§7 — turn the Woodpecker-only sentences/rows (lines ~250, ~306, ~327) into generic "webhook endpoints" coveringci/flux/annia.Verify and apply
Implementation Details
cloudflare/main.tf,cloudflare/tests/plan.tftest.hcl,cloudflare/README.md,OPERATIONS.md,ARCHITECTURE.md.cloudflare_dns_record.webhook), ingress (..._config.milner), andlocal.hook_path_expressionall iterate overvar.webhook_routes.10/api/hookis a hard contract with the enqueuer (§Research Findings).11annia.vando.devis exactly one level belowvando.dev, satisfyingcheck "webhook_hostnames_live_in_the_zone".12annia.vando.devwith path/enqueueand queueannia-wakeups; this issue supersedes both — the enqueuer serves/api/hookand publishes toannia.dispatch.Acceptance Criteria
var.webhook_routesdefault contains theannia.vando.dev//api/hook/annia-enqueuerentry.terraform -chdir=cloudflare testis green, with the four index/slice assertions re-based and the newingress[2]assertions added.rate_limit_rule_is_free_plan_legalandtest_flux_receiver_is_published_through_the_tunnelpass unmodified.terraform -chdir=cloudflare planshows exactly the new proxied CNAME and ingress entry, and no WAF rule diff.OPERATIONS.md§1, andARCHITECTURE.md§7 all listannia.vando.dev/api/hook.Testing Plan
terraform -chdir=cloudflare test— offline plan tests, mock providers.run "ingress_publishes_only_the_hook_path"— 4 ingress entries, catch-all last, all published paths match/hook, 3 distinct hostnames.rate_limit_rule_is_free_plan_legal— unchanged literal expression over two distinct paths.tests/test_gitops.py::test_flux_receiver_is_published_through_the_tunnel— unchanged.Related Issues/PRs
/api/hookpath this route targets./enqueueroute andannia-wakeupsqueue name are superseded here.annianamespace ownership.Research Findings
serviceURL carrying a path, so the route path reaches the enqueuer verbatim —/api/hookis a hard cross-issue contract./api/hooktraffic is covered with no new rule.webhook_hostnames_live_in_the_zoneguardrail thatannia.vando.devsatisfies.Pre-Mortem
applyto the user's explicit confirmation, and this environment has nocloudflare/terraform.tfvars, no.envCloudflare token, and nocontrol-plane/terraform.tfstate, so the pipeline can only run the mockedterraform test. Nothing creates the DNS record, Forgejo keeps failing to deliver toannia.vando.dev/api/hookas NXDOMAIN rather than the plan's predicted 404/502, and every acceptance box still reads green.http://annia-enqueuer.annia.svc.cluster.local:80is only a contract with #89, which is still in planning with no Deployment, no image pipeline, and one already-superseded spelling (/enqueuein #25). If #89 lands with a different Service name, namespace, port or path — or lands after this route is live — the endpoint answers 502 and, because cloudflared cannot rewrite paths, the correction is another infrastructure pull request.length == 4, twoslice(..., 0, 3),distinct == 3,ingress[3]) and addsingress[2]claims that encode list order rather than route identity, so an entry added anywhere but last contradicts them silently.cloudflare/tests/plan.tftest.hclonly executes whencloudflare/.terraformexists, and the CIteststep never runsterraform init, so a miscounted index can pass the gate meant to catch it.