<?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>Octopus Deploy &#8211; Cognim &#8211; Internet development</title>
	<atom:link href="https://www.cognim.co.uk/category/octopus-deploy/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.cognim.co.uk</link>
	<description>Enterprise system implementation. Making the complex simple</description>
	<lastBuildDate>Thu, 28 Apr 2016 09:21:33 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">91553907</site>	<item>
		<title>Know exactly what you&#8217;re about to deploy with Git, TeamCity and Octopus Deploy</title>
		<link>https://www.cognim.co.uk/know-exactly-what-youre-about-to-deploy-with-git-teamcity-and-octopus/</link>
					<comments>https://www.cognim.co.uk/know-exactly-what-youre-about-to-deploy-with-git-teamcity-and-octopus/#respond</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Mon, 20 Jul 2015 14:14:43 +0000</pubDate>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Octopus Deploy]]></category>
		<category><![CDATA[Team City]]></category>
		<guid isPermaLink="false">http://www.cognim.co.uk/?p=5019</guid>

					<description><![CDATA[In my last post I showed how we can use Git, TeamCity and Octopus Deploy to include the commit id in an Octopus Deploy release, and therefore find out exactly what code is running in your system. In this post I want to show you can use the commit ids to do a diff between [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In my <a href="https://www.cognim.co.uk/know-exactly-what-youve-released-with-git-teamcity-and-octopus/">last post</a> I showed how we can use Git, TeamCity and Octopus Deploy to include the commit id in an Octopus Deploy release, and therefore find out exactly what code is running in your system. In this post I want to show you can use the commit ids to do a diff between what you&#8217;ve already got deployed and what you&#8217;re about to deploy, so you can be exactly sure of what you&#8217;re about to release. </p>
<p>First off you want to get the commit id you currently have deployed and the commit id you want to deploy and copy them to Notepad (or wherever). Next you want to run a diff between the two commits. We currently use BitBucket, so I&#8217;ll show that first, but this also works with GitHub (and it&#8217;s actually a lot easier).</p>
<h2>BitBucket</h2>
<p>Annoyingly, BitBucket doesn&#8217;t officially support diffing between two commits. However, looking at <a href="https://bitbucket.org/site/master/issues/4779/ability-to-diff-between-any-two-commits">this issue</a> it seems that it is unofficially supported. We can diff the two commits using the following url:</p>
<p>https://bitbucket.org/OWNER/PROJECT/branches/compare/COMMIT-CURRENTLY-LIVE..COMMIT-TO-DEPLOY#commits</p>
<p>Of course, you&#8217;ll need to replace OWNER and PROJECT with the correct values and also replace the COMMIT-CURRENTLY-LIVE and COMMIT-TO-DEPLOY with the commit ids taken from the Octopus releases. The commit ids need to be in the specified order, with the earlier commit (the one currently live) first.</p>
<p>Once you&#8217;ve done this you&#8217;ll see a screen with the following:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-21.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-21.png?resize=998%2C334&#038;ssl=1" alt="released-p2-2" width="998" height="334" class="alignnone size-full wp-image-5022" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-21.png?w=998&amp;ssl=1 998w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-21.png?resize=300%2C100&amp;ssl=1 300w" sizes="auto, (max-width: 998px) 100vw, 998px" /></a></p>
<p>This contains every commit between the two versions. Also, see where it says &#8220;Merged in PROJ-99&#8221; in the list of commits? That PROJ-99 refers to the JIRA issue that was created for that particular feature. This means we can also tell you <strong>exactly what features are about to be shipped!</strong> This is fantastic when you go a while between releases, or have many people working on the same project and it becomes difficult to know exactly what was worked on.</p>
<p>You can also see the diff of each file under the &#8220;Diff&#8221; tab:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-1.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-1.png?resize=1300%2C744&#038;ssl=1" alt="released-p2-1" width="1300" height="744" class="alignnone size-full wp-image-5021" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-1.png?w=1300&amp;ssl=1 1300w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-1.png?resize=300%2C172&amp;ssl=1 300w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-1.png?resize=1024%2C586&amp;ssl=1 1024w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a></p>
<p>So, we can see every line of code that has changed between the currently live version and the version we are about to deploy. Pretty neat!</p>
<h2>GitHub</h2>
<p>GitHub <strong>do</strong> actually support diffing between commits. The sytnax is pretty much the same:</p>
<p>https://github.com/OWNER>/PROJECT/compare/COMMIT-CURRENTLY-LIVE..COMMIT-TO-DEPLOY</p>
<p>Here&#8217;s what you end up with once you&#8217;ve done that:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-31.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-31.png?resize=1136%2C955&#038;ssl=1" alt="released-p2-3" width="1136" height="955" class="alignnone size-full wp-image-5028" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-31.png?w=1136&amp;ssl=1 1136w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-31.png?resize=300%2C252&amp;ssl=1 300w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/released-p2-31.png?resize=1024%2C861&amp;ssl=1 1024w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a></p>
<p>(Note this is a personal project, so no JIRA issues <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> )</p>
<p>Again, a nice list of commits and the diff between the two versions. </p>
<p>So there you go &#8211; now you can know exactly what, down to every line of code, you&#8217;re about to release.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/know-exactly-what-youre-about-to-deploy-with-git-teamcity-and-octopus/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5019</post-id>	</item>
		<item>
		<title>Know exactly what you&#8217;ve deployed with Git, TeamCity and Octopus</title>
		<link>https://www.cognim.co.uk/know-exactly-what-youve-released-with-git-teamcity-and-octopus/</link>
					<comments>https://www.cognim.co.uk/know-exactly-what-youve-released-with-git-teamcity-and-octopus/#comments</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Fri, 17 Jul 2015 09:32:07 +0000</pubDate>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Octopus Deploy]]></category>
		<category><![CDATA[Team City]]></category>
		<guid isPermaLink="false">http://www.cognim.co.uk/?p=4953</guid>

					<description><![CDATA[Having a fully automated build and release process is, in my opinion, one of the best things you can do as a development team. We&#8217;ve spent the last 2 years moving to a fully automated build and release process and it has had an enormous impact on the way we develop and, more importantly, release [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Having a fully automated build and release process is, in my opinion, one of the best things you can do as a development team. We&#8217;ve spent the last 2 years moving to a fully automated build and release process and it has had an enormous impact on the way we develop and, more importantly, release software. Releasing has gone from something we do on average quarterly to something we can do daily if required. I shudder when I think of doing a manual release now &#8211; the time taken, the mistakes when setting up the release (manual backups, spelling errors or wrong values in configs, not remembering to copy all the necessary files or folders, etc&#8230;).</p>
<p>Here I want to demonstrate one fantastic benefit of having an automated release process &#8211; knowing exactly what you&#8217;ve deployed, down to every single line of code.</p>
<p>Here&#8217;s a screenshot of an Octopus release, which shows <strong>exactly what commit this code is running from</strong>:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-1.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="alignnone size-full wp-image-4957" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-1.png?resize=736%2C764&#038;ssl=1" alt="" width="736" height="764" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-1.png?w=736&amp;ssl=1 736w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-1.png?resize=289%2C300&amp;ssl=1 289w" sizes="auto, (max-width: 736px) 100vw, 736px" /></a></p>
<p>We can see that this release is currently on our test environment by the green tick next to &#8220;Test&#8221; under the &#8220;Lifecycle&#8221; section. The bit in the red box is what we&#8217;re really interested in here. This tells this release is running the code that was checked in with commit id &#8220;ff83e86&#8230;&#8221;. We can take this id and link it back to our VCS (we currently use <a href="https://bitbucket.org/">BitBucket</a>, a VCS based on Git). Here is the exact source code now running in test:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-5.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="alignnone size-full wp-image-4979" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-5.png?resize=1486%2C450&#038;ssl=1" alt="releasing-blog-5" width="1486" height="450" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-5.png?w=1486&amp;ssl=1 1486w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-5.png?resize=300%2C91&amp;ssl=1 300w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-5.png?resize=1024%2C310&amp;ssl=1 1024w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a></p>
<p>So how do we include the commit in the release? Octopus uses NuGet packages as its deployment mechanism. NuGet packages can contain release notes, and it is these release notes that get displayed in the red box in the image above. We can include a release notes file in the project, use TeamCity to update it with the commit using a straightforward PowerShell script, and include it when building the NuGet package.</p>
<h2>Setting up the files</h2>
<p>There are two files we need: the release notes file and the PowerShell script to update the release notes file.</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-2.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="alignnone size-full wp-image-4959" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-2.png?resize=363%2C216&#038;ssl=1" alt="releasing-blog-2" width="363" height="216" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-2.png?w=363&amp;ssl=1 363w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-2.png?resize=300%2C179&amp;ssl=1 300w" sizes="auto, (max-width: 363px) 100vw, 363px" /></a></p>
<p>Note that here I&#8217;ve included them at the solution level as there&#8217;s only one project we will deploy, however these can be put at a project level if required.</p>
<p>Both the files are simple affairs. Here&#8217;s what each file contains:</p>
<h4>ReleaseNotes.txt</h4>
<p><code>Commit: %commitId%</code></p>
<h4>UpdateReleaseNotes.ps1</h4>
<p><code>Param(<br />
[string]$commitId<br />
)<br />
(Get-Content .\ReleaseNotes.txt) | Foreach-Object {$_ -replace '%commitId%', $commitId} | out-file .\ReleaseNotes.txt<br />
</code></p>
<p>The release notes contains a placeholder for the commit id. The PowerShell script opens the release notes file, replaces the placeholder with a passed in parameter and saves it. This parameter will come from TeamCity.</p>
<h2>Running the PowerShell script</h2>
<p>Next up we need to run this script from our build server, passing in the commit id that triggered the build. In the build configuration, add a build step to run a PowerShell script:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-3.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="alignnone size-full wp-image-4960" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-3.png?resize=1235%2C739&#038;ssl=1" alt="releasing-blog-3" width="1235" height="739" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-3.png?w=1235&amp;ssl=1 1235w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-3.png?resize=300%2C180&amp;ssl=1 300w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-3.png?resize=1024%2C613&amp;ssl=1 1024w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a><br />
(Note to self: update TeamCity!)</p>
<p>Here we are running the PowerShell script and, in the Script Arguments, passing in one of TeamCitys built-in parameters &#8211; the commit id from our VCS that will be used for the build.</p>
<h2>Adding the release notes to the NuGet package</h2>
<p>Now all that is left is to add the ReleaseNotes.txt to the NuGet package that is built by OctoPack. OctoPack has a number of parameters it accepts, one of which is the location of a release notes file:</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-4.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="alignnone size-full wp-image-4961" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-4.png?resize=844%2C271&#038;ssl=1" alt="releasing-blog-4" width="844" height="271" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-4.png?w=844&amp;ssl=1 844w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2015/07/releasing-blog-4.png?resize=300%2C96&amp;ssl=1 300w" sizes="auto, (max-width: 844px) 100vw, 844px" /></a></p>
<p>And we&#8217;re done! Now, whenever we deploy the release using Octopus, we will see the commit that the release was built from.</p>
<p><em>Edit: Erik Eckhard has a great way of achieving the same result without adding a file to your solution in the comments below.</em></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/know-exactly-what-youve-released-with-git-teamcity-and-octopus/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4953</post-id>	</item>
	</channel>
</rss>
