feat(tpagectl): implement deployment promote subcommand #568
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!568
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-deployment-promote"
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?
What
Implements
deployment promoteend to end: the daemon's missingPOST /api/v1/sites/{name}/deployendpoint plus the tpagectldeployment promotesubcommand.Daemon
SiteService.Publish(ctx, siteName, version)now accepts an optional version: empty selects the highestv*tag (preserving the webhook auto-deploy path, which passes""); a non-empty version must be an existing tag of the site's repository, else a validation error (→ 400).POST /api/v1/sites/{name}/deployhandler (#206): owner-scoped (403), 200 with the newDeployment, 400 on invalid body / unknown tag / no tags, 404 when the site is missing.isValidationErrornow also maps "has no …" messages.CLI
--site(required),--version(optional; omitted → highest tag)./api/v1/sites/{name}/deploybody{"version": ...}.Deploying vX..., thenDeployed vYplus the site URL (fetched from the site status endpoint).--siteerror.{"version":""}), no-URL fallback, site 404, missing--site.Why
Phase 3 roadmap task #209.
Testing
--sitego test -race ./...passes (18 packages)golangci-lint runcleanBreaking Changes
SiteService.Publishsignature gains aversionparameter; the webhook receiver and test fakes were updated accordingly (empty string preserves existing auto-deploy behavior).Notes
#207 (deployment progress spinner) is deferred to Phase 7 progress feedback (#266) — deploy is a synchronous call, so a
Deploying vX...status line is printed instead. Branch rebased onto current main (includesdeployment get#567).Closes #205
Closes #206
Closes #208
Closes #209
Add the daemon POST /api/v1/sites/{name}/deploy endpoint and the tpagectl deployment promote subcommand. Daemon: SiteService.Publish now takes an optional version - empty selects the highest v* tag (preserving webhook auto-deploy), otherwise the version must be an existing tag. The promote handler is owner-scoped and returns 200 with the new deployment, 400 on unknown tags or no tags, 404 when the site is missing. CLI: deployment promote takes --site (required) and optional --version (omitted uses the highest tag), posts to the deploy endpoint, and prints the new active version and the site URL.Record completion of the tpagectl deployment promote subcommand and its daemon endpoint: --site with optional --version, POST /api/v1/sites/{name}/deploy, and display of the new active version and URL. Deployment progress spinner (#207) is deferred to Phase 7 progress feedback. closes #205 closes #206 closes #208 closes #20925dc8fc5102453db3b99Summary
deployment promote: daemonPOST /api/v1/sites/{name}/deploy+ tpagectl subcommand, withSiteService.Publishgaining a version parameter. Verified:go test -race ./...passes (18 packages) andgolangci-lint run ./...is clean. Closes #205/#206/#208/#209; #207 (spinner) deferred to Phase 7.Verified correctness: explicit
--versionmust match an existing tag (else 400 via "has no " mapping), empty version selects the highestv*tag (webhook auto-deploy path preserved viaPublish(..., "")), handler maps ErrNotFound→404; deploy response is the daemonDeployment, matchingdeploymentRecord.No blocking issues.
Suggestions (filed as issues)
internal/tpagectl/deployment/promote.go:60– the site-status GET used for the URL is silently best-effort; a failed URL fetch is swallowed with no indication. Filed as #569Questions
internal/site/service.go(selectVersion) – an explicit version may be any existing repo tag, including non-vtags.isPreviewDeployment(!HasPrefix(d.Version, "v")) would then classify such a production deployment as a preview during site deletion. Is promoting non-v tags intended? If so, consider whether the preview-vs-production detection needs to stay aligned.Praise
selectVersionextraction; empty-version semantics preserve the webhook pathPublishsignature change handled cleanly across the webhook receiver and all test fakes