This blog post was originally posted on our company blog at:
We are believers and practitioners of the agile manifesto and we like the 9th principle which states that “Continuous attention to technical excellence and good design enhances agility”, therefore with the current state of software development for us that means Continuous Integration and as such Trunk Based Development is a specific practice that enables CI.
We use Gitlab as our tool for CI, and therefore this is one of our most visited places all day, we thought that as a help to remind the developers to keep short-lived feature branches that we could show them a warning if the branch is older than 24 hours and help them get used into planning their tasks smaller so that they can finish them in one day and not only have their code added quickly to master and tested with others code, but also achieve multiple small successes by completing planned worked and not keeping incomplete tasks open.
Note that we are not ready to commit directly to master as it would be the ideal state of trunk based development, but we use short lived branches and feature flags.
If the branch first commit is younger than 24 hours then it will show a green checkbox
But if it's not then it will display a warning, but won’t stop the pipeline
Here is the code:
If interested in knowing more of trunk based development you can read more here:
We use Unleash for feature flags https://github.com/Unleash/unleash