DEV Community

loading...
Cover image for Let's talk about releases...

Let's talk about releases...

adancarrasco profile image Adán Carrasco ・3 min read

Releasing can be considered as the continue exposure of your project to the real world.

What you have been working on is about to be tested and used by people. Therefore it's really important that you have a good process on how you are going to deliver new features and bug fixes to your end users. Let's start by describing from a high level what is a release.

Release - High level perspective

Following the diagram showed above, releasing is simple, right? Well...

There are certain pieces that are not described in the high level diagram, as:

  • Multiple browsers/OS
  • Screen sizes
  • Accessibility
  • Compatibility with different languages
  • Different type of users (roles)
  • Variation in configurations
  • One module affecting another one
  • Having some issues in production that block users from using important flows in your App
  • An assumption that turns out is affecting the performance (A/B Testing?)
  • Etc

Since any of the previously described scenarios can cause issues while releasing, there's the need of more than 5 bubbles/steps (described before) to act accordingly and prevent or address any disasters in the release process.

When you release your code to production unexpected behaviour can happen, the local simulation/test is never enough.

There are some techniques that have been applied by different companies trough the years. One of the most common is GitFlow. Which has the following high level structure:

GitFlow

GitFlow - High level perspective

High level explanation of GitFlow (here you can see more details)

Process:

  1. Master branch (production ready state)
  2. Release branch (the code to be released)

    a. The release happens periodically (it can be every sprint, every X weeks, etc)

  3. Feature branches (each developer creates a branch and merge to develop when ready)

  4. Develop

  5. HotFix (fixes that need to go to production as they are blocking some important functionality)

Keys:

  • Testing phase - A defined time to test and stabilise the code to be released
  • Master, release, hotfix, feature and develop branches
  • Tagging your releases (Git tags)

In this approach the release happens periodically, it's more in control and there's some period of code-freeze where the release candidate gets tested to be released. If something weird happens in the middle or after the release, bugs can be fixed as a hotfix or as part of the testing phase.

Trunk based development

Trunk based development - High level perspective

High level explanation of Trunk based development (here you can see more details

Trunk based development will always be release ready

  1. There's only one main branch
  2. All the branches are feature branches and live max 2 days before they get merged into the trunk

Keys:

  • Continuous Integration (CI) - Is a technique to automate analysis in the code to be released
  • Continuous Delivery (CD) - After running the CI the new release gets deployed to either Staging or a Sandbox environment
  • Staging - It serves as a sandbox environment where the code can be tested before promoting it to production
  • Semantic versioning - Automatically calculate the version depending on the commits
  • Code Review - It's important that some guidelines and best practices are set in the project, so it can easily get reviewed by the team members, code review includes: reviewing the code to follow the those practices as well as checking it to be maintainable, readable and scalable, as part of a code review a Pull Request Template can help in speeding up the process
  • Short lived feature branches - Max 2 days living branches as they need to be merged quickly, less code, better reviews less impact/change of regressions
  • Tagging your releases (Git tags)

Not because there's only one branch that means that you will blindly commit and merge code. There are some principles that need to be followed.

As there's only one main branch it should be production ready state, to guarantee that or to minimise any side effects, more automation is required, where the effort is to verify as much as possible before releasing, to accomplish it there are several levels of automation:

  1. Testing:

    a. Unit
    b. Integration
    c. End to End
    d. Load

  2. Code analisys

    a. Code quality
    b. Security

  3. Bumping version and tagging the release

  4. Deployment

What's your team strategy?

Discussion (3)

pic
Editor guide
Collapse
arvindsridharan profile image
arvindsridharan

Thanks for your contribution towards this article.

Collapse
adancarrasco profile image
Adán Carrasco Author

Thanks @arvindsridharan ! I hope you enjoyed it! :)

Collapse
arvindsridharan profile image
arvindsridharan

Sure. It was an interesting read. I have bookmarked it for future reference.