- TechOps Examples
- Posts
- Trunk Branching Strategy for Multi Account Environments
Trunk Branching Strategy for Multi Account Environments
Good day. It's Thursday, Sep. 19, and in this issue, we're covering:
Trunk Branching Strategy for Multi Account Environments
IBM Acquires Kubecost
Exploring OpenAI o1 in GitHub Copilot
Firewall Rules: Not As Secure As You Think
Terraform Functions and Expressions Explained
How to Setup Multi-Primary Istio in EKS and AKS for Production
SPONSORED BY REWARDFUL
For Solopreneurs Taking Your First Steps
Learn how to launch and grow an affiliate program for SaaS
Launching an affiliate program for your SaaS business can be intimidating if you’re new to it, but it is pretty simple. Rewardful has boiled it down to three core principles in their free online course:
Principle 1: Make it simple for affiliates to earn money
Principle 2: Run your program like a professional
Principle 3: Build an affiliate recruitment system
By the end of the course, you'll have a clear picture of how affiliate marketing can work for your business.
Use Case
Trunk Branching Strategy for Multi Account Environments
Managing continuous integration and delivery in multiple account setups requires a different approach from traditional Gitflow.
Trunk-based development (TBD) simplifies code branching and focuses on short-lived feature branches that directly integrate into the main (trunk) branch, providing faster feedback loops.
The strategy enables developers to commit small and frequent updates to the trunk, reducing merge conflicts and allowing a more streamlined release flow. Trunk-based development is ideal for rapid deployments across multi-account setups, with gated approvals to ensure stability.
Architecture Overview:
Ref: AWS Prespective Guidance
Here’s the simplified breakdown of the flow depicting the movement of code through various environments and approval stages from development to production.
1. Develop code on the feature/* branch in the Sandbox account.
2. Merge to sandbox/* branch and Deploy to Sandbox from sandbox/* branch for testing.
3. Create merge request for feature/* branch to merge into the main branch.
4. Build, publish artifacts, and deploy from main branch to the Develop environment.
5. Deploy with gated approval to Test environment.
6. Deploy with gated approval to Stage environment.
7. Deploy with gated approval to Production environment.
Accounts Overview:
Sandbox Account: Developers work directly on the trunk or short-lived branches, frequently merging back into the main branch. Builds and deployments are run from the trunk.
Develop/Test Accounts: After successful sandbox testing, the code moves to the develop account. This serves as the integration and QA environment for additional validation.
Stage/Production Accounts: The final environments rely on gated approvals to push code. Continuous integration ensures that only stable and verified code reaches production.
Things to Consider:
Frequent Integrations: Encourage regular integrations into the main branch to maintain stability and prevent large conflicts. This ensures the trunk stays up-to-date and avoids issues that arise when branches diverge for too long.
Short-lived Feature Branches: While feature branches are allowed, they should be brief. Developers should create a
feature/*
branch, quickly develop the feature, and merge it back into main with a pull request, preventing long-running branches.Automated Testing and Deployment: Continuous integration with automated tests ensures the main branch remains in a deployable state. Automation pipelines for deployment eliminate manual errors and speed up delivery.
Rollback Strategy: Always have a rollback strategy in place. This could involve reverting to a stable commit in main or having a hotfix strategy to quickly address urgent issues when needed.
Branch Protection Rules: Protect the main branch by enforcing rules like mandatory code reviews and automated tests before merging. This helps maintain a stable and deployable main branch at all times.
Final Thoughts: The success of trunk-based branching strategy in multi-account setups depends on frequent commits, automated testing, and proper gated approvals to keep code stable and ready for deployment without disruptions.
2024 is 71.9% complete. Start the idea you’ve been holding.
Tool Of The Day
Terrahash - Create and store a hash of the Terraform modules used by your configuration.
Trends & Updates
Resources & Tutorials
Picture Of The Day
Going through Kubernetes YAML files looking for the missing ...
Did someone forward this email to you? Sign up here