Version: 0.0.7
Go to the Actions Tab on the Repo and click on the Development Environment Deployment Workflow to trigger a Deploy to a Dev Environment.
One of the 10 Dev Environments from dev-1
through dev-10
must be selected. Check here to see what Dev Environments are available for use.
Lots of people believe Trunk Based means merging commits directly into main
and deploying to Production with no Pull Requests. I have a lot of issues with that approach & mentality.
- Where's the non-prod environment ? Dev, Staging, QA ?
- Where's the CI Pipeline getting ran for tests to run ?
- If It's ran after you've already deployed your code and the CI Pipeline fails, now
main
is in a bad state and you have to manually go revert commits to get it fixed again. - Any dev pulling
main
in between this time while it's borked is fucked.
- If It's ran after you've already deployed your code and the CI Pipeline fails, now
- Where is the Code / Peer Review in this process ?
- Where is the Code Approval Step in this process ?
- Race conditions - What if Dev #1 pushed to
main
at 12:03 PM and Dev #2 pushed tomain
at 12:06 PM and their changes are incompatible with Dev #1 Changes?
main
is a Protected Branch- Short Lived Feature branches are created that must be code reviewed & approved in order to be merged into
main
- CI Runs on every commit on a PR; you cannot merge the PR if CI doesn't pass
- Deploys to
main
trigger a Deploy to a Staging Environment, not a Production Environment (otherwise when / where / how would your non-prod environment be getting deployed to & used?)- If a dedicated non-prod environment is completely unnecessary or too expensive for your use case, then this step can deploy directly to the Production Environment
- Deploys from
main
to Production happen manually either via Git Tags or Release Branches. This can happen at any cadence such as multiple times a week or just once a month.
- Short Lived Branches are created for new Feature Work or Bug Fixes by branching off the existing version of
main
- Once work is feature-complete, PRs for Feature Branches are created to merge them into
main
- CI runs on those PRs
- Optional - A Pipeline could run here either automatically or triggered manually to deploy the Feature Branch code onto a Dev Server for further QA testing.
- Once tested, code reviewed, QA'd, and the PR is approved - the PR can be squash merged into
main
- Every PR Merge into
main
triggers a Deploy to a Staging Environment - When ready for a Production Deploy, push new Git Tags
git tag v1.10.14
git push origin v1.10.14
Notes:
-
Step 5 could be rebased onto
main
instead of Squash Merge. But, fuck having 50+ dumbass commits for 1 feature deployment clogging up the commit history.- Testing was done on the entire PR branch at the moment of the latest commit; if you deploy a Feature branch with 50+ commits on it then that's the only state in which you'd want those commits in
main
. - In other words, when would you ever want to keep 49/50 of the commits but revert the #32 commit that was made or something?
- If you need to rollback then it's all or nothing, always. Revert the entire PR and the entire feature at once which is made much easier when it's 1 commit after the squash merge.
- The Pull Request History still exists.
- IMO if you're work is complex enough where you'd ever rollback half the commits after 1 PR Push then you need to break down your work into smaller tasks
- Testing was done on the entire PR branch at the moment of the latest commit; if you deploy a Feature branch with 50+ commits on it then that's the only state in which you'd want those commits in
-
Step 6 could be replaced to just automatically deploy to the Production Deployment, but I don't know how or where you'd be maintain a Staging environment in that case.
The Downsides with this approach are when you're close to a Production Deploy, you have to stop Devs from commiting to main
because maybe you tested everything on the Staging Environment for 3+ days and want to push to Production with that, and don't want a new PR to get merged which may not be compatible. This is where the Release Branch option comes into play.
The Release Branch strategy involves more stable and controlled releases if your application requires it. This strategy follows the same Workflow as above, but instead of using Git Tags you use release branches to deploy to production.
When ready for a deploy to production, you branch off of main
and create a Release Branch. This could deploy to a final QA environment or something for final testing. This allows devs to continue working on and merging their work into main
without being blocked by a pending release
git log
git revert <bad_commit_hash>
git push origin main