Commit graph

1 commit

Author SHA1 Message Date
Claude
8c5c0fa3a0
Replace flag-based upgrade.sh with named migrate/hotfix-code modes
upgrade.sh's old -f/-w/-s flags let you skip a backup or the DB
migration independently of each other, with nothing to stop a
combination that didn't actually make sense for the change being
shipped. Replace them with two named modes:

- migrate: for a change that touches the DB. Full SQL+WAR+logs
  backup, both the existing short-lived tier and a new, never-pruned
  backup/migrations/<tag>/ tier (before/after snapshot plus the full
  DB migration transcript, tee'd from manager-exec.sh). The tag comes
  from build.xml's migrate(@host) target: the git version already
  embedded in sportrum.war's WEB-INF/VERSION (see README for the
  webapp project's own build.xml snippet this needs), plus an
  optional interactive label via Ant's <input> task.

- hotfix-code: for a Java/resource change with no DB migration. WAR
  backup only (no SQL dump, no indefinite copy), no manager-exec.sh
  at all. Only reached after check-schema-diff.sh - a new script that
  runs ICPManager's diff-meta against a staged, not-yet-installed
  copy of manager.zip, entirely independent of the live webapp/Tomcat
  - has already confirmed there's no pending schema change, hard
  gating build.xml's hotfix-code(@host) target before Tomcat is ever
  touched.

A third scenario (template-only hotfix, no Tomcat restart at all) is
intentionally not implemented yet - which files count as "templates"
and how they'd sync into the live webapp directory is still an open
question.

Dropped without replacement: the old storeonly (-s) mode and the
"leave Tomcat stopped" action argument - undocumented, flag-only
behaviors nothing here exercised, easy to reintroduce as an explicit
mode later if actually needed.

Also fixes a real gap found while testing this: a failed migration
left upgrade-cmds.sh exiting 0, which would have made upgrade.sh (and
an Ant sshexec with failonerror) report success on a failed DB
migration. And build.xml's deploy.key.passphrase had no default,
which (confirmed by testing) left the literal string
"${deploy.key.passphrase}" as the passphrase for anyone not setting
it in build.local.properties.

Verified with a full fake fixture (fake pg_dump, fake manager.zip/
manager-exec.sh, fake sportrum.war): migrate success, migrate
collision-refusal on a reused tag, migrate failure preserving the
before-snapshot without pruning, hotfix-code skipping the SQL/DB
steps, and check-schema-diff.sh's three exit codes (clean/
differences/broken) all behave as designed. Ant-side tag assembly
(<input> skip-when-preset, blank-label fallback, unsafe-character
rejection) verified the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
2026-09-30 20:00:35 +00:00