Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

Add Go-to-Ansible bridge program for v3.7.0 release#740

Closed
cicalese wants to merge 2 commits intomainfrom
add-go-to-ansible-bridge
Closed

Add Go-to-Ansible bridge program for v3.7.0 release#740
cicalese wants to merge 2 commits intomainfrom
add-go-to-ansible-bridge

Conversation

@cicalese
Copy link
Copy Markdown
Contributor

@cicalese cicalese commented Apr 25, 2026

Summary

Adds a minimal standalone Go program that prints a migration notice directing users to install the Ansible-based Canasta CLI 4.0.0+ via get.canasta.wiki. Any invocation of the bridge prints the message — there's no half-functional state.

No existing Cobra code is modified; cmd/upgrade/upgrade.go, internal/selfupdate, build.sh, and the rest of the CLI implementation remain unchanged in this repo (which becomes Canasta-Go after rename, archived).

Files added/changed:

  • bridge/main.go (new) — the minimal program (one func main() with fmt.Println).
  • Makefile — new bridge target cross-compiles to dist/bridge/canasta-<os>-<arch> for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64. Uses -trimpath -ldflags="-s -w".
  • .gitignore — adds dist/ (build output, not committed).
  • .github/workflows/release.yml — build step now compiles the bridge from ./bridge instead of invoking build.sh. Output path and asset names unchanged, so the existing upload-artifact and publish steps work without further modification.
  • VERSION — bumped to 3.7.0. On merge, this triggers release.yml which publishes the bridge binaries as release assets at github.com/CanastaWiki/Canasta-CLI/releases/v3.7.0.

Closes #739.

Test plan

  • go vet ./bridge — OK
  • go test ./... — all existing tests pass (no regression)
  • make bridge — 4 binaries produced, ~1.5–1.6 MB each (~6.2 MB total)
  • Run dist/bridge/canasta-darwin-arm64 on macOS — message prints correctly
  • Run with arbitrary args (canasta upgrade, canasta version --help foo bar) — same message regardless
  • Mirror the exact workflow command locally (GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o build/canasta-linux-amd64 ./bridge) — produces 1.5 MB binary at the expected path
  • After merge: confirm the release workflow runs, builds 4 bridge binaries, and attaches them to a v3.7.0 GitHub release
  • After merge: on a clean VM with the previous (3.6.3) Canasta-CLI installed, run canasta upgrade. selfupdate should follow the v3.7.0 download URL, install the bridge, and the next canasta invocation should print the migration message

The 3.7.0 release is the end-of-life Canasta-CLI Go release.
release.yml now builds the bridge from ./bridge (printing the
migration notice) instead of the full Cobra CLI from build.sh.
The full Cobra source remains in the repo as archived dead code.

Bumping VERSION on merge triggers release.yml, which builds the
four bridge binaries (linux/amd64, linux/arm64, darwin/amd64,
darwin/arm64) and publishes them as release assets named
canasta-<os>-<arch> — exactly the URL pattern the existing
selfupdate code in installed binaries expects.
@cicalese
Copy link
Copy Markdown
Contributor Author

Reconsidered the bridge-binary approach. The issue: when a 3.x user runs canasta upgrade, the bridge replaces their working canasta binary with a stub that only prints a migration message and exits. Every subsequent command (canasta start, canasta backup, canasta list) becomes inert. Their wiki ops are bricked until they manually run curl … | bash.

Switching approach: instead of a bridge stub, publish the real v3.7.0 Go CLI (functional, with a deprecation warning printed to stderr on every command) and use a cross-repo release mirror so legacy clients hitting api.github.com/repos/CanastaWiki/Canasta-CLI/releases/latest find a working binary after the rename.

New PR: #741 (deprecation-warning-and-cross-repo-mirror). Highlights:

  • Adds printDeprecationWarning() in cmd/root/root.go — fires from PersistentPreRun, prints to stderr, suppressible with CANASTA_SUPPRESS_DEPRECATION_WARNING=1.
  • Adds a cross-repo mirror step to .github/workflows/release.yml using a CanastaWiki GitHub App token (skipped when the App isn't configured or when the workflow is running from CanastaWiki/Canasta-CLI itself, to defend against post-rename self-mirror).
  • No bridge/ directory, no Makefile bridge target, no full-CLI build replacement. Build pipeline keeps producing the actual Go CLI.
  • VERSION stays at 3.6.3 — bump to 3.7.0 happens in a small follow-up commit after the rename + App setup, so the release pipeline lands artifacts in the right repos (Canasta-Go regular publish + Canasta-CLI mirror).

Closing this PR without merging.

@cicalese
Copy link
Copy Markdown
Contributor Author

Closing without merging — superseded by #741 (cross-repo release mirror) per the pivot discussion in the prior comment. Branch left unmerged for reference.

@cicalese cicalese closed this Apr 25, 2026
cicalese added a commit that referenced this pull request Apr 26, 2026
… rename (#741)

Print a deprecation warning to stderr from PersistentPreRun on every
canasta invocation. The CLI continues to work normally; users see the
warning and the migration command on each command. Suppressible via
CANASTA_SUPPRESS_DEPRECATION_WARNING=1 for CI users who've intentionally
pinned 3.x.

Replaces the earlier bridge-binary plan (PR #740). The bridge approach
would have replaced the working binary with a stub that only prints a
message — bricking the user's wiki ops on the next 'canasta upgrade'.
The new approach keeps a working canasta and gives users time to
migrate.

In the release workflow, add a step after the existing publish that
mirrors the same release artifacts to CanastaWiki/Canasta-CLI. The
mirror is gated on:
  - vars.RELEASE_BOT_APP_ID being set (skipped for forks and
    pre-rename, when no GitHub App is configured), and
  - github.repository != 'CanastaWiki/Canasta-CLI' (skipped when
    the workflow is running from Canasta-CLI itself, to prevent a
    self-mirror after the rename).

After the rename (this repo becomes Canasta-Go and Canasta-Ansible
becomes the new Canasta-CLI), the GitHub App needs to be installed
on both repos and RELEASE_BOT_APP_ID / RELEASE_BOT_PRIVATE_KEY set
at the org level. Bumping VERSION in a follow-up commit then triggers
a v3.7.0 release that lands in both Canasta-Go and Canasta-CLI, so
legacy 3.x clients hitting api.github.com/repos/CanastaWiki/Canasta-CLI/
releases/latest find a working v3.7.0 binary with the deprecation
warning baked in.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Go-to-Ansible bridge program for v3.7.0 release

1 participant