<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ankit Jain</title>
    <description>The latest articles on DEV Community by Ankit Jain (@ankitxg).</description>
    <link>https://dev.to/ankitxg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F577462%2Fd5498053-fb57-48d5-a51c-8973e27ab4a1.jpg</url>
      <title>DEV Community: Ankit Jain</title>
      <link>https://dev.to/ankitxg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankitxg"/>
    <language>en</language>
    <item>
      <title>Adopting OpenTofu as an Alternative to Terraform</title>
      <dc:creator>Ankit Jain</dc:creator>
      <pubDate>Mon, 18 Mar 2024 22:20:21 +0000</pubDate>
      <link>https://dev.to/aviator_co/adopting-opentofu-as-an-alternative-to-terraform-gb6</link>
      <guid>https://dev.to/aviator_co/adopting-opentofu-as-an-alternative-to-terraform-gb6</guid>
      <description>&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Infrastructure_as_code" rel="noopener noreferrer"&gt;Infrastructure as code (IaC)&lt;/a&gt; is a concept for deploying infrastructure like a software application. Ongoing advancements in infrastructure virtualization have made this possible. The rise of cloud computing transformed physical servers, networks, and hardware infrastructure into virtualized services. Add assets like databases, domain name service (DNS) providers, and authentication systems, and you get infrastructure that can be deployed like software.&lt;/p&gt;

&lt;p&gt;With a few lines of configuration script, you can deploy operating systems, networks, and storage to a remote data center with a single command. The system can be kept in sync with updates to the configuration, which makes changing or redeploying the infrastructure a breeze.&lt;/p&gt;

&lt;p&gt;IaC should not be confused with configuration management. Tools in this category, such as Chef, Puppet, or Ansible, typically deploy and configure software components on existing infrastructure. &lt;a href="https://www.hashicorp.com/products/terraform" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt;, on the other hand, is a provisioning tool that specializes in setting up infrastructure components like operating systems, networks, databases, users, and permissions on bare server hardware. Terraform can play hand-in-hand with configuration management tools by providing the infrastructure necessary for deploying software components.  &lt;/p&gt;

&lt;p&gt;When Terraform's licensing changed, an open-source fork called &lt;a href="https://opentofu.org/" rel="noopener noreferrer"&gt;OpenTofu&lt;/a&gt; was spun off. In this article, you'll learn about OpenTofu's features and how OpenTofu compares to Terraform. &lt;/p&gt;

&lt;p&gt;The goal of this article is to help you make an informed decision about using OpenTofu to manage your infrastructure requirements as code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is OpenTofu
&lt;/h2&gt;

&lt;p&gt;OpenTofu provides a simple but powerful configuration language to describe the infrastructure that you want to deploy. You specify the number and size of virtual servers to deploy to, the operating system to use, the virtual network overlays, the DNS settings, and anything else your infrastructure needs.&lt;/p&gt;

&lt;p&gt;Then you run a tool that reads configuration scripts written in a &lt;a href="https://opentofu.org/docs/language/" rel="noopener noreferrer"&gt;specialized configuration language&lt;/a&gt; and interacts with infrastructure resources called providers to build and deploy the required parts of the infrastructure.&lt;/p&gt;

&lt;p&gt;If anything needs to be changed, you update the script and run the tool again. The tool then updates the actual state of your infrastructure to match the description.&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenTofu and Terraform
&lt;/h3&gt;

&lt;p&gt;You may have come across the name Terraform in the context of IaC. Terraform and OpenTofu are closely related: OpenTofu is a fork of Terraform 1.5.&lt;/p&gt;

&lt;p&gt;Years ago, a company called &lt;a href="https://www.hashicorp.com/" rel="noopener noreferrer"&gt;HashiCorp&lt;/a&gt; created Terraform, among other DevOps tools like &lt;a href="https://www.vagrantup.com/" rel="noopener noreferrer"&gt;Vagrant&lt;/a&gt;, &lt;a href="https://www.packer.io/" rel="noopener noreferrer"&gt;Packer&lt;/a&gt;, &lt;a href="https://www.nomadproject.io/" rel="noopener noreferrer"&gt;Nomad&lt;/a&gt;, &lt;a href="https://www.vaultproject.io/" rel="noopener noreferrer"&gt;Vault&lt;/a&gt;, and &lt;a href="https://www.consul.io/" rel="noopener noreferrer"&gt;Consul&lt;/a&gt;. All these tools aim at automating software orchestration and infrastructure management.&lt;/p&gt;

