Commit straight to production
How long is your deployment process? Does it take days or weeks before your code is on production? From my experience, it's at least a few days, usually weeks, until the official deployment is over.
I found such an approach wasteful. Why not commit straight to production?
Deployment vs. release
What's the difference between deployment and release?
Deployment happens when a new version of code appears on the server. It doesn't have to be visible yet.
On the other hand, the release means that some new feature is available to some of our users.
There is no need to do both in the same step.
Feature flags
Taking these definitions into account, we should decouple deployment from release.
And it's easy to do so with feature flags. They are becoming more and more popular.
Some CI/CD tools (e.g., Gitlab ) have APIs for this job.
Commit to production
Assuming we can hide our code behind a toggle, nothing stops us from pushing straight to production.
So what can we gain from this?
- frequent deployments make our CI/CD pipeline more healthy
- the release is now only a toggle switch
- you can plan releases separately from deployments
Of course, there is also a downside of having to maintain feature toggles. After every release, they become obsolete, and you have to clean them up.
But the amount of time saved on a faster deployment pipeline is more than enough to take care of old toggles.