<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CICD - TheCodeBuzz</title>
	<atom:link href="https://thecodebuzz.com/category/cicd/feed/" rel="self" type="application/rss+xml" />
	<link>https://thecodebuzz.com</link>
	<description>Best Practices for Software Development</description>
	<lastBuildDate>Tue, 22 Aug 2023 23:48:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://thecodebuzz.com/wp-content/uploads/2022/11/cropped-android-chrome-512x512-1-1-51x51.jpg</url>
	<title>CICD - TheCodeBuzz</title>
	<link>https://thecodebuzz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Identify Azure Pipeline Id For Devops In ADO</title>
		<link>https://thecodebuzz.com/identify-azure-pipeline-id-for-devops-ado/</link>
					<comments>https://thecodebuzz.com/identify-azure-pipeline-id-for-devops-ado/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 25 Mar 2022 04:05:00 +0000</pubDate>
				<category><![CDATA[ADO]]></category>
		<category><![CDATA[CICD]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[azure devops api get pipeline]]></category>
		<category><![CDATA[azure devops api get pipeline variables]]></category>
		<category><![CDATA[azure devops get all pipeline runs]]></category>
		<category><![CDATA[azure devops get pipeline run id]]></category>
		<category><![CDATA[azure devops get pipeline status]]></category>
		<category><![CDATA[azure devops pipeline api]]></category>
		<category><![CDATA[azure devops pipeline call rest api]]></category>
		<category><![CDATA[azure devops rest api get pipeline stages]]></category>
		<category><![CDATA[Get azure devops ID]]></category>
		<category><![CDATA[identify-azure-pipeline-id-for-devops-ado]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21393</guid>

					<description><![CDATA[<p>Identify Azure Pipeline Id For Devops In ADO Today in this article, we will see how to Identify Azure Pipeline Id For Devops In ADO. We will see 2 simple approaches to find the pipeline ID. In the first approach, we will use the AZ command to get details about the pipeline, and 2nd is [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/identify-azure-pipeline-id-for-devops-ado/">Identify Azure Pipeline Id For Devops In ADO</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Identify Azure Pipeline Id For Devops In ADO</h1>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-For-Pipeline-In-ADO.jpg" alt="Identify Azure Pipeline Id For Devops In ADO" class="wp-image-21409" width="706" height="362"/></figure>



<p>Today in this article, we will see how to Identify Azure Pipeline Id For Devops In ADO.</p>



<p></p>



<p>We will see 2 simple approaches to find the pipeline ID. </p>



<p></p>



<p>In the first approach, we will use the AZ command to get details about the pipeline, and 2nd is a more kind of manual approach to get the Ids.</p>



<p></p>



<p>Today in this article, we will cover below aspects,</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-approach-1-using-az-command-to-get-the-pipeline-id-and-other-information">Approach 1- Using AZ command to get the pipeline ID and other information</a><ul><li><a href="#aioseo-command">Command</a></li><li><a href="#aioseo-example">Example</a></li></ul></li><li><a href="#aioseo-approach-2--using-ado-pipeline-edit-command-to-pipeline-id-and-other-information">Approach 2- Using ADO Pipeline Edit command to pipeline ID and other information</a></li></ul></div>



<p></p>



<h2 class="wp-block-heading" id="aioseo-approach-1-using-az-command-to-get-the-pipeline-id-and-other-information">Approach 1- Using AZ command to get the pipeline ID and other information </h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-command">Command</h3>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az pipelines show --organization <a href="https://dev.azure.com/" target="_blank" rel="noreferrer noopener">&lt;your org name</a>&gt; --project &lt;project name&gt; --name &lt;name&gt;</pre>



<p></p>



<h3 class="wp-block-heading" id="aioseo-example">Example</h3>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">az pipelines show --organization https://dev.azure.com/jan2022-thecodebuzz --project globalexceptionhandler --name globalexceptionhandler

</pre>



<p id="block-4d30cd88-6e03-409f-9dd0-119cd0e7a93a">As highlighted below, the response from the <em>API shows the Id returned as 5</em></p>



<p></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="447" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-1024x447.jpg" alt="Identify AzureDevOps Id For Pipeline In" class="wp-image-21400" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-1024x447.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-300x131.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-768x336.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-1536x671.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-2048x895.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-build-pipeline-find-build-Id-785x343.jpg 785w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>While using the above command you might need to log in again to confirm the connections setting ,</p>



<p></p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/identify-my-azuredevops-id-for-a-pipeline-in-ado-pipelines.jpg" alt="" class="wp-image-21398" width="402" height="310" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/identify-my-azuredevops-id-for-a-pipeline-in-ado-pipelines.jpg 890w, https://thecodebuzz.com/wp-content/uploads/2022/03/identify-my-azuredevops-id-for-a-pipeline-in-ado-pipelines-300x232.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/identify-my-azuredevops-id-for-a-pipeline-in-ado-pipelines-768x593.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/identify-my-azuredevops-id-for-a-pipeline-in-ado-pipelines-674x520.jpg 674w" sizes="(max-width: 402px) 100vw, 402px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-approach-2--using-ado-pipeline-edit-command-to-pipeline-id-and-other-information">Approach 2- Using ADO Pipeline Edit command to pipeline ID and other information  </h2>



<p></p>



<p>You can also use the ADO Pipeline Edit command to get pipeline ID and other information manually as shown below,</p>



<p></p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-1024x640.jpg" alt="" class="wp-image-21412" width="601" height="375" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-1024x640.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-300x188.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-768x480.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-1536x961.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO-785x491.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/03/Identify-Azure-DevOps-Id-of-Pipeline-In-ADO.jpg 1575w" sizes="auto, (max-width: 601px) 100vw, 601px" /></figure>



<p></p>



<p>Once you click on <strong>EDIT</strong>, you can find the pipeline ID with the URL below,</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-1024x434.jpg" alt="" class="wp-image-21401" width="738" height="313" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-1024x434.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-300x127.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-768x325.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-1536x651.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually-785x333.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/03/Azure-DevOps-pipeline-build-Id-manually.jpg 1956w" sizes="auto, (max-width: 738px) 100vw, 738px" /></figure>



<p></p>



<p><strong>References</strong>: </p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/create-https-nginx-on-linux-azure-virtual-machine-ubuntu/" target="_blank" rel="noreferrer noopener" title="Create HTTP with NGINX on Linux in Azure Virtual Machine"><em>Create HTTP with NGINX on Linux in Azure Virtual Machine</em></a></li>
</ul>



<p></p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/identify-azure-pipeline-id-for-devops-ado/">Identify Azure Pipeline Id For Devops In ADO</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/identify-azure-pipeline-id-for-devops-ado/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Automating Azure DevOps Build Pipelines using Run Pipeline API</title>
		<link>https://thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/</link>
					<comments>https://thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 20 Mar 2022 00:30:00 +0000</pubDate>
				<category><![CDATA[ADO]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[CICD]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[automating build pipeline creation using azure devops services rest api]]></category>
		<category><![CDATA[azure devops build pipeline apie]]></category>
		<category><![CDATA[azure devops get all pipeline runs]]></category>
		<category><![CDATA[azure devops rest api - run pipeline example]]></category>
		<category><![CDATA[azure devops rest api - run pipeline with variables]]></category>
		<category><![CDATA[azure-devops-build-pipelines-using-run-pipeline-api-automatazure devops api run pipeline with parameters]]></category>
		<category><![CDATA[create release pipeline in azure devops using rest api]]></category>
		<category><![CDATA[trigger azure devops pipeline rest api]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=21387</guid>

					<description><![CDATA[<p>Automating Azure DevOps Build Pipelines using API &#8211; Guidelines Today in this article, we will see how to use API for Automating Azure DevOps Build Pipelines using Run Pipeline API. We will see an example of how to trigger Azure Pipelines build via API. AS we learned in the last article we have below two [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/">Automating Azure DevOps Build Pipelines using Run Pipeline API</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Automating Azure DevOps Build Pipelines using API &#8211; Guidelines</h1>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api.jpg" alt="Automating Azure DevOps Build Pipelines using Run Pipeline API" class="wp-image-21348" width="722" height="371" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api.jpg 906w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-300x155.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-768x396.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/how-to-queue-a-new-build-using-vsts-rest-api-785x405.jpg 785w" sizes="auto, (max-width: 722px) 100vw, 722px" /></figure>



<p>Today in this article, we will see how to use API for Automating Azure DevOps Build Pipelines using Run Pipeline API.</p>



<p>We will see an example of how to trigger Azure Pipelines build via API. AS we learned in the last article we have below two approaches to call REST API for Build pipeline,</p>



<p></p>



<ul class="wp-block-list"><li>Build -Queue API</li><li>Runs – Run Pipeline API</li></ul>



<p></p>



<p>We already looked at the <a href="https://www.thecodebuzz.com/trigger-azure-pipelines-build-api-automating-azure-devops/" target="_blank" rel="noreferrer noopener" title="API for automating Azure DevOps Build Pipelines – Part 1">Build queue</a> approach in the previous article. </p>



<p>Today in this article, we will cover below aspects,</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-trigger-a-build-using---run-pipeline">Trigger a build using &#8211; Run Pipeline</a></li><li><a href="#aioseo-configuration-and-security">Configuration and security</a></li></ul></div>



<p>For more details please see below article,</p>



<p></p>



<ul class="wp-block-list"><li><a href="https://www.thecodebuzz.com/trigger-azure-pipelines-build-api-automating-azure-devops/" title="API for automating Azure DevOps Build Pipelines – Part 1" target="_blank" rel="noreferrer noopener"><em><strong>API for automating Azure DevOps Build Pipelines – Part 1</strong></em></a></li></ul>



<p></p>



<p>Both approaches have similar settings/configuration steps and hence they are easy to configure.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-trigger-a-build-using---run-pipeline">Trigger a build using &#8211; Run Pipeline</h2>



<p></p>



<p> <strong>Build pipeline</strong> </p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1</pre>



<p></p>



<p><strong>Build pipeline With optional parameters</strong></p>



<p></p>



<p><strong>POST API</strong></p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">POST POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?pipelineVersion={pipelineVersion}&amp;api-version=6.0-preview.1</pre>



<p></p>



<p><strong>Input Parameters</strong></p>



<p></p>



<p>In the above Post request below are the input parameters,</p>



<p></p>



<ul class="wp-block-list"><li><strong><em>organization </em> </strong>&#8211; The name of the Azure DevOps organization.</li></ul>



<ul class="wp-block-list"><li><em><strong>project</strong>  </em>&#8211; Project ID or project name</li></ul>



<ul class="wp-block-list"><li><strong><em>api version </em></strong>&#8211; Version of the API to use. </li></ul>



<p></p>



<p><strong>Request Body </strong></p>



<p></p>



<ul class="wp-block-list"><li><strong><em>definition </em></strong>&#8211; The build number/name of the build.</li></ul>



<p></p>



<p>Below is our sample repository,</p>



<p></p>



<p class="has-medium-font-size"><a href="https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_build">https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_build</a></p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1024x622.jpg" alt="start-a-build-and-passing-variables-through-azure-devops-rest-api" class="wp-image-21341" width="598" height="363" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1024x622.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-300x182.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-768x466.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-1536x933.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api-785x477.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-azure-pipelines-build-via-api.jpg 1976w" sizes="auto, (max-width: 598px) 100vw, 598px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-configuration-and-security">Configuration and security </h2>



<p></p>



<p>Let&#8217;s now configure the API to be invoked securely.</p>



<p></p>



<p>Step1- Click on the User settings and set up the personal access token.</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-730x1024.jpg" alt="start-a-build-and-passing-variables-through-azure-devops-rest-api" class="wp-image-21342" width="313" height="439" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-730x1024.jpg 730w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-214x300.jpg 214w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled-371x520.jpg 371w, https://thecodebuzz.com/wp-content/uploads/2022/03/UntitAPI-for-automating-Azure-DevOps-Pipelinesled.jpg 765w" sizes="auto, (max-width: 313px) 100vw, 313px" /></figure>



<p>Define a name for this token and authorize the scope of access with this token. You can choose this token access for Build pipeline trigger or release pipeline trigger etc.</p>



<p></p>



<p>Finally below is our URL and input request object defined,</p>



<p></p>



<p><strong>URL</strong></p>



<pre class="wp-block-preformatted has-medium-font-size">https://dev.azure.com/jan2022-thecodebuzz/globalexceptionhandler/_apis/pipelines/5/runs?api-version=6.0-preview.1</pre>



<p></p>



<p>Let&#8217;s now use <strong>Postman </strong>to execute the API. Please set up the Basic authentication in the Postman by setting up the Token name as UserName and Password as a personal access token.</p>



<p></p>



<p><strong>Request Object for Build Pipeline API</strong></p>



<p></p>



<p>Below is my request body,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
{
    &quot;resources&quot;: {
        &quot;repositories&quot;: {
            &quot;self&quot;: {
                &quot;refName&quot;: &quot;refs/heads/master&quot;
            }
        }
    }
}
</pre></div>


<p></p>



<p><strong>Response from Build Pipeline API </strong></p>



<p></p>



<p>Below is a sample response,</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="519" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-1024x519.jpg" alt="Automating Azure DevOps Build Pipelines using Run Pipeline API" class="wp-image-21390" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-1024x519.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-300x152.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-768x389.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-1536x778.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-2048x1037.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2022/03/trigger-a-build-using-Run-Pipeline-azure-devops-785x398.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>Once you execute the POST API, please check your pipeline. You shall see it is executed and triggered for a build successfully,</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="223" src="https://www.thecodebuzz.com/wp-content/uploads/2022/03/image-1024x223.png" alt="trigger-azure-pipelines-build-via-api" class="wp-image-21346" srcset="https://thecodebuzz.com/wp-content/uploads/2022/03/image-1024x223.png 1024w, https://thecodebuzz.com/wp-content/uploads/2022/03/image-300x65.png 300w, https://thecodebuzz.com/wp-content/uploads/2022/03/image-768x168.png 768w, https://thecodebuzz.com/wp-content/uploads/2022/03/image-1536x335.png 1536w, https://thecodebuzz.com/wp-content/uploads/2022/03/image-785x171.png 785w, https://thecodebuzz.com/wp-content/uploads/2022/03/image.png 1897w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>References</strong>: </p>



<p></p>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/trigger-azure-pipelines-build-api-for-automating-azure-devops/" title="API for automating Azure DevOps Build Pipelines – Part 1" target="_blank" rel="noreferrer noopener"><em>API for automating Azure DevOps Build Pipelines – Part 1</em></a></li></ul>



<ul class="has-medium-font-size wp-block-list"><li><a href="https://www.thecodebuzz.com/create-https-nginx-on-linux-azure-virtual-machine-ubuntu/" target="_blank" rel="noreferrer noopener"><em>Create HTTP with NGINX on Linux in Azure Virtual Machine</em></a></li></ul>



<p></p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p><p>The post <a href="https://thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/">Automating Azure DevOps Build Pipelines using Run Pipeline API</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/azure-devops-build-pipelines-using-run-pipeline-api-automate/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Self Contained Vs Framework Dependent Deployment -Guidelines</title>
		<link>https://thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd/</link>
					<comments>https://thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 03 Mar 2022 00:11:00 +0000</pubDate>
				<category><![CDATA[CICD]]></category>
		<category><![CDATA[--self-contained]]></category>
		<category><![CDATA[c self-contained exe --self-contained]]></category>
		<category><![CDATA[dotnet build self-contained]]></category>
		<category><![CDATA[dotnet publish framework-dependent]]></category>
		<category><![CDATA[dotnet publish self-contained]]></category>
		<category><![CDATA[dotnet self-contained]]></category>
		<category><![CDATA[net core publish self-contained visual studio]]></category>
		<category><![CDATA[one of '--self-contained' or '--no-self-contained' options are required when '--]]></category>
		<category><![CDATA[runtime' is used]]></category>
		<category><![CDATA[self-contained csproj]]></category>
		<category><![CDATA[self-contained deployment]]></category>
		<category><![CDATA[self-contained deployment .net core]]></category>
		<category><![CDATA[self-contained-vs-framework-dependent]]></category>
		<category><![CDATA[the application was run as a self-contained app because runtimeconfig.json was not found]]></category>
		<category><![CDATA[visual studio self-contained]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=18085</guid>

					<description><![CDATA[<p>Understanding Self Contained Vs Framework Dependent Deployment Today in this article we shall learn the differences between Self Contained Vs Framework Dependent Deployment i,e, SCD and FDD deployment methodologies. These deployment techniques are generic and can be used for Console or ASP.NET API or WebAPI or any MVC project. Today we will cover below aspects [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd/">Self Contained Vs Framework Dependent Deployment -Guidelines</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Understanding Self Contained Vs Framework Dependent Deployment</h1>



<figure class="wp-block-image size-large"><a href="https://www.thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="1024" height="356" src="https://www.thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-1024x356.jpg" alt="Self Contained Vs Framework Dependent Deployment -Guidelines" class="wp-image-23185" srcset="https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-1024x356.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-300x104.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-768x267.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-1536x534.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences-785x273.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2022/08/Self-Contained-vs-Framework-dependent-deployment-diffrences.jpg 1995w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>Today in this article we shall learn the differences between<strong><em> Self Contained Vs Framework Dependent Deployment</em></strong> i,e, <strong><em>SCD and FDD</em></strong> deployment methodologies. These deployment techniques are generic and can be used for <strong>Console </strong>or <strong>ASP.NET API</strong> or <strong>WebAPI </strong>or any <strong>MVC project</strong>.</p>



<p></p>



<p>Today we will cover below aspects in the article,</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-fdd--build-application-as-fdd--framework-dependent-deployment">FDD-  Build Application as FDD- Framework-dependent deployment</a><ul><li><a href="#aioseo-deployable-mainly-consist-of-below">Deployable mainly consist of below,</a></li><li><a href="#aioseo-example">Example of Framework-dependent deployment</a></li><li><a href="#aioseo-advantage-of-framework-dependent-deployment">Advantages of Framework-dependent deployment</a></li><li><a href="#aioseo-disdvantage-of-framework-dependent-deployment">Disadvantages of Framework-dependent deployment</a></li></ul></li><li><a href="#aioseo-scd--build-application-as-self-content-deployment">SCD- Build Application as Self-contained Deployment</a><ul><li><a href="#aioseo-self-content-deployment-for-linux">Self-contained Deployment  For Linux</a></li><li><a href="#aioseo-self-content-deployment-for-windows10">Self-contained Deployment For Windows10</a></li><li><a href="#aioseo-deployable-mainly-consist-of-below">Deployable mainly consist of below,</a></li><li><a href="#aioseo-self-content-deployable-example">Self-contained Deployable Example</a><ul><li><a href="#aioseo-advantages">Advantages of Self-contained Deployable Example</a></li><li><a href="#disadvantages-1">Disadvantages of Self-contained Deployable Example</a></li></ul></li></ul></li></ul></div>



<p></p>



<p>Applications created using the .NET framework can be published in two different modes, and the mode affects how a user runs your app.</p>



<p></p>



<p>When installing the application to the new environment, if the target machine has the required .NET version already installed then the application built using .NET should work without any issue.</p>



<p></p>



<p> If the required .NET core SDK/runtime is not installed then one can follow any of the below approaches discussed. An approach using <strong><em>Self-content deployment</em></strong> doesn&#8217;t require a .NET Core <strong>SDK/Runtime </strong>to be installed on the target machines.</p>



<p></p>



<p>Let&#8217;s see both the approaches in detail,</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-fdd--build-application-as-fdd--framework-dependent-deployment">FDD-  Build Application as FDD- Framework-dependent deployment</h2>



<p></p>



<p>If you are building an application using Framework dependent deployment (FDD) approach, then it is expected that the target server or environment has the .NET Core SDK and runtime installed.</p>



<p>Publishing an app as <strong>FDD </strong>produces a&nbsp;cross-platform binary&nbsp;as a&nbsp;<em>DLL</em>&nbsp;file, and a&nbsp;platform-specific executable.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-deployable-mainly-consist-of-below"><strong>Deployable mainly consist of below,</strong></h3>



<p></p>



<ul class="wp-block-list"><li>Application-specific <strong>DLLs </strong>or <strong>EXE</strong></li><li>Dependencies like <strong>NUGET </strong>or Third party references </li><li>Resource files if any</li></ul>



<p></p>



<h3 class="wp-block-heading" id="aioseo-example">Example of Framework-dependent deployment </h3>



<p></p>



<p>Below <strong>FDD </strong>deployment has produced below binaries,</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="529" src="https://www.thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-1024x529.jpg" alt="" class="wp-image-18105" srcset="https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-1024x529.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-300x155.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-768x397.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-1536x794.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-785x406.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent.jpg 1796w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>As shown above, my deployable consist of Dlls like ExternalDLL1, ExternalDLL2, and Nuget packages like <strong>Newtonsoft</strong>, etc</p>



<p></p>



<p>All the system DLLs and supported <em><strong>Runtime/SDK</strong></em> will be used from the below folder on the target machine,</p>



<p></p>



<p id="block-34301ea4-8dd5-4ab9-875e-568f7a66fe69"><strong><em><strong>.NET Runtime</strong></em></strong></p>



<p></p>



<pre class="wp-block-preformatted"><strong><em><em>C:\program files\dotnet\shared\{runtime-type}\{version}\</em></em></strong>
<strong><em>C:\program files\dotnet\host\</em></strong></pre>



<p></p>



<p><strong><em>Example</em></strong>: runtime framework DLLs like <strong><em>hostfxr.dll</em></strong> can be found in the below-shared location depending on the target .NET version used,</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found-1024x422.jpg" alt="hostfxr.dll location" class="wp-image-18035" width="597" height="246" srcset="https://thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found-1024x422.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found-300x124.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found-768x316.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found-785x323.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/08/required-library-hostfxr.dll-could-not-be-found.jpg 1469w" sizes="auto, (max-width: 597px) 100vw, 597px" /></figure>



<p></p>



<h3 class="wp-block-heading" id="aioseo-advantage-of-framework-dependent-deployment">Advantages of Framework-dependent deployment </h3>



<p>There are below <strong>advantages </strong>of using this approach,</p>



<p></p>



<ul class="wp-block-list"><li><strong><em>Small deployment</em></strong> &#8211; With this option, you create your deployable consisting of the actual app and its dependencies i.e mainly these part libraries or NuGet package used by your application.</li><li><strong><em>Leverage the </em></strong>latest patched runtime.</li></ul>



<p></p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-disdvantage-of-framework-dependent-deployment">Disadvantages of Framework-dependent deployment  </h3>



<p></p>



<p>There are below<strong> disadvantages </strong>of using this approach,</p>



<p></p>



<ul class="wp-block-list"><li><strong>.NET Core </strong>installation needed &#8211; Prior installation of the required .NET Core runtime is needed. </li><li>.NET version may change the behavior of the app &#8211; With this option, it is possible that the application will use the latest available version on the target machine which could affect application behavior to some extent.</li></ul>



<p></p>



<p></p>



<p><strong>Example : </strong></p>



<p></p>



<p>Your application target and uses the 5.0.0 version then let&#8217;s say your machine gets patched with the 5.0.1 version. In such cases, your application will start using the 5.0.1 version, since it&#8217;s the highest patch and the runtime available for the given major version of <strong><em>5.0.x</em></strong>.</p>



<p></p>



<p>The above behavior can be changed by using a custom configuration like <a href="https://docs.microsoft.com/en-us/dotnet/core/versions/selection#framework-dependent-apps-roll-forward" target="_blank" rel="noreferrer noopener">app roll forward</a> settings.</p>



<p></p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-scd--build-application-as-self-content-deployment">SCD- Build Application as Self-contained Deployment</h2>



<p></p>



<p>If you are building an application using an approach, then you are making your application deployable is self-content, and can run on its own.</p>



<p></p>



<p>This can be achieved by building your application using the below build command,</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-self-content-deployment-for-linux">Self-contained Deployment  For Linux</h3>



<p></p>



<p>Sample command for self Content Deployment for Linux </p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">dotnet publish -r linux-x64 --self-contained true -c release

</pre>



<h3 class="wp-block-heading" id="aioseo-self-content-deployment-for-windows10"> Self-contained Deployment For Windows10</h3>



<p></p>



<p> Sample command for self Content Deployment </p>



<p></p>



<pre id="block-023a8656-d90c-4d4f-bfd9-af153d0dd835" class="wp-block-preformatted has-medium-font-size">dotnet publish -r win10-x64 --self-contained true -c release
</pre>



<p>OR</p>



<p></p>



<p><strong>For Windows Server</strong></p>



<p></p>



<pre id="block-023a8656-d90c-4d4f-bfd9-af153d0dd835" class="wp-block-preformatted has-medium-font-size">dotnet publish -r win-x64 --self-contained true -c release</pre>



<p></p>



<h3 class="wp-block-heading" id="aioseo-deployable-mainly-consist-of-below"><strong>Deployable mainly consist of below,</strong></h3>



<p></p>



<ul class="wp-block-list"><li>Application-specific <strong>DLLs </strong>or <strong>EXE</strong></li><li>Dependencies like <strong>NUGET </strong>or Third party references </li><li>Resource files if any</li><li>System DLLs</li><li>Runtime/SDK</li></ul>



<p></p>



<p></p>



<p>The user of your app isn&#8217;t required to download and install it. NET, as your application, will now have everything to run as self-content.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-self-content-deployable-example">Self-contained Deployable Example</h3>



<p></p>



<p>Below <strong>SCD </strong>deployment has produced below binaries,</p>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment-996x1024.jpg" alt="" class="wp-image-18107" width="769" height="790" srcset="https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment-996x1024.jpg 996w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment-292x300.jpg 292w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment-768x790.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment-506x520.jpg 506w, https://thecodebuzz.com/wp-content/uploads/2021/09/Self-Contained-vs-Framework-dependent-deployment.jpg 1167w" sizes="auto, (max-width: 769px) 100vw, 769px" /></figure>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Size of my application deployable now increased to <strong><em>64 MB</em></strong> due to all application,System DLLS and  Runtime/SDK are packaged together.</p></blockquote>



<p></p>



<h4 class="wp-block-heading" id="aioseo-advantages">Advantages of Self-contained Deployable Example </h4>



<p></p>



<p><strong>With this approach, you achieve the below advantages,</strong></p>



<p></p>



<ul class="wp-block-list"><li>The app doesn&#8217;t required to download and install. NET.</li><li>Application is isolated from other .NET apps </li><li>The application doesnt use a locally installed shared runtime even if available</li><li>You are able to control which target version you want to use.</li></ul>



<p></p>



<p></p>



<h4 class="wp-block-heading" id="disadvantages-1">Disadvantages of Self-contained Deployable Example  </h4>



<p></p>



<ul class="wp-block-list"><li>The large size of deployment -The app includes the .NET runtime and all the dependencies making your deployable size tune to the maximum.</li><li>.NET version compatibility &#8211; For any specific framework version-related chnages including major, minor versions require new deployment.</li></ul>



<p></p>



<p><strong><em>References</em></strong>: </p>



<p></p>



<ul class="wp-block-list"><li><a href="https://www.thecodebuzz.com/create-self-contained-package-build-deployment/" title="Create a Self-contained package for Build and Deployment" target="_blank" rel="noreferrer noopener"><strong><em>Create a Self-contained package for Build and Deployment</em></strong></a></li></ul>



<p></p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd/">Self Contained Vs Framework Dependent Deployment -Guidelines</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/self-contained-vs-framework-dependent-deployment-hostfxr-fdd-vs-scd/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Continuous Code Quality of .NET with SonarQube</title>
		<link>https://thecodebuzz.com/continuous-code-quality-of-using-sonar/</link>
					<comments>https://thecodebuzz.com/continuous-code-quality-of-using-sonar/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 01 Mar 2022 00:00:00 +0000</pubDate>
				<category><![CDATA[.NET Core]]></category>
		<category><![CDATA[CICD]]></category>
		<category><![CDATA[Code Smell]]></category>
		<category><![CDATA[c# code analysis tools free]]></category>
		<category><![CDATA[c# code analysis tools online]]></category>
		<category><![CDATA[c# coding analysis]]></category>
		<category><![CDATA[Code analysis .NET Core]]></category>
		<category><![CDATA[code analysis C#]]></category>
		<category><![CDATA[Code analysis dotnet core]]></category>
		<category><![CDATA[code analysis tools c# Visual Studio]]></category>
		<category><![CDATA[code quality analysis]]></category>
		<category><![CDATA[Code Quality of .NET and .NET Core]]></category>
		<category><![CDATA[Code Quality of C#]]></category>
		<category><![CDATA[Code Quality using Sonar]]></category>
		<category><![CDATA[code review checklist javascript]]></category>
		<category><![CDATA[Code scan .NET Core]]></category>
		<category><![CDATA[Codelyzer vs Sonar  angular 8]]></category>
		<category><![CDATA[codelyzer Vs Sonar angular ]]></category>
		<category><![CDATA[codelyzer vs tslint vs SonarLint]]></category>
		<category><![CDATA[coding best practices]]></category>
		<category><![CDATA[command is used to run static code analysis of angular application]]></category>
		<category><![CDATA[dynamic code analysis tools]]></category>
		<category><![CDATA[how to run code analysis in visual studio 2017]]></category>
		<category><![CDATA[install sonar lint]]></category>
		<category><![CDATA[microsoft code analysis 2017]]></category>
		<category><![CDATA[microsoft code analysis 2019]]></category>
		<category><![CDATA[node js static code analysis tools]]></category>
		<category><![CDATA[open source code analysis tools c#]]></category>
		<category><![CDATA[react code review checklist]]></category>
		<category><![CDATA[react code review tools]]></category>
		<category><![CDATA[react code smells]]></category>
		<category><![CDATA[react coding standards]]></category>
		<category><![CDATA[react native code review checklist]]></category>
		<category><![CDATA[reactjs code review checklist]]></category>
		<category><![CDATA[roslyn analyzer]]></category>
		<category><![CDATA[roslyn analyzer .net core]]></category>
		<category><![CDATA[Sonar lint C#]]></category>
		<category><![CDATA[sonar lint code quality]]></category>
		<category><![CDATA[Sonar lint extension VS2017]]></category>
		<category><![CDATA[sonarqube cloud]]></category>
		<category><![CDATA[sonarqube code coverage]]></category>
		<category><![CDATA[sonarqube documentation]]></category>
		<category><![CDATA[sonarqube download]]></category>
		<category><![CDATA[sonarqube features]]></category>
		<category><![CDATA[sonarqube jenkins]]></category>
		<category><![CDATA[sonarqube tutorial]]></category>
		<category><![CDATA[static code analysis tools C#]]></category>
		<category><![CDATA[visual studio 2019 code analysis]]></category>
		<category><![CDATA[visual studio static code analysis]]></category>
		<guid isPermaLink="false">https://thecodebuzz.com/?p=2495</guid>

					<description><![CDATA[<p>Code Quality of .NET using SonarQube in Visual Studio Most of us understand the importance of code quality. Good coding practices are language agnostics and help any organization to deliver clean, highly reliable, secure, and maintainable code. Today in this article, we shall see how to manage the Code Quality of .NET with SonarQube. “Any [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/continuous-code-quality-of-using-sonar/">Continuous Code Quality of .NET with SonarQube</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Code Quality of .NET using SonarQube</strong> <strong>in Visual Studio </strong></h1>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i2.wp.com/thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension.jpg?fit=785%2C270&amp;ssl=1" alt="SonarQube in Visual Studio" class="wp-image-3142" width="609" height="209" srcset="https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension.jpg 2305w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-300x103.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-1024x352.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-768x264.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-1536x528.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-2048x704.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2019/05/sonarlint-code-quality-visual-studio-extension-785x270.jpg 785w" sizes="auto, (max-width: 609px) 100vw, 609px" /></figure>



<p>Most of us understand the importance of code quality. Good coding practices are language agnostics and help any organization to deliver clean, highly reliable, secure, and maintainable code. Today in this article, we shall see how to manage the Code Quality of .NET with SonarQube.</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p> <strong>“Any fool can write code that a computer can understand. Good programmers write code that humans can understand” &nbsp;-Martin Fowler</strong> </p></blockquote>



<p></p>



<p>Software maintenance is like a big fat elephant and often eats away a big chunk of project budget allocation. Re-engineering and refactoring of buggy code cost organization time, cost, and quality. These small-looking coding issues become bigger problems in the future and potentially affect the complete architecture and design of your application. </p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>“Code is maintained more often than it is written”</strong></p></blockquote>



<p>Today in this article, we will cover below aspects,</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-getting-started-code-quality-of-net-with-sonarqube">Getting started &#8211; Code Quality of .NET with SonarQube</a><ul><li><a href="#aioseo-prerequisites">Prerequisites:</a><ul><li><a href="#aioseo-visual-studio-2015-or-2017-or-2019">* Visual Studio 2015 or 2017 or 2019</a></li><li><a href="#aioseo-install-sonarlint-extension">* Install SonarLint extension</a></li></ul></li></ul></li><li><a href="#aioseo-sonar-connected-mode-configuration">Sonar &#8211; Connected Mode configuration</a><ul><li><a href="#aioseo-summary">Summary :</a></li></ul></li></ul></div>



<p>Today in this article we shall see how to use the <em><strong>Sonar Lint IDE</strong></em> extension in <strong><em>Visual Studio 2017(or VS2019)</em></strong></p>



<p></p>



<p><strong>SonarLint&nbsp;</strong>is an IDE extension that helps to detect and fix code quality issues as you type the code in IDE.</p>



<p></p>



<p><strong>SonarLint</strong> Visual Studio extension<strong> </strong>combines together all best of the linting process and supports multiple analyzers and multiple languages.</p>



<p></p>



<ul class="wp-block-list"><li><em><strong>C# (.NET , .NET Core, .NET Standards) &#8211; Roslyn analyzer</strong></em></li></ul>



<ul class="wp-block-list"><li><em><strong>VB.NET- Roslyn analyzer </strong></em></li></ul>



<ul class="wp-block-list"><li><em><strong>JavaScript- SonarJS analyzer</strong></em></li></ul>



<ul class="wp-block-list"><li><em><strong>C/C++ &#8211; SonarCFamily </strong></em></li></ul>



<p></p>



<p>Support for <strong><em>Typescript or Python</em></strong> language is supported through another SonarLint plugin that works on Visual Studio Code IDE. Please see more details on the below link,</p>



<p></p>



<ul class="wp-block-list"><li><a href="https://www.thecodebuzz.com/continuous-code-quality-in-angular-7-applications-using-sonar/" target="_blank" rel="noreferrer noopener"><strong><em>Continuous Code Quality of Angular, React or Vue.js applications using Sonar</em></strong></a></li></ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-getting-started-code-quality-of-net-with-sonarqube">Getting started &#8211; Code Quality of .NET with SonarQube</h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-prerequisites">Prerequisites:</h3>



<p></p>



<h4 class="wp-block-heading" id="aioseo-visual-studio-2015-or-2017-or-2019">   * Visual Studio 2015 or 2017 or 2019</h4>



<h4 class="wp-block-heading" id="aioseo-install-sonarlint-extension">   * Install SonarLint extension </h4>



<p></p>



<p>From <em><strong>Menu-&gt;Extension-&gt;Manage Extension, please search with the </strong></em>keyword &#8220;Sonar&#8221; as below. Here I am installing this extension for VS2019.  </p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1873" height="566" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1.jpg?fit=785%2C237&amp;ssl=1" alt="SonarLint visual studio" class="wp-image-2498" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1.jpg 1873w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1-300x91.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1-1024x309.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1-768x232.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1-1536x464.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-1-785x237.jpg 785w" sizes="auto, (max-width: 1873px) 100vw, 1873px" /></figure>



<p></p>



<p><strong><em>Note-The first-time installation requires you to restart the Visual Studio to complete the installation.</em></strong></p>



<p></p>



<p>After successful installation of the extension, IDE will start analyzing code and shall start reporting the issue as shown below,</p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="2017" height="510" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1.jpg?fit=785%2C199&amp;ssl=1" alt="Sonar C# code quality " class="wp-image-2526" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1.jpg 2017w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1-300x76.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1-1024x259.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1-768x194.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1-1536x388.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-dotnetcore-visual-studio-1-785x198.jpg 785w" sizes="auto, (max-width: 2017px) 100vw, 2017px" /></figure>



<p></p>



<p>As you type your code you shall be able to see the best recommendation from SonarLint based on configured rules. </p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="692" height="526" src="https://www.thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-continous-coding-inspection-gif.gif" alt="SonarLint Visual studio plugin" class="wp-image-2552"/></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-sonar-connected-mode-configuration">Sonar &#8211; Connected Mode configuration</h2>



<p></p>



<p><strong>SonarQube </strong>scan can be configured as part build and deploy process within the CICD pipeline. SonarQube provides the overall health of the portfolio within the organization with nice dashboards detailing the overall health of the code.</p>



<p></p>



<p><strong>Sonar Server</strong></p>



<p></p>



<p><strong><em>SonarLint if used with the SonarQube server </em></strong>streamlines the code analysis process by using a<strong><em> </em></strong>uniform rule set across the organization and avoids any ambiguity of issues reported on server vs developers Desktop/IDE. So far above we used the default ruleset which comes with plugin installation now we shall see how to use the connected mode of the sonar server.</p>



<p></p>



<p>Connected mode configuration is a simple 1-2 step process. Below we shall try connecting the application with a quality profile of the server.</p>



<p></p>



<ul class="wp-block-list"><li>Click on Team Explorer in Visual Studio and connect to SonarQube as shown below,</li></ul>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality.jpg?fit=785%2C420&amp;ssl=1" alt="SonarLint connected mode" class="wp-image-2509" width="560" height="299" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality.jpg 1725w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-300x161.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-1024x549.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-768x411.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-1536x823.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-785x420.jpg 785w" sizes="auto, (max-width: 560px) 100vw, 560px" /><figcaption><br></figcaption></figure>



<ul class="wp-block-list"><li>Provide Server <strong>URL </strong>and <strong>Password </strong>or <strong>Token </strong>to connect with sonar server from IDE,</li></ul>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1.jpg?fit=785%2C398&amp;ssl=1" alt="SonarLint  .NET configuration " class="wp-image-2511" width="556" height="282" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1.jpg 1823w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1-300x152.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1-1024x519.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1-768x389.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1-1536x779.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-configuration-1-785x398.jpg 785w" sizes="auto, (max-width: 556px) 100vw, 556px" /></figure>



<p></p>



<p>After successful authentication, please select your organization.</p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="564" height="521" src="https://www.thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-1-1.jpg" alt="SonarQube Visual studio configuration" class="wp-image-2559" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-1-1.jpg 564w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-1-1-300x277.jpg 300w" sizes="auto, (max-width: 564px) 100vw, 564px" /></figure>



<p></p>



<p>Your application will be connected.</p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1395" height="466" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3.jpg?fit=785%2C262&amp;ssl=1" alt="Sonar C# code quality " class="wp-image-2561" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3.jpg 1395w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3-300x100.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3-1024x342.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3-768x257.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-3-785x262.jpg 785w" sizes="auto, (max-width: 1395px) 100vw, 1395px" /></figure>



<p></p>



<p>Establish the Sonar Server connection for the first time. Please click on &#8220;<strong>Bind</strong>&#8221; as shown below,</p>



<p></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1659" height="874" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1.jpg?fit=785%2C413&amp;ssl=1" alt="SonarQube .NET " class="wp-image-2562" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1.jpg 1659w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1-300x158.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1-1024x539.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1-768x405.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1-1536x809.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-binding-1-785x414.jpg 785w" sizes="auto, (max-width: 1659px) 100vw, 1659px" /></figure>



<p></p>



<p>After successful binding, Quality profiles from Sonar Server  will be downloaded locally in your projects which includes ruleset file and creation of <strong><em>.sonarlint</em></strong> folder as shown below,</p>



<p></p>



<ul class="wp-block-list"><li>Sonar rule set file will be created within project folder (.csproj)</li></ul>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile.jpg?fit=785%2C274&amp;ssl=1" alt="Code Quality of .NET with SonarQube" class="wp-image-2515" width="557" height="194" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile.jpg 2203w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-300x105.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-1024x357.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-768x268.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-1536x535.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-2048x714.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-c-sonar-server-connection-bind-quality-profile-785x274.jpg 785w" sizes="auto, (max-width: 557px) 100vw, 557px" /></figure>



<p></p>



<ul class="wp-block-list"><li>Folder &#8216;.<strong>sonarlint</strong>&#8216; will be created with ruleset file and configuration file as below,</li></ul>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i2.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile.jpg?fit=785%2C295&amp;ssl=1" alt="Code Quality of .NET with SonarQube" class="wp-image-2516" width="555" height="208" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile.jpg 2203w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-300x113.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-1024x385.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-768x289.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-1536x577.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-2048x770.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-code-quality-visual-studio-quality-profile-785x295.jpg 785w" sizes="auto, (max-width: 555px) 100vw, 555px" /></figure>



<p></p>



<p>That&#8217;s all! Once the project gets connected with the server, Your project will work in connected mode using the same Quality profiles as of Sonar Server.</p>



<p></p>



<p>You will be able to see the same coding issues in IDE and in Pipeline and analyze your code against centralized configured rules.</p>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop.jpg?fit=785%2C235&amp;ssl=1" alt="Code Quality of .NET C# with SonarQube" class="wp-image-2517" width="621" height="185" srcset="https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop.jpg 2560w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-300x90.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-1024x306.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-768x229.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-1536x458.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-2048x611.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2019/04/sonarlint-connected-mode-code-quality-server-desktop-785x234.jpg 785w" sizes="auto, (max-width: 621px) 100vw, 621px" /></figure>



<p></p>



<p>Happy coding !!</p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<p></p>



<p><strong><em>Other References :</em></strong></p>



<p></p>



<ul class="wp-block-list"><li><a href="https://www.thecodebuzz.com/static-code-quality-analysis-ndepend/" target="_blank" rel="noreferrer noopener" title="Continuous Code Quality using NDepend"><strong><em>Continuous Code Quality using NDepend</em></strong></a></li></ul>



<ul class="wp-block-list"><li><a href="https://www.thecodebuzz.com/continuous-code-quality-in-angular-7-applications-using-sonar/" target="_blank" rel="noreferrer noopener"><strong><em>Continuous Code Quality of Angular, React or Vue.js applications using Sonar</em></strong></a></li></ul>



<p></p>



<h4 class="wp-block-heading" id="aioseo-summary">Summary : </h4>



<p></p>



<p>Today we learned about SonarLint extension set up and configuration for Visual Studio IDE. Good coding practices are language agnostics and help the organization to deliver clean, reliable, secure, and maintainable code. Buggy code slipping through cracks has the potential to cost a company an entire business. </p>



<p>Organizations can address these problems by following best practices of software development like continuous code quality and continuous code review processes.</p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p><p>The post <a href="https://thecodebuzz.com/continuous-code-quality-of-using-sonar/">Continuous Code Quality of .NET with SonarQube</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/continuous-code-quality-of-using-sonar/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Git Branching Best Practices &#8211; Trunk-Based Development</title>
		<link>https://thecodebuzz.com/trunk-based-development-best-practices/</link>
					<comments>https://thecodebuzz.com/trunk-based-development-best-practices/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 02 Sep 2021 02:43:00 +0000</pubDate>
				<category><![CDATA[CICD]]></category>
		<category><![CDATA[XP Practices]]></category>
		<category><![CDATA[Benefits of Trunk Based Development]]></category>
		<category><![CDATA[GitFlow Vs Trunk Development]]></category>
		<category><![CDATA[Trunk Based Development]]></category>
		<guid isPermaLink="false">https://thecodebuzz.com/?p=5173</guid>

					<description><![CDATA[<p>Git Branching Best Practices &#8211; Trunk-Based Development Trunk-based development is a prominent source code Branching Strategy that follows a set of defined principles and best practices to perform code development on a branch called &#8216;Trunk&#8217; or &#8216;Master&#8217; in a collaborative way. A source-control branching model, where developers collaborate on code in a single branch called [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/trunk-based-development-best-practices/">Git Branching Best Practices – Trunk-Based Development</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Git Branching Best Practices &#8211; Trunk-Based Development </strong></h1>


<div class="wp-block-image">
<figure class="aligncenter is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices.jpg?fit=785%2C608&amp;ssl=1" alt="Git Branching Best Practices - Trunk-Based Development " class="wp-image-5281" width="408" height="316" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices.jpg 1109w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices-300x232.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices-1024x793.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices-768x595.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-best-practices-671x520.jpg 671w" sizes="auto, (max-width: 408px) 100vw, 408px" /></figure>
</div>


<p>Trunk-based development is a prominent source code Branching Strategy that follows a set of defined principles and best practices to perform code development on a branch called &#8216;Trunk&#8217; or &#8216;Master&#8217; in a collaborative way. </p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>A source-control branching model, where developers collaborate on code in a single branch called ‘trunk’ *, resist any pressure to create other long-lived development branches by employing documented techniques. They therefore avoid merge hell, do not break the build, and live happily ever after. </em></p>



<p></p>



<p>_ Source <a href="https://trunkbaseddevelopment.com/" target="_blank" rel="noreferrer noopener">https://trunkbaseddevelopment.com/</a></p>
</blockquote>



<p></p>



<p>We will cover the below aspects in the article,</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-origin-and-merge-hell">Origin and Merge Hell</a></li><li><a href="#aioseo-is-it-feasible-to-follow-the-trunk-master-approach">Is it feasible to follow the Trunk/Master Approach?</a></li><li><a href="#aioseo-feature-toggle---inevitable">Feature Toggle &#8211; Inevitable</a></li><li><a href="#aioseo-benefits-of-trunk-based-development">Benefits of Trunk-Based Development</a></li><li><a href="#aioseo-best-practices-of-trunk-based-development">Best Practices of Trunk-Based Development</a><ul><li><a href="#aioseo-develop-on-the-trunk-master">Develop the Trunk/Master</a></li><li><a href="#aioseo-feature-branch-life-span-a-few-days1-3-days">Feature Branch life span a few days(1-3 days)</a></li><li><a href="#aioseo-create-feature-branches-from-master-trunk">Create Feature branches from the Master/Trunk</a></li><li><a href="#aioseo-feature-branches-can-be-aligned-with-the-small-feature-and-hence-user-stories-or-task">Feature Branches can be Aligned with the small feature and hence user stories or task</a></li><li><a href="#aioseo-clean-merges-to-trunk-master">Clean merges to Trunk/Master</a></li><li><a href="#aioseo-dont-commit-to-master-trunk-directly">Don&#8217;t commit to Master/Trunk directly</a></li><li><a href="#aioseo-merge-should-be-from-a-feature-branch-to-master-trunk">Merge should be from a Feature branch to the Master/Trunk</a></li><li><a href="#aioseo-every-merge-should-be-production-ready">Every merge should be production-ready</a></li><li><a href="#aioseo-merges-to-trunk-master">Merges to Trunk/Master</a></li><li><a href="#aioseo-keep-trunk-master-green">Keep Trunk/Master Green</a></li><li><a href="#aioseo-release-branch-to-master-branch-merge-should-be-avoided">Release branch to Master branch merge should be avoided</a></li><li><a href="#aioseo-summary">Summary</a></li></ul></li></ul></div>



<p></p>



<p><strong><em>Trunk-based development</em></strong> is getting huge traction recently. </p>



<p></p>



<p>These recognitions are mainly due to the realization of the fact after a decade of experience and learning on the various issue of traditional <strong>VCS </strong>(Version Control system)  like Merge hell, Testing failure followed by a delay in delivering a feature and then delay in testing and acceptance, etc.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-origin-and-merge-hell">Origin and Merge Hell</h2>



<p></p>



<p class="has-text-align-left">The code integration phase is still an important phase even in modern code development methodologies. Generally, once a feature development is over as we know of integration of the code from different developers. </p>



<p></p>



<p class="has-text-align-left">This merging sometimes also depends on multiple aspects like environment, the feature is integrated, the client-specific requirement being addressed, etc.</p>



<p></p>



<p class="has-text-align-left">This merging is always challenging, as it involves a huge code base merge developed over a period of time.</p>



<p></p>



<p>The integration phase is always critical to delivery. </p>



<p></p>



<p>If any issue arising at that time could affect directly the delivery of the product.</p>



<p></p>



<p>The issue could become worse with an approach of having multiple parallel repositories in a different environment dealing with code movement from one environment to another environment. </p>



<p></p>



<p></p>



<p>Finally, These problems are always man-made. The good thing is these problems are solvable with best practices.</p>



<p> </p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1285" height="924" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others.jpg?fit=785%2C564&amp;ssl=1" alt="Trunk Based Development " class="wp-image-6748" srcset="https://thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others.jpg 1285w, https://thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others-300x216.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others-1024x736.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others-768x552.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/12/Trunk-Based-Development-Vs-Git-Flow-Vs-Others-723x520.jpg 723w" sizes="auto, (max-width: 1285px) 100vw, 1285px" /></figure>



<p></p>



<p>There are many mechanisms for practicing lean-agile methodologies. </p>



<p></p>



<p>Trunk-based development is slowly becoming one of the methods helping with a few common issues on code merge thereby targeting speed to the market initiative.</p>



<p> </p>



<p>TBD actually complements your already established lean-agile practices and the team can get value from its usage. </p>



<p></p>



<p>Trunk Based development-based branching strategies help in practicing frequent releases and delivery of features and helping to achieve speed to the market initiative.</p>



<p></p>



<p>Trunk Based Development&#8217;s main advantage is that it keeps feature/code near to the production readiness right from the kickstart of a project.</p>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices.jpg?fit=785%2C515&amp;ssl=1" alt="feature/code Trunk Based Development" class="wp-image-5278" width="482" height="316" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices.jpg 1408w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices-300x197.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices-1024x672.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices-768x504.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Practices-785x515.jpg 785w" sizes="auto, (max-width: 482px) 100vw, 482px" /></figure>



<p></p>



<p>It&#8217;s important to understand that when a feature or code is near to the release Or production readiness continuously, the team gets a lot of flexibility on revisiting the features, introducing a change in a feature or updating an implementation, or making changes to code as per the requirements.</p>



<p></p>



<p>Also, the team can revisit on design and architecture of applications if needed. </p>



<p></p>



<p>The team keeps on integrating code even if the feature is not complete. The idea here is simple, issues are easy to fix when they are small. </p>



<p></p>



<p>Trunk-based development encourages small features to be integrated in an incremental way.</p>



<p></p>



<p>A known limitation in the world of waterfall dealing with legacy source code, you will typically observe one continuous build that culminates in one deployment for a bunch of features spanning over a period of time.</p>



<p></p>



<p>Which most time produces multiple issues like merge hell and bugs etc.</p>



<p> </p>



<h2 class="wp-block-heading" id="aioseo-is-it-feasible-to-follow-the-trunk-master-approach">Is it feasible to follow the Trunk/Master Approach?</h2>



<p></p>



<p>The feasibility of following the trunk-based development could be a question for most of us.</p>



<p></p>



<p>The simple answer is &#8216;absolutely&#8217; it is feasible. </p>



<p></p>



<p>There are multiple benefits of using the Trunk approach as explained in the &#8220;Benefits&#8221; section below.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-feature-toggle---inevitable">Feature Toggle &#8211; Inevitable</h2>



<p> </p>



<p>There are multiple supportive techniques useful for following Trunk based development. </p>



<p></p>



<p>The use of Feature toggles is <em>inevitable</em>. </p>



<p></p>



<p>Feature toggles are dependable companions of trunk development and help to achieve the Trunk approach properly.</p>



<p></p>



<p>Trunk-based development can regulate the software development process within your sprint or iteration cycle. &nbsp;</p>



<p></p>



<p>Teams develop a cadence for a release-ready feature implementation which is integrated together with feature flags.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-benefits-of-trunk-based-development">Benefits of Trunk-Based Development </h2>



<p></p>



<ul class="wp-block-list">
<li>Small incremental Feature development gives greater visibility of features being developed.</li>
</ul>



<ul class="wp-block-list">
<li><strong>Compliment the CI-CD</strong> process with Continuous Integration and continuous deployment of code.  </li>
</ul>



<ul class="wp-block-list">
<li>Small Feature development can be aligned with lean Agile methodologies improving the velocity of the team overall.</li>
</ul>



<ul class="wp-block-list">
<li>Code on Master/Trunk is always ready to be released due to only one Trunk.</li>
</ul>



<ul class="wp-block-list">
<li>Reduces the cost of manual code merge (usually done in the form of the integration process of the codebase).</li>
</ul>



<ul class="wp-block-list">
<li>It enables the team&#8217;s ability to release new features more frequently. </li>
</ul>



<ul class="wp-block-list">
<li>Trunk methodologies with a combination of practices improve the quality of deliverables.</li>
</ul>



<ul class="wp-block-list">
<li>Shift-left enablement. </li>
</ul>



<ul class="wp-block-list">
<li>Cross-team collaboration with <strong>XP </strong>practices.</li>
</ul>



<ul class="wp-block-list">
<li>Eliminates heavy code merges. </li>
</ul>



<p></p>



<p></p>



<h1 class="wp-block-heading" id="aioseo-best-practices-of-trunk-based-development"><strong>Best Practices of Trunk-Based Development</strong></h1>



<p></p>



<h2 class="wp-block-heading" id="aioseo-develop-on-the-trunk-master">Develop the Trunk/Master</h2>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i2.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1.jpg?fit=785%2C515&amp;ssl=1" alt="Git Branching Best Practices" class="wp-image-5269" width="511" height="335" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1.jpg 1408w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1-300x197.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1-1024x672.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1-768x504.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-1-785x515.jpg 785w" sizes="auto, (max-width: 511px) 100vw, 511px" /></figure>



<ul class="wp-block-list">
<li>That means one and only Master or Trunk should be used for all development.</li>



<li>This is different from Git Flow where actual development happens on dedicated branch-like <strong>DEV</strong> then Test etc.</li>



<li>One should always use Feature Branches for small feature development.</li>



<li>Small Feature Branch should not last for more than 1-2-3 days.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-feature-branch-life-span-a-few-days1-3-days">Feature Branch life span a few days(1-3 days)</h2>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices.jpg?fit=785%2C517&amp;ssl=1" alt="Feature Branch life span a few days" class="wp-image-5260" width="492" height="323" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices.jpg 1403w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices-300x198.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices-1024x674.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices-768x506.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-contineous-merge-on-master-Best-Pracitices-785x517.jpg 785w" sizes="auto, (max-width: 492px) 100vw, 492px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Developers should develop a practice of not keeping the code to themselves.</li>



<li>The code should be merged with Master within a few days, typically 1-3 days.</li>



<li>Code merge should be done for what you own that day with the precondition of a successful build, and test cases passing.</li>



<li>Code merge can be done even if the feature is not complete. Make sure build and test cases are passing. </li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-create-feature-branches-from-master-trunk">Create Feature branches from the Master/Trunk</h2>



<p></p>



<p>Example</p>



<p></p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="301" height="212" src="https://www.thecodebuzz.com/wp-content/uploads/2019/08/image-3.png" alt="Create Feature branches from Master/Trunk" class="wp-image-5261"/></figure>
</div>


<p></p>



<ul class="wp-block-list">
<li>Ex, If using<strong> Git</strong> as<strong> VCS </strong>then origin/master (remote) should be used for creating a Feature branch.</li>



<li>The idea here is every new development should progress using the latest available code from Master/Trunk.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-feature-branches-can-be-aligned-with-the-small-feature-and-hence-user-stories-or-task">Feature Branches can be Aligned with the small feature and hence user stories or task </h2>



<p></p>



<ul class="wp-block-list">
<li>New Feature branches can be created for small development and can be aligned with user stories or tasks.</li>



<li>If aligned with a user story or task, please make sure the Feature branch code doesn&#8217;t last long beyond 2-3 days.</li>



<li>The idea here is to merge and deploy small features in logical chunks and as early as possible usually within 1-3 days.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-clean-merges-to-trunk-master">Clean merges to Trunk/Master</h2>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2.jpg?fit=785%2C454&amp;ssl=1" alt="Clean merges to Trunk/Master" class="wp-image-5275" width="488" height="281" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2.jpg 1597w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2-300x174.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2-1024x592.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2-768x444.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2-1536x889.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-feature-branch-Best-Pracitices-sync-review-2-785x454.jpg 785w" sizes="auto, (max-width: 488px) 100vw, 488px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>The small feature developed should be validated, and reviewed within the Feature branch itself right before the merging to Master/Trunk.</li>



<li>Always sync your changes from the source control. </li>



<li>Feature branch code should be reviewed before the merge to the Master/Trunk.</li>



<li>Clean merges here means code that is in a Green state i.e passes build, unit test, etc.</li>



<li>Do only clean merges to Trunk which are validated and reviewed</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-dont-commit-to-master-trunk-directly">Don&#8217;t commit to Master/Trunk directly</h2>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/image-5.jpg?fit=785%2C305&amp;ssl=1" alt="Don't commit to Master/Trunk directly" class="wp-image-5268" width="526" height="204" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/image-5.jpg 2378w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-300x117.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-1024x398.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-768x298.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-1536x597.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-2048x796.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2019/08/image-5-785x305.jpg 785w" sizes="auto, (max-width: 526px) 100vw, 526px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>It&#8217;s recommended not to commit directly to the Master/Trunk branch instead one should create a Feature branch (short 1-3 days).</li>
</ul>



<ul class="wp-block-list">
<li>It&#8217;s recommended to create a feature branch for every merge.</li>
</ul>



<ul class="wp-block-list">
<li>Smaller teams sometimes tend to check directly to the Master which is okay for a team of 1 or 2 (if code review is followed strictly.)</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-merge-should-be-from-a-feature-branch-to-master-trunk">Merge should be from a Feature branch to the Master/Trunk</h2>



<p></p>



<ul class="wp-block-list">
<li>Merge should be unidirectional that is from a Feature branch to Master/Trunk. </li>
</ul>



<ul class="wp-block-list">
<li>Merge from the Release branch to the Master branch can be avoided. </li>
</ul>



<ul class="wp-block-list">
<li>Intermediate merges to master (Trunk) are not allowed. </li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-every-merge-should-be-production-ready">Every merge should be production-ready</h2>



<p></p>



<ul class="wp-block-list">
<li>Do a clean merge with known and agreed functionalities including limitations if any.</li>



<li>Do clean merges even if the feature is not completed fully.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-merges-to-trunk-master">Merges to Trunk/Master</h2>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch.jpg?fit=785%2C555&amp;ssl=1" alt="Merges to Trunk/Master" class="wp-image-5273" width="519" height="367" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch.jpg 1306w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch-300x212.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch-1024x724.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch-768x543.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-with-short-lived-branch-735x520.jpg 735w" sizes="auto, (max-width: 519px) 100vw, 519px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Merges between one Feature branch to another Feature branch must be avoided.</li>
</ul>



<ul class="wp-block-list">
<li>The best practice is to follow the uni-directional merge that is merge of Feature Branch to Master/Trunk should be used.</li>
</ul>



<p>          <strong>Feature branch&gt;&gt;&gt;&gt; Master/Trunk&gt;&gt;&gt;&gt;&gt;&gt;Release Branch</strong></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-keep-trunk-master-green">Keep Trunk/Master Green</h2>



<p></p>



<p>The definition of green can be defined as below,</p>



<p></p>



<ul class="wp-block-list">
<li>Green for the compile and build.</li>
</ul>



<ul class="wp-block-list">
<li>Green for the Feature being developed. It should work with known and agreed functionality.</li>
</ul>



<ul class="wp-block-list">
<li>Green for the acceptable Test including unit tests or integration test cases.</li>
</ul>



<ul class="wp-block-list">
<li>If the build fails, revert your changes back to the previous best state of code. One should create a new Feature branch for fixing build issues. </li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-release-branch-to-master-branch-merge-should-be-avoided">Release branch to Master branch merge should be avoided</h2>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master.jpg?fit=785%2C366&amp;ssl=1" alt="Avoid Release branch to Master branch merge" class="wp-image-5274" width="454" height="211" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master.jpg 1228w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master-300x140.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master-1024x478.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master-768x358.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Trunk-Based-Development-release-to-master-785x366.jpg 785w" sizes="auto, (max-width: 454px) 100vw, 454px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Merge from the release Branch to the master should be avoided. There are rare exceptions though (which I will talk about in future articles).</li>
</ul>



<p></p>



<p><strong><em>References</em></strong></p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/cherry-pick-in-github-step-by-step/" target="_blank" rel="noreferrer noopener" title="Cherry Pick in GitHub"><strong><em>Cherry Pick in Gi for Trunk-based Development</em></strong></a></li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-summary">Summary</h2>



<p></p>



<p>Trunk-based development is a prominent source code <strong>Branching Strategy </strong>that follows a set of defined principles and best practices to perform code development on a single branch called &#8216;<strong><em>Trunk&#8217; or &#8216;Master&#8217; </em></strong>in a collaborative way thereby minimizing the merge/integration pain. </p>



<p></p>



<p>It complements continuous integration and continuous delivery by keeping the code &#8220;ready to release&#8221; state and developing a cadence of merging small changes in an incremental way.</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p><p>The post <a href="https://thecodebuzz.com/trunk-based-development-best-practices/">Git Branching Best Practices – Trunk-Based Development</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/trunk-based-development-best-practices/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
