Hotfix Deployment Workflow
Deploy an urgent fix directly to a production branch.
Arguments
$0— Target production branch (e.g.,coop-production,rh-production,southernlanka-staging)$1— Short description of the fix (e.g.,sequence-preallocation,critical-billing-fix)
Critical Rule
The branch name MUST end with -hotfix.
CI merge validation will block PRs from branches that do not end with -hotfix.
Step 1 — Stash Any Uncommitted Work
git stash
Step 2 — Create Hotfix Branch from Production
git fetch origin
git checkout -b $1-hotfix origin/$0
Branch name format: <description>-hotfix
Examples:
sequence-preallocation-hotfixcritical-billing-fix-hotfixpersistence-tuning-hotfix
Step 3 — Apply the Fix
Make only the minimal changes required. Do NOT port unrelated features or refactors.
Before editing persistence.xml, compare against the target production branch to understand the current state:
git show origin/$0:src/main/resources/META-INF/persistence.xml
Step 4 — Pre-Commit Checklist
- [ ]
persistence.xmluses${JDBC_DATASOURCE}/${JDBC_AUDIT_DATASOURCE}— not hardcoded JNDI names (e.g.,jdbc/coop) - [ ] No credentials or sensitive files staged
- [ ] Changes are minimal — only what is needed for the hotfix
Note: The
persistence.xmlon production branches typically uses${JDBC_DATASOURCE}environment variable placeholders, while the local developmentpersistence.xmlhas hardcoded JNDI names (e.g.,jdbc/coop). Never copy the hardcoded JNDI name into the production branch.
Step 5 — Commit
git add <changed-files>
git commit -m "fix: <description of fix>
<Explanation of why this was needed and what it fixes.>
References issues #NNNN.
Co-Authored-By: Codex <noreply@openai.com>"
Step 6 — Push
git push origin $1-hotfix
Step 7 — Create PR Targeting the Production Branch
gh pr create \
--title "fix: <description>" \
--base $0 \
--head $1-hotfix \
--body "..."
The PR must target $0 (the production branch), not development or master.
The body is public: state the defect, the fix and the deploy note, and keep the
affected hospital's record counts, production bill numbers, schema names and
data-fix steps out of it. See
What May Go Into a GitHub Issue, PR, or Comment.
Step 8 — Restore Stashed Work
git checkout <your-previous-branch>
git stash pop
Step 9 — Clean Up Old Branch (Post-Merge)
After the PR is merged:
git branch -d $1-hotfix
Common Production Branches
| Hospital/Environment | Branch |
|----------------------|----------------|
| COOP pharmacy | coop-production |
| COOP inward | coop-staging |
| Ruhunu hospital | rh-production |
| Southern Lanka (live)| southernlanka-staging |
Full map: developer_docs/deployment/ci-cd-pipeline-overview.md. CI's -hotfix
head check does not yet run for these targets (#24453); follow the naming rule anyway.