<?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>CI and CD &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/ci-and-cd/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 09 Jul 2019 12:26:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>CI and CD &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Azure Function Build and Release Pipeline in Azure DevOps CI CD</title>
		<link>https://www.sibeeshpassion.com/azure-function-build-and-release-pipeline-in-azure-devops-ci-cd/</link>
					<comments>https://www.sibeeshpassion.com/azure-function-build-and-release-pipeline-in-azure-devops-ci-cd/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 09 Jul 2019 11:10:48 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure DevOps]]></category>
		<category><![CDATA[Azure Function]]></category>
		<category><![CDATA[Build Pipeline]]></category>
		<category><![CDATA[CI and CD]]></category>
		<category><![CDATA[Continuous Deployment]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Release Pipeline]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=13794</guid>

					<description><![CDATA[[toc] Introduction Playing with Azure Function is always a nice feeling, and it is very important to configure both build and release pipeline for all of your applications, Azure Functions are not different. In this article, we will see how we can create both build and release pipeline in Azure DevOps for our Azure Function application. I hope you will like it. Prerequisites You should have an Azure Function application to configure the build and release pipeline for the same. You can either create a new one in the Azure portal, or you can use any existing azure functions available [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>[toc]</p>



<h2 class="wp-block-heading">Introduction</h2>



<p>Playing with <a href="https://sibeeshpassion.com/tag/azure-function/">Azure Function</a> is always a nice feeling, and it is very important to configure both build and release pipeline for all of your applications, Azure Functions are not different. In this article, we will see how we can create both build and release pipeline in <a href="https://sibeeshpassion.com/tag/azure-devops/">Azure DevOps</a> for our Azure Function application. I hope you will like it.</p>



<h2 class="wp-block-heading">Prerequisites </h2>



<p>You should have an Azure Function application to configure the build and release pipeline for the same. You can either create a <a href="https://sibeeshpassion.com/azure-function-as-output-job-topology-of-an-azure-stream-analytics-job/#creating-an-azure-function-solution-and-function">new one in the Azure portal</a>, or you can use any existing azure functions available in internet, for example you can see one <a href="https://github.com/SibeeshVenu/Realtime-IoT-Device-Data-using-Azure-SignalR-and-Azure-Function-in-Angular">here</a>.</p>



<h2 class="wp-block-heading">Setting Build Pipeline for Azure Function</h2>



<p>Go to your Azure DevOps and click on Builds</p>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="505" height="581" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Select-Build.png" alt="" class="wp-image-13795" srcset="/wp-content/uploads/2019/07/Select-Build.png 505w, /wp-content/uploads/2019/07/Select-Build-261x300.png 261w, /wp-content/uploads/2019/07/Select-Build-425x489.png 425w" sizes="(max-width: 505px) 100vw, 505px" /><figcaption>Select Builds</figcaption></figure>



<p>Now you should see an option to select where your code is available. You can choose accordingly.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="542" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Select-Code-Source.png" alt="" class="wp-image-13796" srcset="/wp-content/uploads/2019/07/Select-Code-Source.png 650w, /wp-content/uploads/2019/07/Select-Code-Source-300x250.png 300w, /wp-content/uploads/2019/07/Select-Code-Source-425x354.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Select Code Source</figcaption></figure>



<p>As my project is in Azure repository, I will select that. Please be noted that I will be using the classic editor to create the pipeline now, so that I can show the steps with the screenshots. You should be able to see the final yml file at the end of the configuration.</p>



<p>Now you can select the template of your project, I will select .Net Core as the template as my Azure Function is in .Net Core.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="319" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Select-Template.png" alt="" class="wp-image-13797" srcset="/wp-content/uploads/2019/07/Select-Template.png 650w, /wp-content/uploads/2019/07/Select-Template-300x147.png 300w, /wp-content/uploads/2019/07/Select-Template-425x209.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Asp.Net Core as Template</figcaption></figure>



<p>Now you can see that our Pipeline is created with some default tasks and settings as follows.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="586" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Pipeline-Tasks.png" alt="" class="wp-image-13824" srcset="/wp-content/uploads/2019/07/Pipeline-Tasks.png 650w, /wp-content/uploads/2019/07/Pipeline-Tasks-300x270.png 300w, /wp-content/uploads/2019/07/Pipeline-Tasks-425x383.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Pipeline Taks</figcaption></figure>



<figure class="wp-block-image"><img decoding="async" width="650" height="428" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Pipeline-Settings.png" alt="" class="wp-image-13799" srcset="/wp-content/uploads/2019/07/Pipeline-Settings.png 650w, /wp-content/uploads/2019/07/Pipeline-Settings-300x198.png 300w, /wp-content/uploads/2019/07/Pipeline-Settings-425x280.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Pipeline Settings for Azure Function</figcaption></figure>



<p>As everything is already created for us, let us save and queue the build. Please make sure that your source code branch is valid and you had verified the build. I forgot to do this, and I was getting the below error, as there was some issue with my code (there was an additional dot(.) in my code, I added it by mistake).</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="696" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Initial-Build-Run-Error.png" alt="" class="wp-image-13800" srcset="/wp-content/uploads/2019/07/Initial-Build-Run-Error.png 650w, /wp-content/uploads/2019/07/Initial-Build-Run-Error-280x300.png 280w, /wp-content/uploads/2019/07/Initial-Build-Run-Error-425x455.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Initial Build Error</figcaption></figure>



<p>So I edited my code and build, and then initiate a manual build again. But even after that I was getting an error as &#8220;No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory&#8221;.</p>



<figure class="wp-block-image"><img decoding="async" width="651" height="114" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Second-Build-Error.png" alt="" class="wp-image-13801" srcset="/wp-content/uploads/2019/07/Second-Build-Error.png 651w, /wp-content/uploads/2019/07/Second-Build-Error-300x53.png 300w, /wp-content/uploads/2019/07/Second-Build-Error-425x74.png 425w" sizes="(max-width: 651px) 100vw, 651px" /><figcaption>Second Build Error</figcaption></figure>



<p>The reason for this is, that by default the &#8220;Publish Web Projects&#8221; is enabled in the Publish task. As ours is not a web project, and if this option is enabled the Publish task will look for a web project in the repository and run the publish command. If we have a web.config file or a wwwroot folder in the directory, it is been treated as a web project. </p>



<p>We have to disable this option as it is not applicable for our project, as it is not a web project. To do so, please go to your Publish task.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="576" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/All-Tasks.png" alt="" class="wp-image-13826" srcset="/wp-content/uploads/2019/07/All-Tasks.png 650w, /wp-content/uploads/2019/07/All-Tasks-300x266.png 300w, /wp-content/uploads/2019/07/All-Tasks-425x377.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>All Tasks</figcaption></figure>



<p>Now you should deselect the &#8220;Publish Web Projects&#8221; option.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="613" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Unselect-Publish-Web-Project-Option.png" alt="" class="wp-image-13803" srcset="/wp-content/uploads/2019/07/Unselect-Publish-Web-Project-Option.png 650w, /wp-content/uploads/2019/07/Unselect-Publish-Web-Project-Option-300x283.png 300w, /wp-content/uploads/2019/07/Unselect-Publish-Web-Project-Option-425x401.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Deselect  Publish Web Projects </figcaption></figure>



<p>Now save your build configuration and queue a new build. If everything goes well, you should see that your build is successful.</p>



<figure class="wp-block-image"><img decoding="async" width="651" height="288" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Build-Success.png" alt="" class="wp-image-13804" srcset="/wp-content/uploads/2019/07/Build-Success.png 651w, /wp-content/uploads/2019/07/Build-Success-300x133.png 300w, /wp-content/uploads/2019/07/Build-Success-425x188.png 425w" sizes="(max-width: 651px) 100vw, 651px" /><figcaption>Build Success</figcaption></figure>



<p>If you wish to see the YAML code of a task, you should be able to see it if you click on &#8220;View YAML&#8221; link.</p>



<figure class="wp-block-image"><img decoding="async" width="1000" height="208" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/View-YAML-of-one-Task.png" alt="" class="wp-image-13834" srcset="/wp-content/uploads/2019/07/View-YAML-of-one-Task.png 1000w, /wp-content/uploads/2019/07/View-YAML-of-one-Task-300x62.png 300w, /wp-content/uploads/2019/07/View-YAML-of-one-Task-768x160.png 768w, /wp-content/uploads/2019/07/View-YAML-of-one-Task-425x88.png 425w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>Please do not forget to enable if you need to trigger the build automatically when there is a check in happened in the repository.</p>



<figure class="wp-block-image"><img decoding="async" width="1004" height="97" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Enable-Disable-Continous-Integration.png" alt="" class="wp-image-13808" srcset="/wp-content/uploads/2019/07/Enable-Disable-Continous-Integration.png 1004w, /wp-content/uploads/2019/07/Enable-Disable-Continous-Integration-300x29.png 300w, /wp-content/uploads/2019/07/Enable-Disable-Continous-Integration-768x74.png 768w, /wp-content/uploads/2019/07/Enable-Disable-Continous-Integration-425x41.png 425w" sizes="(max-width: 1004px) 100vw, 1004px" /><figcaption>Enable or Disable Continuous Integration </figcaption></figure>



<h2 class="wp-block-heading">Setting Release Pipeline for Azure Function</h2>



<p>Now that we have got our build successful, let us go ahead and create a release pipeline for our Azure Function. But before we do that, we need to create a service connection in our Azure DevOps project. To create one, please go to your Azure DevOps projects settings -&gt; Pipelines -&gt; Service Connections. </p>



<figure class="wp-block-image"><img decoding="async" width="1000" height="690" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Azure-Resource-Manager-Connection.png" alt="" class="wp-image-13809" srcset="/wp-content/uploads/2019/07/Azure-Resource-Manager-Connection.png 1000w, /wp-content/uploads/2019/07/Azure-Resource-Manager-Connection-300x207.png 300w, /wp-content/uploads/2019/07/Azure-Resource-Manager-Connection-768x530.png 768w, /wp-content/uploads/2019/07/Azure-Resource-Manager-Connection-425x293.png 425w" sizes="(max-width: 1000px) 100vw, 1000px" /><figcaption>Azure Resource Manager Connection</figcaption></figure>



<p>Once it is created, you should see the same under your service connections slab. Now go to the Pipelines section of your Azure DevOps project and click on Releases and the click on New pipeline and select Azure App Service Deployment as the template.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="370" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task-1024x370.png" alt="" class="wp-image-13810" srcset="/wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task-1024x370.png 1024w, /wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task-300x108.png 300w, /wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task-768x278.png 768w, /wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task-425x154.png 425w, /wp-content/uploads/2019/07/Azure-App-Service-Deployment-Task.png 1176w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Azure App Service Deployment</figcaption></figure>



<p>You should see this task in the Task section of your pipeline. If you are unable to see the service connection that you had created on the right panel, just remove the task and add the same again and then check. Your task definition should be looking as below.</p>



<figure class="wp-block-image"><img decoding="async" width="677" height="1024" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Azure-App-Service-Deploy-Task-677x1024.png" alt="" class="wp-image-13811" srcset="/wp-content/uploads/2019/07/Azure-App-Service-Deploy-Task-677x1024.png 677w, /wp-content/uploads/2019/07/Azure-App-Service-Deploy-Task-198x300.png 198w, /wp-content/uploads/2019/07/Azure-App-Service-Deploy-Task-364x550.png 364w, /wp-content/uploads/2019/07/Azure-App-Service-Deploy-Task.png 746w" sizes="(max-width: 677px) 100vw, 677px" /><figcaption>Azure App Service Deploy Task</figcaption></figure>



<p>Once you are done, save your pipeline. And before you create a release, make sure that you had assigned the right build artifacts. Click on Add an artifact.</p>



<figure class="wp-block-image"><img decoding="async" width="1008" height="736" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Release-Pipeline.png" alt="" class="wp-image-13812" srcset="/wp-content/uploads/2019/07/Release-Pipeline.png 1008w, /wp-content/uploads/2019/07/Release-Pipeline-300x219.png 300w, /wp-content/uploads/2019/07/Release-Pipeline-768x561.png 768w, /wp-content/uploads/2019/07/Release-Pipeline-315x230.png 315w, /wp-content/uploads/2019/07/Release-Pipeline-425x310.png 425w" sizes="(max-width: 1008px) 100vw, 1008px" /><figcaption>Add an Artifact Option</figcaption></figure>



<p>Now you should set the artifacts properties.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="728" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Assign-Artifact-Properties.png" alt="" class="wp-image-13814" srcset="/wp-content/uploads/2019/07/Assign-Artifact-Properties.png 650w, /wp-content/uploads/2019/07/Assign-Artifact-Properties-268x300.png 268w, /wp-content/uploads/2019/07/Assign-Artifact-Properties-425x476.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Assign Artifacts Properties </figcaption></figure>



<p>Click on Add and Save your pipeline and then queue a release by clicking on the button Create release. You may get the error &#8221; Error: More than one package matched with specified pattern: d:\a\r1\a\**\*.zip. Please restrain the search pattern&#8221; now.</p>



<figure class="wp-block-image"><img decoding="async" width="1000" height="221" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/More-than-One-Package-Matched.png" alt="" class="wp-image-13836" srcset="/wp-content/uploads/2019/07/More-than-One-Package-Matched.png 1000w, /wp-content/uploads/2019/07/More-than-One-Package-Matched-300x66.png 300w, /wp-content/uploads/2019/07/More-than-One-Package-Matched-768x170.png 768w, /wp-content/uploads/2019/07/More-than-One-Package-Matched-425x94.png 425w" sizes="(max-width: 1000px) 100vw, 1000px" /><figcaption>Error</figcaption></figure>



<p> The reason behind this is, that your solution has many projects in it and each projects will be having its own zip folder in the artifacts, so to fix this we should specify our Azure Function Project in the Package section of our pipeline task.</p>



<p>Click on the Azure App service Deploy task and the go to the Package or Folder section and then click on the three dots.</p>



<figure class="wp-block-image"><img decoding="async" width="1000" height="145" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Package-or-Folder-Option.png" alt="" class="wp-image-13816" srcset="/wp-content/uploads/2019/07/Package-or-Folder-Option.png 1000w, /wp-content/uploads/2019/07/Package-or-Folder-Option-300x44.png 300w, /wp-content/uploads/2019/07/Package-or-Folder-Option-768x111.png 768w, /wp-content/uploads/2019/07/Package-or-Folder-Option-425x62.png 425w" sizes="(max-width: 1000px) 100vw, 1000px" /><figcaption>Package or Folder Option</figcaption></figure>



<p>Now you should have an option to select the right zip file.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="676" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Choose-the-Correct-zip.png" alt="" class="wp-image-13817" srcset="/wp-content/uploads/2019/07/Choose-the-Correct-zip.png 650w, /wp-content/uploads/2019/07/Choose-the-Correct-zip-288x300.png 288w, /wp-content/uploads/2019/07/Choose-the-Correct-zip-425x442.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Choose the Right Zip File</figcaption></figure>



<p>Now Create the release again and you should see that the release is successful. You can also see my StackOverflow answer <a href="https://stackoverflow.com/questions/56950661/error-more-than-one-package-matched-with-specified-pattern-azure-function-relea/56950662#56950662">here</a>.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="295" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Release-Dev.png" alt="" class="wp-image-13818" srcset="/wp-content/uploads/2019/07/Release-Dev.png 650w, /wp-content/uploads/2019/07/Release-Dev-300x136.png 300w, /wp-content/uploads/2019/07/Release-Dev-420x190.png 420w, /wp-content/uploads/2019/07/Release-Dev-425x193.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Release Dev</figcaption></figure>



<h2 class="wp-block-heading">Enabling Continuous Deployment</h2>



<p>If you wish you can always enable the continuous delivery or deployment. This will trigger whenever there is a build. To set up this, please go to your Release pipeline and click on the trigger.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="430" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Contnuous-Delivery-Trigger.png" alt="" class="wp-image-13821" srcset="/wp-content/uploads/2019/07/Contnuous-Delivery-Trigger.png 650w, /wp-content/uploads/2019/07/Contnuous-Delivery-Trigger-300x198.png 300w, /wp-content/uploads/2019/07/Contnuous-Delivery-Trigger-425x281.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Continuous Deployment Trigger</figcaption></figure>



<p>Now you should see an option to enable the Continuous Deployment.</p>



<figure class="wp-block-image"><img decoding="async" width="650" height="499" src="https://sibeeshpassion.com/wp-content/uploads/2019/07/Continuous-Deployment-Trigger.png" alt="" class="wp-image-13822" srcset="/wp-content/uploads/2019/07/Continuous-Deployment-Trigger.png 650w, /wp-content/uploads/2019/07/Continuous-Deployment-Trigger-300x230.png 300w, /wp-content/uploads/2019/07/Continuous-Deployment-Trigger-425x326.png 425w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption>Enable Continuous Deployment</figcaption></figure>



<p>Now all you have to is change something in the code, and not worry about the build and releases. How cool that is?</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>In this article, we have learned,</p>



<ul class="wp-block-list"><li>How to configure Build Pipeline Configuration for Azure Function in Azure DevOps</li><li> How to configure Release Pipeline Configuration for Azure Function in Azure DevOps </li><li>About fixing errors in Pipeline configurations in Azure DevOps</li><li>How to enable Continuous Delivery/Deployment in Azure DevOps</li><li>How to enable Continuous Integration in Azure DevOps</li></ul>



<p>Please let me know what else you had learned from this Article.</p>



<h2 class="wp-block-heading">Your turn. What do you think?</h2>



<p>Thanks a lot for reading. Did I miss anything that you may think which is needed in this article? Could you find this post as useful? Kindly do not forget to share me your feedback.</p>



<p>Kindest Regards<br>Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/azure-function-build-and-release-pipeline-in-azure-devops-ci-cd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
