<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":2047575,"date":"2021-12-02T17:06:00","date_gmt":"2021-12-02T15:06:00","guid":{"rendered":"http:\/\/nhub.news\/?p=2047575"},"modified":"2021-12-02T18:03:36","modified_gmt":"2021-12-02T16:03:36","slug":"trunk-based-development","status":"publish","type":"post","link":"http:\/\/nhub.news\/fr\/2021\/12\/trunk-based-development\/","title":{"rendered":"Trunk-Based Development"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>One strategy that helps a team stay in sync with changes to the codebase is known as trunk-based development. Learn more about this strategy in this post.<\/b><br \/>\nJoin the DZone community and get the full member experience. When coding an application, it is important to remain in sync with the other engineers working on the project. One strategy that helps a team stay in sync with codebase changes is trunk-based development. When employing trunk-based development, the developers working on a project make all their code changes in a common branch known as \u00ab\u00a0trunk\u00a0\u00bb. There are numerous benefits to developing with this approach, which we will discuss in this article. Trunk-based development is a version control management practice where developers merge small, frequent updates to a core trunk or main branch. It\u2019s a common practice among DevOps teams and part of the DevOps lifecycle, as it streamlines merging and integration phases. In fact, trunk-based development is a required practice of CI\/CD. Developers can create short-lived branches with a few small commits compared to other long-lived feature branching strategies. As codebase complexity and team size grow, trunk-based development helps keep production releases flowing. Trunk-based development (TBD) is a branching model for software development where developers merge every new feature, bug fix, or other code change to one central branch in the version control system. This branch is called \u201ctrunk\u201d. Trunk-based development enables continuous integration and continuous delivery by creating an environment where commits to the trunk naturally occur multiple times daily for each programmer. This makes it easy to meet the requirement of continuous integration, and have codebase to be releasable at any time, as is necessary for continuous delivery and continuous deployment. In trunk-based development, developers push code directly into the trunk. Changes made in the release branches, or snapshots of the code when it\u2019s ready to be released, are usually merged back to the trunk as soon as possible. In this approach, there are cases where bug fixes must be merged into releases, but these cases are not as frequent as the development of new features in the trunk. In cases where releases happen multiple times a day, release branches are not required at all, because changes can be pushed directly into the trunk and deployed from there. One key benefit of the trunk-based approach is that it reduces the complexity of merging events and keeps code current by having fewer development lines and by doing small and frequent merges. In other words, trunk-based development is a methodology for releasing new features and small changes quickly while helping to avoid lengthy bug fixes and \u201cmerge hell\u201d. It is a growing popular DevOps practice among Agile development teams and is often paired with feature flags or feature toggles to ensure that any new features can be rolled back quickly and easily if any bugs are discovered. The practice of feature flagging or wrapping new features in code that can be remotely toggled on and off is one common development process that software engineers employ to help to implement trunk-based development while reducing the risk of introducing bugs into the code. Because trunk-based development involves working in a single branch in the production environment, feature flags provide a way to introduce new features and changes into the code in a controlled fashion and quickly allow them to be turned off if any bugs are discovered. Trunk-based development is a required practice for continuous integration. If build and test processes are automated but developers work on isolated, lengthy feature branches that are infrequently integrated into a shared branch, continuous integration is not living up to its potential. In the trunk-based development model, there is a repository with a steady stream of commits flowing into the main branch. Adding an automated test suite and code coverage monitoring for this stream of commits enables continuous integration. When new code is merged into the trunk, automated integration and code coverage tests run to validate the code quality. The rapid, small commits of trunk-based development make code review a more efficient process. With small branches, developers can quickly see and review small changes. Teams should make frequent, daily merges to the main branch. Trunk-based development strives to keep the trunk branch \u201cgreen\u201d, meaning it\u2019s ready to deploy at any commit. Automated tests, code converge, and code reviews provide a trunk-based development project with the assurances it\u2019s ready to deploy to production at any time. This gives team agility to frequently deploy to production and set further goals of daily production releases. Trunk-based development enables teams to ship new changes to production much faster and is a prerequisite for Continuous Integration and Continuous Delivery (CI\/CD). Keeping commits and branches small allows for a more rapid tempo of merges and deployments. Feature flags nicely compliment trunk-based development by enabling developers to wrap new changes in an inactive code path and activate it at a later time. Feature flags directly encourage small batch updates. Automated testing is necessary for any modern software project intending to achieve CI\/CD. Automated tests help trunk-based development by maintaining a small batch rhythm as developers merge new commits. The automated test suite reviews the code for any issues and automatically approves or denies it. This helps developers rapidly create commits and run them through automated tests to see if they introduce any new issues. High-performing, trunk-based development teams should close out and merge any open and merge-ready branches at least on a daily basis. I hope you found this post useful and if you need any help with trunk-based development, let us know. Published at DZone with permission of Ekaterina Novoseltseva. See the original article here. Opinions expressed by DZone contributors are their own.<\/p>\n<script>jQuery(function(){jQuery(\".vc_icon_element-icon\").css(\"top\", \"0px\");});<\/script><script>jQuery(function(){jQuery(\"#td_post_ranks\").css(\"height\", \"10px\");});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>One strategy that helps a team stay in sync with changes to the codebase is known as trunk-based development. Learn more about this strategy in this post. Join the DZone community and get the full member experience. When coding an application, it is important to remain in sync with the other engineers working on the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2047574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2047575"}],"collection":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/comments?post=2047575"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2047575\/revisions"}],"predecessor-version":[{"id":2047576,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2047575\/revisions\/2047576"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media\/2047574"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media?parent=2047575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/categories?post=2047575"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/tags?post=2047575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}