<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stanislav Spiridonov on Medium]]></title>
        <description><![CDATA[Stories by Stanislav Spiridonov on Medium]]></description>
        <link>https://medium.com/@stanislav.s?source=rss-f8ad4ea89eba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*63NDlCqcCK-xIXzO</url>
            <title>Stories by Stanislav Spiridonov on Medium</title>
            <link>https://medium.com/@stanislav.s?source=rss-f8ad4ea89eba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:53:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stanislav.s/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Green Trunk Approach]]></title>
            <link>https://medium.com/syte-engineering/the-green-trunk-approach-2c5aee87999e?source=rss-f8ad4ea89eba------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c5aee87999e</guid>
            <category><![CDATA[green-trunk]]></category>
            <category><![CDATA[staging]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[deep-linking]]></category>
            <category><![CDATA[jira]]></category>
            <dc:creator><![CDATA[Stanislav Spiridonov]]></dc:creator>
            <pubDate>Thu, 15 Dec 2022 10:50:58 GMT</pubDate>
            <atom:updated>2022-12-15T10:50:58.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fI_4GBw3eWai-QbhbVHApA.jpeg" /></figure><p>In this article, I’m going to describe the green trunk approach which helps to increase the quality and speed of new features deployments. Before we dive in, let’s review some basics first.</p><h3>The Classic Staging Approach</h3><p>Let’s assume that we have a traveling circus group. Every performer has their own act (or program) and every performance needs to be practiced and, usually, slightly modified in each new location in order to be completed correctly and safely. Once the program is modified appropriately, the show can go on without any further changes for that specific location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07dTeOEsTLoPZjAcx2WhzQ.jpeg" /></figure><p>The same approach is used in IT — meaning, before actually deploying a new version of an application to production, a separate staging environment is used for testing purposes. Just like the traveling circus group, once the application is perfected in the staging environment, it can then be presented to the intended audience.</p><p>It’s the classic way of completing IT deployment cycles. Generally, the workflow looks like this: we have a master branch for production purposes and one or more staging branches for testing purposes. Every new task is done in a separate feature branch, tested locally and merged via pull request into a staging branch. During a delivery window, the code from staging should be tested and deployed to production by merging the staging branch into the master branch.</p><h3>Drawbacks of Single Staging Environment</h3><p>However, the classic staging approach has weaknesses. For example, if there are big changes that will have a broad impact (e.g. switching one of the core libraries), the staging could be frozen until everything is thoroughly tested and all issues are resolved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJkWo3cAPUs98UwM5SYtwg.jpeg" /></figure><p>If this happens, we have two choices:</p><h4>Option 1: Revert this task from staging</h4><p>If we choose this option, we must complete the following three steps before we can continue:</p><ol><li>solve the issue</li><li>merge it back to staging</li><li>return to testing again</li></ol><p>The consequences of reverting a task from staging include:</p><ul><li>It will leave a trail in the history log.</li><li>We will not have an environment to test all issues except locally (until the issue is resolved and merged back into staging again).</li><li>If we have a lot of subsequent issues, this process can involve many cycles and take a lot of time.</li></ul><h4>Option 2: Freeze the deliveries and stabilize the staging environment</h4><p>If we choose the second option, it means we can’t deploy other smaller changes like updating title text or the style of specific elements before all issues in staging are resolved.</p><p>This could have the following consequences:</p><ul><li>Freezing deliveries could heavily decrease the effectiveness of the project.</li><li>The fact that every deployment contains a number of different features makes the revert process a bit tricky. Ultimately, one bug in one feature could ruin a lot of others when delivered in a single, inclusive update. This is especially true if we have features dependencies and we can not revert only one of them — only the full bulk of features.</li></ul><h3>How Can We Avoid These Drawbacks</h3><p>With the green trunk approach, we can avoid the problems above because every feature has its own environment which can be tested separately. Each branch is actually the production plus feature commits, like a sandbox for each specific feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cohC7W0lu7fOlpC2eVsqaQ.jpeg" /></figure><p>Now, let’s discuss the main steps that should be done in order to achieve a green trunk.</p><h4>Dynamic environments</h4><p>The first thing we have to do in order to support green trunk methodology is to configure our CI/CD in order to be able to deploy every feature branch into a specific environment. It could be a specific docker image for BE parts, different paths for web applications, specific installer programs, etc.</p><p>Now, assume we already have production and staging environments. What we have to do is build a staging-like environment for a dynamic path (usually the branch name since it’s unique). There are several options here:</p><ul><li>For web applications, we could just deploy it for a specific path.</li><li>For BE staff, we can build a specific docker image.</li><li>For databases, we can clone some part of the data (probably with some post-processing like anonymous data, etc).</li></ul><h4>Deep links</h4><p>When we have only production and staging environments, things can be hardcoded (e.g. production and staging URLs for web applications, different database addresses, etc).</p><p>If we are going to support a bunch of environments at the same time, we have to find a way to provide a specific environment parameter in order to switch part of our application to work with a specific branch environment. The solution here is deep links. For example, a deep link could be a query parameter for web apps and API, name of docker image to use, etc. For safety reasons it would be good to add some validation rules for such parameters so it will allow only specific addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOwTRwK2TrsfvIPg92YBrA.jpeg" /></figure><p>Deep links are a great improvement in terms of performance and support since they allow developers, QA members, product managers, etc to share specific environment configurations by just sending one link. The same links or mechanisms could also be used by auto testing tools.</p><h4>Issues tracker integration</h4><p>After we have an ability to deploy a dedicated environment and build one link, we can use it in order to integrate those links with issue tracking systems like JIRA, Trello, Monday, etc. The only thing we need to add is one more step in CI/CD pipelines in order to attach a link or comment with a link to a specific environment. In JIRA, for example, the web links section can be used. This allows the developer to push new changes into the repository and then a new version will be published and QA members (and anybody else related) can use this link to see the changed version without any need to run it locally.</p><h4>Git-flow</h4><p>In order to use green trunk at full power, we have to switch git flow strategy to Fast-Forward master branch. Doing so enables us to be sure that there won’t be any changes between the branch environment that we tested and that the same code base (without any changes related to the merge process) will be applied to the master branch and deployed to production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hD4ITpb1LDKqV51dO-ODxg.jpeg" /></figure><p>Note: This still would not be a panacea since the code itself could still contain some production / non production scripts, which should be minimized in order to increase stability. Examples could include minification of production scripts, omitting debug and asserts, etc.</p><h3>Green Trunk Development Flow</h3><p>Now that we’ve discussed all the necessary steps required to support the green trunk approach, let’s take a moment to consider green-trunk flow from a developer’s point of view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikTvxSsVz3YwPsRSQDnnVg.jpeg" /></figure><p>When a developer starts working on a task, the work starts from the creation of a branch for the task. After development is done, the pull / merge request to master should be created. After passing code review, the task will go to QA and all necessary links should already be added to the task in the issue tracker. After QA has finished testing with the provided links, the pull / merge request can be merged and a new version including this new feature / bugfix will be deployed to production. Finally, all other branches should be rebased (and conflicts should be resolved if any) onto a new master branch in order to get the new changes. This will enable every branch to be exactly the same as current production plus the changes required for specific features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c5aee87999e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/syte-engineering/the-green-trunk-approach-2c5aee87999e">The Green Trunk Approach</a> was originally published in <a href="https://medium.com/syte-engineering">syte_engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>