5.1 KiB
5.1 KiB
Enterprise Git Workflow & CI/CD Pipeline Policy
This document defines the mandatory Git branching model and the associated CI/CD pipeline workflow for the Copper Tone Technologies project. Adherence to this policy is required for all code changes, deletions, and additions to ensure code quality, stability, and a traceable history.
1. Branching Model
We will adopt a branching model inspired by GitFlow. The repository will have three main long-lived branches: main, testing, and develop.
-
main- This branch represents the production-ready state of the application.
- It is considered stable and deployable at all times.
- Direct pushes to
mainare strictly forbidden. - Code only gets into
mainby merging from thetestingbranch (for planned releases) or ahotfixbranch (for urgent production fixes).
-
testing- This branch serves as the pre-production integration and quality assurance environment.
- It contains features that have been integrated into
developand are undergoing comprehensive testing. - Direct pushes to
testingare forbidden. Code gets intotestingvia Pull Requests from thedevelopbranch. Once stable, it merges intomain.
-
develop- This is the primary branch for active development and integration of new features.
- It contains the latest development changes for the next release cycle.
- Direct pushes to
developare forbidden. Code gets intodevelopvia Pull Requests from feature or bugfix branches. Once stable, it merges intotesting.
Supporting Branches
These are short-lived branches that are created for specific tasks and deleted after being merged.
-
feature/<feature-name>- Purpose: To develop new features.
- Branched from:
develop - Merged into:
develop(via Pull Request) - Naming Convention:
feature/user-authentication,feature/setup-ci-pipeline
-
bugfix/<bug-name>- Purpose: To fix non-critical bugs discovered in the
developbranch. - Branched from:
develop - Merged into:
develop(via Pull Request) - Naming Convention:
bugfix/login-form-validation
- Purpose: To fix non-critical bugs discovered in the
-
hotfix/<fix-name>- Purpose: To patch a critical bug in the
main(production) branch. - Branched from:
main - Merged into:
main(via Pull Request) ANDdevelop(to ensure the fix is incorporated into future development). - Naming Convention:
hotfix/security-vulnerability-fix
- Purpose: To patch a critical bug in the
2. The Workflow Process
Every change must follow this process:
- Create a Feature/Bugfix Branch: Before writing any code, create a new
feature/*orbugfix/*branch off thedevelopbranch.git checkout develop git pull git checkout -b feature/my-new-feature - Commit Changes: Make small, logical commits on your feature branch. Write clear and concise commit messages.
- Push Branch: Push your feature branch to the remote Gitea repository.
git push -u origin feature/my-new-feature - Open a Pull Request (PR to
develop):- In the Gitea UI, open a new Pull Request.
- The target branch for the PR should be
develop. - Provide a clear title and a detailed description of the changes.
- Automated CI Checks on PR (Gitea Actions):
- Opening the PR will automatically trigger the Gitea Actions CI pipeline.
- The pipeline will run all tests (linting, unit tests, E2E tests) against the code in the PR.
- Code Review & Approval:
- (Optional, but recommended) Another team team member should review the PR.
- The PR can only be merged if all CI checks pass.
- Merge Feature/Bugfix PR: Once approved and all checks are green, the feature/bugfix branch is merged into
developusing the "Squash and Merge" option in Gitea to maintain a clean commit history on thedevelopbranch. - Merge
developtotesting(via PR):- When a set of features in
developare ready for integrated testing, a Pull Request is opened fromdeveloptotesting. - This PR triggers comprehensive integration and system tests on the
testingenvironment. - Merging this PR into
testingwill deploy the latestdevelopstate to the staging environment.
- When a set of features in
- Automated Staging Deployment: Merging into
testingwill automatically trigger a deployment to the staging environment for further testing and QA.
3. Production Release Workflow
- Prepare for Release: When the
testingbranch has passed all QA and is deemed stable for release. - Open PR from
testingtomain: A Pull Request is opened from thetestingbranch to themainbranch. - Final Checks: Any final production-specific tests or manual verifications are performed.
- Merge to
main: The PR is merged into themainbranch. - Tag and Deploy: The merge to
maintriggers the production deployment pipeline (Gitea Actions). A new version tag (e.g.,v1.0.0) is created on themainbranch to mark the release.