&lt;p&gt;Terraform's approach to provisioning infrastructure consists of a three-step workflow: write, plan, and apply. In the write step, you define the resources needed to run the infrastructure. In the plan step, Terraform compares the written infrastructure definition against the existing infrastructure and creates an execution plan for creating, updating, or destroying resources as needed. Finally, in the apply step, Terraform applies the planned changes to the target infrastructure.&lt;/p&gt;

&lt;p&gt;To utilize as many infrastructure resources as possible, Terraform uses a plugin system that allows resource providers, such as DNS services, container orchestration systems, database services, or logging systems, to be included.&lt;/p&gt;

&lt;h4&gt;
  
  
  Terraform's License Change
&lt;/h4&gt;

&lt;p&gt;Terraform had become a popular IaC tool when HashiCorp, its maker, decided to change the license for their tools from the &lt;a href="https://www.mozilla.org/en-US/MPL/2.0/" rel="noopener noreferrer"&gt;Mozilla Public License (MPL) 2.0&lt;/a&gt; to the &lt;a href="https://www.hashicorp.com/bsl" rel="noopener noreferrer"&gt;Business Source License (BSL)&lt;/a&gt;. This move aimed to protect HashiCorp from competitors who could set up hosted Terraform offers just like HashiCorp had and reap the benefits without contributing back.&lt;/p&gt;

&lt;p&gt;HashiCorp is not the first company to make this move. Earlier, companies like &lt;a href="https://www.mongodb.com/" rel="noopener noreferrer"&gt;MongoDB&lt;/a&gt;, &lt;a href="https://redis.com/" rel="noopener noreferrer"&gt;Redis&lt;/a&gt;, and &lt;a href="https://www.cockroachlabs.com/" rel="noopener noreferrer"&gt;Cockroach Labs&lt;/a&gt; also decided to restrict the ability to resell their (otherwise open source) code for similar reasons.&lt;/p&gt;

&lt;p&gt;Nevertheless, HashiCorp's announcement raised concerns among Terraform users about the possible legal implications of the license switch. It didn't take long until the latest MPL-licensed Terraform version got forked. The fork was originally named OpenTF but was later renamed to OpenTofu due to trademark concerns.&lt;/p&gt;

&lt;p&gt;Because Terraform 1.6.x and beyond will be under the new BSL, the OpenTofu project cannot take over changes made to Terraform anymore. While OpenTofu aims to keep feature parity with Terraform, and both projects come with a backward compatibility promise &lt;a href="https://developer.hashicorp.com/terraform/language/v1-compatibility-promises" rel="noopener noreferrer"&gt;(1)&lt;/a&gt; and &lt;a href="https://opentofu.org/docs/language/v1-compatibility-promises" rel="noopener noreferrer"&gt;(2)&lt;/a&gt;, the two projects may slowly diverge.&lt;/p&gt;

&lt;h4&gt;
  
  
  Changes Introduced after the Fork
&lt;/h4&gt;

&lt;p&gt;After the fork, the &lt;a href="https://github.com/opentofu/opentofu/blob/v1.6/CHANGELOG.md#160-unreleased" rel="noopener noreferrer"&gt;changelog for OpenTofu 1.6.0&lt;/a&gt; lists several significant changes, including the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conditional GNU Privacy Guard (GPG) validation bypass for the default registry&lt;/li&gt;
&lt;li&gt;Changes to the &lt;code&gt;cloud&lt;/code&gt; and &lt;code&gt;remote&lt;/code&gt; backends and the &lt;code&gt;login&lt;/code&gt; and &lt;code&gt;logout&lt;/code&gt; commands that no longer default to &lt;code&gt;app.terraform.io&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A new &lt;code&gt;tofu test&lt;/code&gt; command that significantly changes how tests are written and executed&lt;/li&gt;
&lt;li&gt;Several enhancements and bug fixes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, the OpenTofu community continues to add changes to its &lt;a href="https://github.com/opentofu/opentofu/milestones" rel="noopener noreferrer"&gt;roadmap&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is OpenTofu a Viable Alternative to Terraform
&lt;/h2&gt;

&lt;p&gt;If you're in search of an IaC tool, you'll need to decide between Terraform and OpenTofu. Existing Terraform users even have three options to consider: Whether to stay with Terraform, switch to OpenTofu now, or stick with Terraform 1.5.x for a while and watch future developments closely.&lt;/p&gt;

&lt;p&gt;For both audiences, there are numerous reasons for choosing the free and open source (FOSS) alternative.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compatibility
&lt;/h3&gt;

&lt;p&gt;As of this writing, OpenTofu is fully compatible with Terraform 1.5.x, but the list of features will increasingly diverge in the future. The &lt;a href="https://opentofu.org/faq" rel="noopener noreferrer"&gt;OpenTofu FAQ&lt;/a&gt; has a clear statement about a community-driven approach shaping OpenTofu's future: "The community will decide what features OpenTofu will have."&lt;/p&gt;

&lt;p&gt;However, OpenTofu will remain backward-compatible so that existing Terraform configurations (made with Terraform up to 1.5.x) continue to work with future versions of OpenTofu (per the &lt;a href="https://opentofu.org/manifesto/" rel="noopener noreferrer"&gt;OpenTofu Manifesto&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Additionally, the OpenTofu core team confidently &lt;a href="https://opentofu.org/faq/#decisions" rel="noopener noreferrer"&gt;predicts&lt;/a&gt; that "the large number of developers pledging their resources to help develop OpenTofu will accelerate the development of features and enable faster releases than Terraform managed previously." In other words, features that Terraform users have been anticipating for some time may come to life faster with OpenTofu than with Terraform.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Free and Open License
&lt;/h3&gt;

&lt;p&gt;The compatibility question may fade in the future when OpenTofu and Terraform are established as two independent projects and interested parties have a decent list of features to compare before settling on one of the tools. Switching between the two will become less frequent.&lt;/p&gt;

&lt;p&gt;What will remain is the question of the license under which each of the projects is offered. Terraform's BSL is a source-available license that does not guarantee that users can use the code in their preferred manner. Notably, users may not include Terraform in offerings to third parties that compete with HashiCorp's offerings. (See the "Additional Use Grant" in the &lt;a href="https://www.hashicorp.com/bsl" rel="noopener noreferrer"&gt;HashiCorp BSL&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;In contrast, OpenTofu is licensed under the MPL 2.0, a true FOSS license that grants users the right to use the code as they wish. Having a true FOSS license means that development is driven by the community that was built around OpenTofu, which is large and thriving. The &lt;a href="https://opentofu.org/supporters" rel="noopener noreferrer"&gt;list of supporters&lt;/a&gt; includes more than 150 companies and more than 780 individuals.&lt;/p&gt;

&lt;p&gt;Additionally, OpenTofu has been adopted by the Linux Foundation, a step that guarantees vendor-neutral governance of the project. The Linux Foundation maintains several projects that are used worldwide, including &lt;a href="https://www.linux.org/" rel="noopener noreferrer"&gt;Linux&lt;/a&gt;, &lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt;, and &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Choose OpenTofu over Terraform
&lt;/h2&gt;

&lt;p&gt;Reasons for choosing OpenTofu vary based on the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Companies&lt;/strong&gt; may have the largest incentive to choose OpenTofu. Use cases for an IaC tool are constantly at risk of conflicting with the BSL. Moreover, the Terraform project changed its license unexpectedly, and it may do so again. With a true open source license and under the umbrella of a nonprofit foundation, OpenTofu provides a far more predictable future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Digital agencies and consultants&lt;/strong&gt; should strive to offer their clients a solution whose legal basis is predictably stable and immune to the opaque decisions of a single company. OpenTofu is not only that. It's also backed by a &lt;a href="https://opentofu.org/supporters/" rel="noopener noreferrer"&gt;large list of supporters&lt;/a&gt; who joined forces to enhance and extend OpenTofu based on the wishes of the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Individual users&lt;/strong&gt; may feel unaffected by Terraform's switch to the BSL. But then there is little that speaks against using OpenTofu instead, which comes under a more open license. While the BSL might have little effect on individual, noncommercial users, nobody knows what possible future changes to the Terraform license will bring. Choosing an open source project now, when switching costs are low, is the sensible choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can Terraform Still Be a Good Choice?
&lt;/h2&gt;

&lt;p&gt;With all the obvious advantages of truly open-source projects, it would seem that no one would choose to use Terraform. Don't judge too quickly, though. It's not all black and white. &lt;/p&gt;

&lt;p&gt;For instance, Terraform’s availability as a cloud service when paired with Hashicorp’s enterprise-level support, could be a combo that's difficult for other competitors to match.&lt;br&gt;
Moreover, some customers might conclude that their Terraform use cases are not negatively affected by Terraform's switch from an open-source license to a source-available license.&lt;/p&gt;

&lt;p&gt;Granted, these advantages are rather specific to particular customers and use cases. OpenTofu might catch up on these aspects quickly—never underestimate the power of open source.&lt;/p&gt;

&lt;h2&gt;
  
  
  OpenTofu Continues to Evolve
&lt;/h2&gt;

&lt;p&gt;As mentioned previously, OpenTofu and Terraform are likely to take different paths in the future. With hundreds of supporters committed to shaping the future of OpenTofu, the open source path is likely the one that leads to a more feature-rich and mature product than Terraform.&lt;/p&gt;

&lt;p&gt;For example, in August 2023, &lt;a href="https://twitter.com/OpenTofuOrg/status/1696597790661677207" rel="noopener noreferrer"&gt;OpenTofu announced&lt;/a&gt; an experimental implementation of end-to-end encryption for state files, a feature that Terraform users have been &lt;a href="https://github.com/hashicorp/terraform/issues/516" rel="noopener noreferrer"&gt;waiting for since 2014&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Chances are that there will be more of these initiatives to implement long-awaited features soon.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future of IaC Tools Is Open Source
&lt;/h2&gt;

&lt;p&gt;The power of open source should not be underestimated. For any company, consultant, or developer whose business model might be threatened by the sudden license change of Terraform, the OpenTofu project provides a solid open source alternative.&lt;/p&gt;

&lt;p&gt;OpenTofu is compatible with Terraform and aims to stay that way. It's a Linux Foundation project free of business tactics and legal insecurity. And it's backed by a large and active community.&lt;/p&gt;

&lt;p&gt;While the BSL forbids certain kinds of uses of Terraform, the MPL 2.0 grants users complete freedom in using OpenTofu. The Linux Foundation has a track record of widely successful open source projects, and OpenTofu is a worthy addition.&lt;/p&gt;

&lt;p&gt;Existing Terraform users may envision a few risks when making the switch to OpenTofu, but those risks are more than mitigated by the stability that an open source, foundation-led project provides. The best time for making the switch is now, while the two projects are still similar enough to enable a smooth transition.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>opentofu</category>
      <category>iac</category>
    </item>
    <item>
      <title>Pre and post-merge tests using a merge queue</title>
      <dc:creator>Ankit Jain</dc:creator>
      <pubDate>Thu, 14 Mar 2024 22:43:06 +0000</pubDate>
      <link>https://dev.to/aviator_co/pre-and-post-merge-tests-using-a-merge-queue-478g</link>
      <guid>https://dev.to/aviator_co/pre-and-post-merge-tests-using-a-merge-queue-478g</guid>
      <description>&lt;p&gt;One of the key ingredients making developers productive is faster feedback loops. A fast feedback loop allows developers to identify and address issues promptly, leading to higher-quality code and faster release cycles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-merge and Post-merge tests
&lt;/h2&gt;

&lt;p&gt;To maintain the good health of your system, there are a few types of tests that may be required. Validating these tests can take anywhere from a sub-second to several hours.&lt;/p&gt;

&lt;p&gt;In the traditional waterfall model, testing is often a phase that occurs after development. However, the emphasis is on catching issues early in agile development and CI/CD workflows. But running all the tests can be extremely time-consuming, and provides slow feedback to the developers.&lt;/p&gt;

&lt;p&gt;Instead, consider dividing tests into “pre-Merge” and “post-Merge” buckets. For instance, explore how LinkedIn &lt;a href="https://engineering.linkedin.com/blog/2020/continuous-integration" rel="noopener noreferrer"&gt;manages pre-merge and post-merge workflows&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Splitting the tests
&lt;/h2&gt;

&lt;p&gt;There are a couple of considerations to split the tests effectively:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The pre-merge tests should be faster to execute ensuring a fast feedback cycle for the developers&lt;/li&gt;
&lt;li&gt;On the other hand, the post-merge tests should be generally more stable. If these tests fail often, we end up in a constant state of failed mainline. But, we should still expect these tests to fail occasionally. If a test doesn’t ever fail, it’s not worth running!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So let’s apply that to some types of tests, these answers may vary depending on your setup but should be generally agreeable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code linting
&lt;/h3&gt;

&lt;p&gt;Pre-merge: Linting could catch a bug early in the developer lifecycle, and is both cheap and fast to run.&lt;/p&gt;

&lt;h3&gt;
  
  
  Unit tests
&lt;/h3&gt;

&lt;p&gt;Pre-merge: They help catch bugs at the smallest level, ensuring that each piece of the puzzle works independently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integration testing
&lt;/h3&gt;

&lt;p&gt;Pre-merge: Integration tests verify the interactions between various modules, ensuring a cohesive and functional application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automated regression testing
&lt;/h3&gt;

&lt;p&gt;Post-merge: Running tests to identify anything that was previously working that may have regressed. We expect these would fail less often but are still essential to maintain code health.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance testing
&lt;/h3&gt;

&lt;p&gt;Post-merge: As changes are deployed over time, the performance of the software may be impacted, this is where performance testing is important. We do not expect every change to impact the performance, and these tests should not fail often.&lt;/p&gt;

&lt;h3&gt;
  
  
  User Acceptance Testing (UAT)
&lt;/h3&gt;

&lt;p&gt;Post-merge: Any type of manual QA or UAT should be handled post-merge as we expect these to be extremely slow. In most cases, if we identify a failure, it is typically resolved in future releases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing the split
&lt;/h2&gt;

&lt;p&gt;Now that we have the tests split, we can still catch most of the issues in the development cycle, and provide fast feedback to the developer. But what happens when the post-merge tests fail?&lt;/p&gt;

&lt;p&gt;In most cases, you coordinate with the release team to roll back the change that caused the failure or roll forward a fix manually. This manual process can be annoying and can also cause poor developer experience.&lt;/p&gt;

&lt;p&gt;This is where MergeQueue could play an interesting role.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the MergeQueue
&lt;/h2&gt;

&lt;p&gt;Before delving into the intricacies of managing pre and post-merge tests with the queue, let’s take a moment to understand the role of MergeQueue in the CI/CD pipeline. MergeQueue acts as a gatekeeper, managing code merges and orchestrating the deployment process. If you are unfamiliar with merge queues in general, &lt;a href="https://www.aviator.co/blog/what-is-a-merge-queue/" rel="noopener noreferrer"&gt;here’s a good primer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most of the modern merge queues offer some variance of an &lt;a href="https://docs.aviator.co/mergequeue/concepts/parallel-mode" rel="noopener noreferrer"&gt;optimistic parallel mode&lt;/a&gt;. In such a mode, as changes are submitted to the queue, it creates an optimistic batch that contains all queued changes including the most recent submitted one. This batch is then validated again for all the tests to ensure that it does not break the mainline before merging the PRs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fast forwarding merge
&lt;/h3&gt;

&lt;p&gt;A small variation of this optimistic parallel mode is called a fast-forwarding merge. The main difference in the case of fast-forwarding is that you are fast-forwarding the mainline (e.g. master) to these validated commit SHAs instead of creating new commit SHAs when the PRs are actually merged post-validation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fduziuylvox11qd95tw0q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fduziuylvox11qd95tw0q.gif" alt="Fast-forward merge example" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Post-merge is actually post-queue
&lt;/h3&gt;

&lt;p&gt;Using the image above, you can think of the queued PRs as part of a “staging” branch. So as new commits are being added, those get “merged” into this staging. branch before they land on mainline. If we use that lens, we can run the “post-merge” test in the queue instead of running them after the changes are merged in mainline.&lt;/p&gt;

&lt;p&gt;From the developer feedback viewpoint, the experience of “handing over” the PR to the queue is the same as merging the PR. But now, your rollbacks can be automated. Since the queue validates the changes before forwarding the mainline, any failure detected gets force pushed out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd108pvo3rv26aztnskt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd108pvo3rv26aztnskt.gif" alt="Fast-forward merge failure" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer experience
&lt;/h2&gt;

&lt;p&gt;As a developer, the workflow would be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a PR, run the pre-merge test, and request a code review&lt;/li&gt;
&lt;li&gt;Once the changes are approved and the tests pass, instead of merging the PR, they can enqueue it&lt;/li&gt;
&lt;li&gt;MergeQueue will create a new branch with the squash commit of changes and run the CI on it. Developers can still access this staging branch if they want to access the latest codemix, knowing that it may still not have all the tests validated.&lt;/li&gt;
&lt;li&gt;If all the tests pass, the mainline is fast-forwarded to this commit SHA, the original PR is flagged as merged.&lt;/li&gt;
&lt;li&gt;If any of the required tests fail, the mainline is not impacted, and the developer is notified about the failed tests and the PR remains open for the developer to fix the issue and submit again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Behind the scenes
&lt;/h2&gt;

&lt;p&gt;The queue runs all the post-merge tests, which may be slow but usually pass. The mainline is always green because the changes are completely validated before they reach mainline. You would want to configure &lt;a href="https://docs.aviator.co/mergequeue/how-to-guides/customize-required-checks#override-checks-for-parallel-mode" rel="noopener noreferrer"&gt;separate test execution and validation&lt;/a&gt; for the PRs created by developers and the branches created by the queue. Aviator MergeQueue provides a &lt;a href="https://docs.aviator.co/mergequeue/concepts/optimizing-ci-execution" rel="noopener noreferrer"&gt;simple branching structure&lt;/a&gt; to split the test execution in all the common CI platforms for efficient CI usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In one of our old posts, we also talked about the death by a thousand papercuts due to the &lt;a href="https://www.aviator.co/blog/engineering-efficiency-calculator/" rel="noopener noreferrer"&gt;broken mainline&lt;/a&gt;, but maintaining a faster feedback cycle is also critical for an improved developer experience.&lt;/p&gt;

&lt;p&gt;Using MergeQueue to split the tests (pre-queue and post-queue) is a great way to balance both sides of the problem while improving developer productivity.&lt;/p&gt;

</description>
      <category>cicd</category>
      <category>automation</category>
      <category>mergequeue</category>
    </item>
    <item>
      <title>This branch is out-of-date</title>
      <dc:creator>Ankit Jain</dc:creator>
      <pubDate>Mon, 02 Aug 2021 18:17:57 +0000</pubDate>
      <link>https://dev.to/ankitxg/this-branch-is-out-of-date-1hb6</link>
      <guid>https://dev.to/ankitxg/this-branch-is-out-of-date-1hb6</guid>
      <description>&lt;p&gt;When you are working by yourself or with a small school project team the source control requirements are pretty low. You do not have to worry about keeping builds healthy all the time or the impact broken builds may have on others. But the story is very different when one is working in large engineering teams. Therefore, most engineering teams rely on Github protected branch rules to ensure stability of the application.&lt;/p&gt;

&lt;p&gt;One of the most common restrictions that developers use in Github protected branches is to require status checks to pass before merging. This ensures that the CI is completed successfully before merging the changes into the protected branch (typically master or main).&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mavbktkhzyesv788kng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mavbktkhzyesv788kng.png" alt="Protected branch restrictions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There’s one additional restriction that requires branches to be up to date before merging. This ensures that the pull requests have been tested with the latest code before merging in the protected branch. This prompt typically shows up in the Pull Request asking developers to update their branch. This setting is less commonly used today, and we will look into why.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftaufhe4w0nr18pi6rzev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftaufhe4w0nr18pi6rzev.png" alt="Update branch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;So what’s the point of having branches up to date before merging? I recently ran into this scenario, so let me explain with an example:&lt;/p&gt;

&lt;p&gt;Let’s say Joseph and Ashley are working on a web application for food ordering service. They are working on a feature to offer a discount for users who would order ahead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PR #1&lt;/strong&gt;: Joseph made the following change to calculate the discount offered to the users.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1mgzy25ihbhpy9wexnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1mgzy25ihbhpy9wexnc.png" alt="Discount offered PR snippet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PR 2&lt;/strong&gt;: Ashley adds a new API endpoint that will be used to charge users.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3bplughutd5winvaexi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3bplughutd5winvaexi.png" alt="API endpoint"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can imagine, the changes independently look pretty safe and pass the test, but when combined together will break the build as the signature of charge_order has changed.&lt;/p&gt;

&lt;p&gt;These types of scenarios are very common in large teams where multiple engineers would be working on the same code base. In those cases, it is safer to enable the restriction that requires branches to be up to date before merging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side effect
&lt;/h2&gt;

&lt;p&gt;Before you go and turn on that knob in Github, you should understand one side-effect from using this configuration. I remember after we turned it on, engineers started spending a bunch of time playing rebase-athon. So in the above example, let’s say both Ashley and Joseph are ready to merge the changes. Now if they do not communicate with each other, they may both rebase their branches with the latest master and wait for CI to finish. Whoever notices a finished CI would merge the changes, leaving the other developer to start the rebase process from scratch.&lt;/p&gt;

&lt;p&gt;This can be optimized using a custom Github action to keep branches up to date. Every time a PR is merged, a Github action can be triggered to update the rest of the branches. Some companies have internally built a system to manage this whole process, for example &lt;a href="https://eng.uber.com/research/keeping-master-green-at-scale/" rel="noopener noreferrer"&gt;SubmitQueue at Uber&lt;/a&gt; or &lt;a href="https://shopify.engineering/introducing-the-merge-queue" rel="noopener noreferrer"&gt;Merge Queue at Shopify&lt;/a&gt;. There are also some plug and play versions of similar concepts, the one I’ve used in the past is called &lt;a href="https://mergequeue.com/" rel="noopener noreferrer"&gt;MergeQueue&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The bottom line is that as your team grows, optimizing the code merging process may become critical. This Github setting to restrict branches to be up to date before merging may seem a bit of an overhead, but would pay off to give you and your team peace of mind.&lt;/p&gt;

</description>
      <category>github</category>
      <category>productivity</category>
      <category>devops</category>
      <category>codereview</category>
    </item>
    <item>
      <title>7 Github apps to supercharge your dev teams in 2021</title>
      <dc:creator>Ankit Jain</dc:creator>
      <pubDate>Fri, 12 Feb 2021 03:07:24 +0000</pubDate>
      <link>https://dev.to/ankitxg/7-github-apps-to-supercharge-your-dev-teams-in-2021-3i2o</link>
      <guid>https://dev.to/ankitxg/7-github-apps-to-supercharge-your-dev-teams-in-2021-3i2o</guid>
      <description>&lt;p&gt;Today Github has become not only the hub for all open source projects but also the goto tool for most technology companies. Although the workflows and requirements for the developer teams working in companies may vary a lot from the open source community, Github’s offerings are ubiquitous. However, there are some ways to supercharge your workflows further if you are working in a high-output development team.&lt;/p&gt;

&lt;p&gt;There are thousands of Github apps and extensions available today on Github marketplace. Most of them are centered around improving developer productivity. There are a wide variety of such tools to boost code review process, continuous integration, build and deployment automation, project management, security or monitoring. Finding and integrating the right tools can increase developer productivity with as much as 2x. Here’s some of the tools we found on Github marketplace that can visibly move the needle for the most teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Slack For Github
&lt;/h2&gt;

&lt;p&gt;Many teams already use Slack today, adding a &lt;a href="https://slack.github.com/" rel="noopener noreferrer"&gt;Github integration for Slack&lt;/a&gt; ensures that your team stays on top of all the action happening, and be notified when they have pending code reviews. The app is managed by Github themselves. Although, if you are working in a big team this can easily get very noisy. Therefore it is important to tune your notifications to cut through the noise. Slack for Github offers a bunch of notifications including new commits, new pull requests, new issues, code reviews, new releases and deployment statuses. They also recently launched the Slash commands to open and close pull requests and issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  ImgBot
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/marketplace/imgbot" rel="noopener noreferrer"&gt;ImgBot&lt;/a&gt; automatically optimizes your images using lossless compression. If your team is specifically working on a web application, fast load times are very important for the user experience. With ImgBot you can be certain that your images are optimized without sacrificing the quality of images. ImgBot reviews your source code after you merge your new image files and sends a pull request with all the images optimized. It also crawls your source code the first time you install the app to retroactively update existing images. It offers a peace of mind for your media assets and one thing off the plate of developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  MergeQueue
&lt;/h2&gt;

&lt;p&gt;How many hours do you struggle to keep your builds green or waste hours with broken builds? &lt;a href="https://mergequeue.com/" rel="noopener noreferrer"&gt;MergeQueue&lt;/a&gt; is a new Github collaboration tool that enqueues your pull requests to be merged sequentially. Github also recently launched an &lt;a href="https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/automatically-merging-a-pull-request" rel="noopener noreferrer"&gt;auto-merge&lt;/a&gt; feature that enables developers to automatically merge after CI is complete, but misses the cases where multiple developers can collectively cause build breakage. MergeQueue works with any type of CI that your current Github environment supports.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codecov
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://about.codecov.io/" rel="noopener noreferrer"&gt;Codecov&lt;/a&gt; provides great visibility into the source code coverage. The tool has come a long way, and now offers support for pretty much every &lt;a href="https://docs.codecov.io/docs/supported-languages" rel="noopener noreferrer"&gt;programming language&lt;/a&gt;. You can define the requirements of coverage percentage before a PR can be merged into the main repository. It also gives you coverage reports posted as comments on the PR itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  CodeFactor
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codefactor.io/" rel="noopener noreferrer"&gt;CodeFactor&lt;/a&gt; offers static analysis for your code. They also support most of the common programming languages. It’s a great way to keep your code quality high without sacrificing developer time to do thorough code reviews. It is also a great way to identify silly mistakes before they make it to the main source branch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stale
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/marketplace/stale" rel="noopener noreferrer"&gt;Stale&lt;/a&gt; bot is managed by Github themselves. It automatically closes the stale PRs and issues after a period of inactivity. The bot also has a great feature where it first labels the PR as stale, reminding folks that this change would be closed if no further action is taken. And then eventually closes the change after a duration of inactivity. A simple configuration file helps you define the duration of flagging something as stale and the duration of inactivity to close the PR or issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dependabot Preview
&lt;/h2&gt;

&lt;p&gt;Many of you may already be familiar with the &lt;a href="https://docs.github.com/en/github/administering-a-repository/about-dependabot-version-updates" rel="noopener noreferrer"&gt;Dependabot&lt;/a&gt; that helps keep all your dependencies up to date. When it identifies a stale dependency, it creates a pull request to update the build configuration to the latest version. It manages the versioning using the semantic versioning server called &lt;a href="https://semver.org/" rel="noopener noreferrer"&gt;semver&lt;/a&gt;. Dependabot is now officially managed by Github and is &lt;a href="https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/" rel="noopener noreferrer"&gt;natively supported&lt;/a&gt; without any apps needed. All you need to do is set a &lt;a href="https://help.github.com/en/github/administering-a-repository/enabling-and-disabling-version-updates#enabling-github-dependabot-version-updates" rel="noopener noreferrer"&gt;dependabot.yml&lt;/a&gt; file in your root directory.&lt;/p&gt;

&lt;p&gt;There are clearly a variety of Github apps, and there may not be a one-size-fits-all approach, but we have found using this set of tools puts a lot of manual work on autopilot and frees up time for developers to do more meaningful work. Configuring some of these tools may feel time consuming, but one time configuration can yield a lot of saved hours for your team.&lt;/p&gt;

&lt;p&gt;If you have found any other interesting Github apps, please leave a comment or DM me, I would love to check them out and update my list.&lt;/p&gt;

</description>
      <category>github</category>
      <category>productivity</category>
      <category>codequality</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
