<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gusztáv Varga on Medium]]></title>
        <description><![CDATA[Stories by Gusztáv Varga on Medium]]></description>
        <link>https://medium.com/@gusztavvargadr?source=rss-82a1a3ed5fe5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*33_WWTQ5iGm4Mig-o_BFsg.jpeg</url>
            <title>Stories by Gusztáv Varga on Medium</title>
            <link>https://medium.com/@gusztavvargadr?source=rss-82a1a3ed5fe5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 11:19:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gusztavvargadr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[#8 Maintaining Chocolatey packages with Azure Pipelines and Cake Build]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/8-maintaining-chocolatey-packages-with-azure-pipelines-and-cake-build-b66f82ebcfe5?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b66f82ebcfe5</guid>
            <category><![CDATA[chocolatey]]></category>
            <category><![CDATA[azure-pipelines]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Tue, 25 Jun 2019 00:45:49 GMT</pubDate>
            <atom:updated>2019-06-25T00:46:51.536Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>No more excuses for no automation</h4><p><strong>The first rule of the </strong><a href="https://chocolatey.org/packages/"><strong>community gallery</strong></a><strong> of </strong><a href="https://chocolatey.org/"><strong>Chocolatey</strong></a><strong> — the de facto packaging solution for Windows — is that if you miss a package, then go create it.</strong></p><p><strong>The second rule is that once you’ve created a package, then go maintain it.</strong></p><figure><a href="https://chocolatey.org/packages/aws-vault/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4Zjuqh6LgzLQ2mfeg3nHg.png" /></a><figcaption>Yet another package</figcaption></figure><p>The reasons behind these rules are quite straightforward. By creating new packages you help having a healthy, positive feedback loop in the community. Also, by publishing every version of a software to Chocolatey as well, you maintain trust and prevent your package becoming useless. In short, you can get used to typing the above commands and expecting them to keep working for other packages also. Finally, contributing to all of this is just simply priceless.</p><p>This post shows how to achieve the above easily by connecting the publicly available tools today. It will not go into the tiny details of each of the services used, but it will hopefully help you to see the big picture and give you some insights into where to get started with them.</p><h3>TL;DR</h3><ul><li>It’s 2019.</li><li>No more excuses.</li><li>Cool story, bro.</li><li>We’re not animals.</li></ul><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNIMF0ZTu6SBp60RYrd-2Q.png" /></a><figcaption>All systems go!</figcaption></figure><h3>AWS what?</h3><p>I came across <a href="https://github.com/99designs/aws-vault/">AWS Vault</a> when working more and more often with AWS again at work recently. It was clear once more that we’ve been dealing with a cloud offering that was built with “making it easy to use once you’ve been already using it” in mind. But hey, you still find yourself outside of a datacenter once in a while and need to handle bootstrapping infrastructure (not to mention exploring new features), meaning passing around credentials here and there eventually.</p><p>AWS Vault solves just that problem, in a way that you could expect from the original service provider as well in the first place today, using something more secure than, well, clear text. Its clever server mode even mimics AWS’ instance metadata service, so you can start the lock-in of your projects and yourself already on the local workstation. Anyway, if you’re working with AWS, just <a href="https://github.com/99designs/aws-vault#installing">go ahead and grab it</a>.</p><figure><a href="https://github.com/99designs/aws-vault#usage"><img alt="" src="https://cdn-images-1.medium.com/max/910/1*203YkjH1J-MgwfZ4OQFgUA.png" /></a><figcaption>RTFM — it’s worth it</figcaption></figure><p>Surprisingly, no package existed for it on Chocolatey, even though it was being built for Windows as well for quite a while, using the OS-specific Credential Manager. This might mean a couple of different things, but the original project was stable and active, so packaging it <a href="https://github.com/99designs/aws-vault/issues/124">seemed to be reasonable</a>.</p><p>Because here’s something that does not seem to be reasonable. We’re aiming for automating deployment pipelines all around, which enables us to do deployments by having only a single manual step of selecting which versions to deploy where — at least I hope that’s what you’re aiming for as well — but we’re still fine with ClickMoreThanOnce<strong>™</strong> when it comes to <a href="https://github.com/gusztavvargadr/workstations/">our own environments</a>.</p><h3>A first attempt</h3><p>If you’ve ever worked with NuGet and looked a bit <a href="https://docs.microsoft.com/en-us/nuget/reference/nuspec">behind the scenes</a>, setting up a new Chocolatey package from scratch for an application with a single executable like AWS Vault will be quite straightforward. Following the <a href="https://chocolatey.org/docs/CreatePackages">official documentation</a> gets you everything you need to reach an <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/pull/7/files">initial stage</a> where you grab the binary, provide some basic metadata, license information and hashes for verification. Just choco pack and test, then upload your first version to the community feed and wait for moderation.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/releases/tag/4.4.1"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lijEpfTQCM-1AWFF4IgHuQ.png" /></a><figcaption>The first release</figcaption></figure><p>However, even this simple process might get you a few smells if you sniff around carefully. As in general, the job might feel to be done after the first release, but we’re actually just getting started.</p><h4>What to include</h4><p>Strictly speaking, a Chocolatey package is a different deliverable than the original software, even though it tries to provide the abstraction that they are the same by using the same name and version number by default. This means of course that the package implicitly depends on the contents, and we already have two options to choose from regarding when to resolve them:</p><ul><li>At build time</li><li>At install time</li></ul><p>I’m probably not the only one who faced that a package was broken, as it was trying to resolve those dependencies (like downloading the original software) at install time, and something has changed out there in the meantime. Add to the mix the usual suspect of relying on the latest version implicitly and we already risk facing some nasty challenges.</p><figure><a href="https://www.wiktorzychla.com/2012/03/pathetic-breaking-change-between.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTWvUNsrtXZXPWyLibYomA.png" /></a><figcaption>True story</figcaption></figure><p>Independently of what it deserves to break such contracts even by the original software’s own authors, this leaks the packaging abstraction in a very obvious way, and package authors still need to handle the situation. This is typically done by releasing a new version and ideally revoking or at least deprecating the broken one.</p><p>For these reasons — as long as for example licensing allows it — if you’re packaging someones else’s software, I recommend to include all these dependencies at build time. At the rate of changes these days in all the components we’re relying on, it might also be helpful to have a few earlier working versions available in a trustworthy way.</p><h4>When, what and how to update</h4><p>Ideally, to maintain the above abstraction and have your package’s “customers” trust this source, it’s wise to <a href="https://help.github.com/en/articles/watching-and-unwatching-releases-for-a-repository">follow the original software’s release schedule</a>. Again, it’s quite disappointing to see a Chocolatey package being out of date, as it usually means that you need to have a plan B for workarounds, typically forgetting all about it and installing that specific tool yourself.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/releases/tag/4.5.1"><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*1hfZRJ3KZdlFh8daegwQmQ.png" /></a><figcaption>Suddenly, a new version</figcaption></figure><p>The first release’s contents give some nice hints on how the <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/pull/10">process goes</a>. Grab the new binary, update the metadata and license information if needed, recalculate the hashes for verification, choco pack and test, then upload the new version to the community feed and wait for moderation.</p><h4>How to verify it</h4><p>Other than doing it in isolation — to save yourself some headaches with broken versions during development — test for the most common scenarios of the package usage. In an ideal world the original software’s authors verified the tool itself, but here are some use cases that you have just added:</p><ul><li>Install the package from scratch</li><li>Update the package from an earlier version</li><li>Uninstall the package</li></ul><figure><a href="https://gist.github.com/choco-bot/82d3b61c71992822ddf65d13eaaf0b9c"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Btxh8Ye9g7bGsmkW9Khu6w.png" /></a><figcaption>Chocolatey’s automatic verification logs after package submission</figcaption></figure><p>Other than that I’d recommend to verify what the automated tools and manual moderation also check, typically including that the packaged version matches the one you claim and that the hashes match the content. As you can see above, Chocolatey does this anyway after each submission, so you can eliminate some waste by closing the feedback loop earlier, in case there are any errors, if you test it yourself as well.</p><h4>What if it goes wrong</h4><p>Even if all your packages will always be correct in the future, it’s worth doing a thought experiment about what if things go south. You might discover some possible improvements along the way.</p><figure><a href="https://twitter.com/codewisdom/status/1002181404061552640"><img alt="" src="https://cdn-images-1.medium.com/max/854/1*FDKAvWLD_0ZGdI3vM1ZRlA.png" /></a><figcaption>True story</figcaption></figure><p>In case there’s an issue with the packaged software itself, there’s probably a new version to be expected with the fixes. Then you just simply package and submit it as well.</p><p>If there’s something wrong with your packaging itself, you need to resubmit the same version (if it has not been published yet), or create another version packaging the same original software. In this case your package version will deviate from the standard pattern as you will have multiple releases containing the same original version. A common approach is to submit a new release with a <a href="https://chocolatey.org/packages/7zip/18.5.0.20180730">suffix like the current date</a>, so it’s clearer what is in the box.</p><h3>Automating it all</h3><p>There’s an <a href="https://chocolatey.org/docs/automatic-packages">officially recommended</a> <a href="https://github.com/majkinetor/au/">community tool</a> for helping with the maintenance of packages. It does a pretty good job of managing all the files you need to include and provides basic helpers for running the related workflows, including retrieving the latest available version of the original software and publishing the created packages.</p><p>The point is though, if you do any of the above steps manually — other than maybe triggering the whole flow — you risk making mistakes and it’s inherently slower than letting the machines do it for you. But how much of a waste is it actually, if any?</p><figure><a href="https://xkcd.com/1205/"><img alt="" src="https://cdn-images-1.medium.com/max/571/0*T3zbndzALSg1tjy9.png" /></a><figcaption>It’s more than that</figcaption></figure><p>For those of the contributors who maintain multiple packages themselves — or for me, having you reading about it now and considering some options — it is already worth investing into automation. But automation is just the tool, the key is to provide the experience to your “customers” that they expect: an up to date Chocolatey package that they can trust.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/0*9J9LytuMpRWWPavm.jpg" /><figcaption>№ 5 — The Larch</figcaption></figure><p>Well, it will be rather doing the same thing a bit differently and here’s what it takes to connect the dots.</p><h4>Setting up the pipeline</h4><p>The basic idea is to treat every change of a component (like in the source code, configuration and dependencies) as a release candidate, and launch a process that answers the question of how would it do in production, or — in a more advanced scenario — how it is already doing in production. This way you have a standard, repeatable way of deciding whether deployments worth being released or not.</p><p>A classic approach is to have a “Build” stage that produces an artifact — including some initial tests regarding its quality — and then to verify that the artifact can be deployed to at least one test environment, before continuing with the proper release. All the later “Deploy” stages use exactly the same artifact version, the only difference should be the various configuration of the environments. This is a standard pattern for most modern applications today, but it can be easily applied to anything you produce, including our scenario with Chocolatey packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxLV5Jh4u462NRl2alrJEQ.png" /><figcaption>In theory, it might look like this in practice</figcaption></figure><p>The “Build” stage can assemble the Chocolatey package itself (using the automatic updating features or by doing it “manually”) and then test that for example it can be installed and uninstalled “locally”.</p><p>Later, the “Deploy” stage in a test environment can publish the package to a private feed and try to install it from there. If all this seems to work, there’s a good chance that a deploying to “production”, in this case, publishing to Chocolatey’s community gallery, would work as well. Waiting for the results of the moderation is out of scope for this process.</p><p>For the AWS Vault package I chose to experiment a bit with <a href="https://azure.microsoft.com/en-us/services/devops/pipelines/">Azure Pipelines</a> and then never looked back.</p><p><a href="https://azure.microsoft.com/en-us/services/devops/"><strong>Azure DevOps</strong></a> came a long way from its version -42.9 called Visual SourceSafe, now even offering a complete continuous delivery toolkit for free for open-source projects. This is a very important milestone from a now very different Microsoft, for all our benefits.</p><p>I especially like that even though Azure DevOps consists of a lot of services that play nicely and integrate well together (like Boards, Repos and Artifacts), you can start with only the components you need at the moment. Feel free to use only the Pipelines service (as in this example) and keep the issue tracking, source code and package registries for example where they are, it’s very easy to integrate them too. You are not forced to use the other ones as well or — as the name might suggest — deploy to Azure at all to make the most out of the individual services. This also comes handy for private projects (for both an eventual migration and the related licensing parts), as you can start small and iterate as needed.</p><figure><a href="https://dev.azure.com/gusztavvargadr/chocolatey/_build"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cuzk9m6oQfq2gryUGxzduQ.png" /></a><figcaption>Pipeline(s) only at the moment</figcaption></figure><p>Although there are a lot of moving parts, preview features are separated nicely and based on my first tests the core offering is very stable and supports easily and in a quite impressive way some relatively complex scenarios way beyond the usual quickstarts.</p><p>At some point it might even feel that there’s not too much left to do in IT. Then you notice that Office 2019 still ships with Visual Basic for Applications and you wake up.</p><p>A major selling point for me was the ability of defining the whole pipeline in code where it belongs to, next to the rest of the source. Indeed, the high-level definition is a nice and clean YAML document in the repository root, utilizing the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/stages">multiple stages</a> and the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates">job templates</a> features. I hope the structure below tells the story even if you’re not familiar yet with the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema">full schema</a>.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/azure-pipelines.yml"><img alt="" src="https://cdn-images-1.medium.com/max/973/1*4--TkkrYtUuRM8uwzqBmAQ.png" /></a><figcaption>The pipeline in theory</figcaption></figure><figure><a href="https://dev.azure.com/gusztavvargadr/chocolatey/_build/results?buildId=319&amp;view=results"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxLV5Jh4u462NRl2alrJEQ.png" /></a><figcaption>The pipeline in practice</figcaption></figure><p>The next sections provide the details on how each of the stages work, including passing around the build artifact between the various jobs and reusing the exact same steps for the different deployment environments.</p><h4>Building the artifact</h4><p>Most of the similar continuous delivery tools come with a well-known set of built-in “tasks”, representing the various lower-level operations you can do during a pipeline run (like working with the source, invoking build tools, running tests, collecting artifacts), and Azure Pipelines is <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/">no exception</a>. But other than during the initial experiments with a platform, I suggest to avoid relying on these too much, and use simple scripting whenever possible to achieve the same outcome, for the following reasons:</p><ul><li>You separate the concerns of managing the execution environment, orchestration of the pipeline tasks and the work the tasks do themselves, so each of these will be simpler to maintain.</li><li>You make it possible to easily run your whole pipeline — or just some parts of it — anywhere, including your local machine.</li></ul><p>By scripting though I mean something like my all-time favorite tool for automating build and deployment tasks, <a href="https://cakebuild.net/">Cake Build</a>. The ability to write straightforward C# code with the help of the extensive set of built-in and community addins for various tools, then just relying on executing dotnet cake (for any project you work with) to let it execute the tasks in the right order the is just priceless.</p><p><a href="https://cakebuild.net/"><strong>Cake Build</strong></a> (C# Make) is cross-platform tool and runs anywhere where you can install the .NET Core SDK — pretty much all the major platforms you might work with these days. Especially if you have some background with C# (or similar languages), writing build and deployment “scripts” in a platform-independent way becomes a very easy exercise.</p><p>Thanks to the already mentioned <a href="https://cakebuild.net/addins/">list of addins</a> you can use to orchestrate your low-level tasks for most of the development platforms, not just when working with .NET.</p><p>By the way, I’m waiting at the moment for some Chef runs to complete executing several recipes across different cookbooks, while writing about using Cake for Chocolatey. And don’t even get me started on hash salts.</p><p>Architecture my @ss, IT has its roots in gastronomy!</p><p>As it is hopefully readable below, creating a package includes downloading the original software’s binary, then using the built-in text transformation features if Cake to replace the changing values like for the <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/src/aws-vault.template.nuspec">nuspec metadata</a> and the <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/src/tools/VERIFICATION.template.txt">hash verification</a>.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/build.cake"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-1xp2mAUI30YSBdEUfAgQ.png" /></a><figcaption>Creating a Chocolatey package with Cake</figcaption></figure><p>To prove this is not cheating, here is the expansion of the template for the “Build” job in Azure Pipelines.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/build/azure-pipelines.build.yml"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7WPi5nizd-axokjDIlOOA.png" /></a><figcaption>Azure Pipelines invoking Cake for creating a Chocolatey package</figcaption></figure><p>Notice that all the low-level tasks are actually encapsulated within the Cake scripts, and the Azure Pipelines-specific steps are “only” dealing with managing the execution environment, like setting up the tools missing from the hosted VM image and publishing the artifact (the Chocolatey package just built) for the next stages.</p><h4>Handling versions</h4><p>You might have noticed (the lack of) some references to version numbers in the above source listings. Indeed, within the pipeline there are extension points for overriding the application (the one from the original software) and the package (the one of the Chocolatey package) versions for the special cases of like a hotfix deviating from the standard pattern.</p><p>By default, these versions follow the same schedule, and by using of some convention-based approach like <a href="https://gitversion.readthedocs.io/">GitVersion</a>, they can be easily calculated from the history of the source.</p><p>Most packages out there rely on either the original or a slightly modified rules of <a href="https://semver.org/">semantic versioning</a> and this is where <a href="https://gitversion.readthedocs.io/">GitVersion</a> really excels.</p><figure><a href="https://gitversion.readthedocs.io/en/latest/examples/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnK5IcMjMjnwGaCnjtlKGA.png" /></a><figcaption>Increment++</figcaption></figure><p>Assuming tags represent releases — as how it is supposed to be — GitVersion calculates the next version number automatically based on the (commit) distance from the last tag and the current branch structure.</p><p>You can <a href="http://bit.ly/wdywttt2">configure in detail</a> which parts of the semantic version to increment when and what naming patterns to use according to your own <a href="http://www.davefarley.net/?p=247">branching strategy</a>.</p><p>By default for tagged commits the version number is taken from the tag’s name directly. Let’s say we have previously released version 4.5.0 of our package and tagged the appropriate commit. It means that this version number will be taken as the default application and package version as well as expected.</p><p>Using the following configuration in the repository root we can define how this will be incremented for the different branches.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/GitVersion.yml"><img alt="" src="https://cdn-images-1.medium.com/max/782/1*SK-D12g_QsOIUgV_VFg8TA.png" /></a><figcaption>GitVersion configuration for “regular” feature and hotfix branches</figcaption></figure><p>So for the following scenarios, you can automatically derive the correct next version without any “manual” bumping, by using only the defined branch names:</p><ul><li>For a patch release, just open a new branch like hotfix/&lt;some important fix&gt;. The base version number will be automatically set to 4.5.1 for builds from this branch.</li><li>For a minor release, just open a new branch like feature/&lt;some nice feature&gt;. The base version number will be automatically set to 4.6.0 for builds from this branch.</li><li>For a major release, you will need to tag the desired version number or you can use GitVersion’s configuration to define the <a href="https://gitversion.readthedocs.io/en/latest/more-info/version-increments/">next version</a>.</li></ul><p>Please note however that under “normal” circumstances — that is, when nothing has changed in the packaging structure, which is usually the case when dealing with at least minor or patch releases — you don’t event need to change anything in the source and open branches at all. As you might expect now, if it’s just a “normal” release of the original software, it’s just a matter of tagging the latest commit in your Chocolatey package’s repository to have its version numbers follow the original schedule.</p><p>Indeed, tagging even the same commit where we defined 4.5.0 with the next version of 4.5.1 or 4.6.0 will trigger a new run of the pipeline configured in Azure Pipelines.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/azure-pipelines.yml"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nzhw8uU1P8yc62HtrmJOGw.png" /></a><figcaption>Azure Pipelines being triggered for tags as well</figcaption></figure><p>These runs will calculate the proper version numbers as described above and will include deploying to the Chocolatey community gallery based on the source branch condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*pniJ0BzzrPz5xRz1p3QKjw.png" /><figcaption>Azure Pipelines conditionally publishing for tags to Chocolatey</figcaption></figure><p>This way releasing a new version of your Chocolatey package is as simple as tagging the relevant commit of its sources, and then Azure Pipelines takes care of the rest.</p><figure><a href="https://dev.azure.com/gusztavvargadr/chocolatey/_build/results?buildId=319&amp;view=results"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Kv-7vcuTPeeYJOrPPEyNQ.png" /></a><figcaption>A complete pipeline run for a tag publishing to Chocolatey</figcaption></figure><p>We might want to consider implementing that a tag in the original software’s repository should trigger creating a tag in the Chocolatey package’s repository (either by listening to some events or regularly checking for those changes) in case we’re fine with letting machines decide also about when to release something.</p><h4>Deploying the artifact</h4><p>As mentioned above, before deploying to “production” — the public community gallery — we might want to consider testing the flow by publishing the package to a private Chocolatey feed. For this reason in this example as a first deployment stage we push first to a “local” environment, and try the public feed later only if that worked.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/azure-pipelines.yml"><img alt="" src="https://cdn-images-1.medium.com/max/965/1*pniJ0BzzrPz5xRz1p3QKjw.png" /></a><figcaption>Azure Pipelines with two sequential deployment stages</figcaption></figure><p>As you might expect, the same deployment template is being used for both environments. Again, Azure Pipelines takes care “only” of managing the environment, in this case restoring the build artifact and authenticating with the actual environment’s Chocolatey feed.</p><figure><a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/build/azure-pipelines.deploy.yml"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCToWEslyr89wCLDz-lQxA.png" /></a><figcaption>Azure Pipelines invoking Cake for publishing a Chocolatey package</figcaption></figure><p>The actual operations of deploying the package are “scripted” using Cake again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1YyZrUfboMWsnlgu58oKw.png" /><figcaption>Publishing a Chocolatey package with Cake</figcaption></figure><p>For the most “local” environment we build our and run own <a href="https://chocolatey.org/packages/chocolatey.server/">Chocolatey Server</a> with Docker. This is possible in Azure Pipelines thanks to the great support of Windows Containers as well on the free <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted">hosted agents</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mk_T7Fyh-xxRSLvQCWiOxA.png" /><figcaption>A simple Chocolatey Server with Docker</figcaption></figure><p>The referenced <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/build/registry.init-chocolatey-client.ps1">client</a> and <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/4.6.1/build/registry.init-chocolatey-server.ps1">server</a> initialization scripts are based on the <a href="https://chocolatey.org/docs/how-to-set-up-chocolatey-server">official documentation of running your own feed</a>.</p><p>According to your scenario you might want to consider adding multiple deployment stages before publishing to the “production” feed — like having a private hosted feed for release candidates — but having a “local” test first can be a good start in most cases.</p><h3>Works on your machine</h3><p>So you can now run the whole pipeline in a reliable way on someone else’s machine, but how about yours and your fellow developers’?</p><p>Instead of maintaining an extensive documentation of setting up a development environment — that gets out of date anyway by the time of saving it — I suggest the following approach:</p><ul><li><a href="https://www.vagrantup.com/docs/installation/">Install Vagrant</a> and your favorite virtualization platform (in this example, VirtualBox on any platform, or Hyper-V on Windows).</li><li>Define the development environment where it belongs to, next to rest of the source. To maintain consistency between the environments on the build agents and your local virtual environment, consider reusing the provisioning scripts like for installing the required tools.</li></ul><p>With this setup you get a cross-platform, isolated development environment in a standard, repeatable way and you can reduce your documentation to the following:</p><ul><li>$ vagrant up</li></ul><p>To demonstrate this, here’s a sample run of launching the <a href="https://github.com/gusztavvargadr/aws-vault-chocolatey/blob/master/vagrant.yml">development environment included</a> in the repository of the AWS Vault package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*04sAfdyOalCSzc36coOMgg.png" /><figcaption>Vagrant bringing up the development environment</figcaption></figure><p>On the first launch, Vagrant provisions the new machine, in this case by setting up the .NET Core SDK and Docker. This might take a couple of minutes, but on subsequent runs the same vagrant up command gets you your development environment on an average machine today in about 10 seconds (yes, even with a Windows guest).</p><p>Once you have the machine up you can type vagrant rdp to get a “remote” session. Vagrant automatically maps the repository’s root folder within the guest under the /vagrant directory so you will have your sources available, supporting two-way syncing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8wVKa7ceVj8F85vmy34Xqw.png" /><figcaption>The initial stage of the local Windows Server Core virtual environment</figcaption></figure><p>At this point you can test the commands to build and deploy that you’ve seen in the pipeline definitions. Again, thanks to using Cake Build, these are actually exactly the same steps which are executed on the hosted agents in Azure Pipelines.</p><p>To build the package you can type dotnet cake [build.cake] and the resulting Chocolatey package will be saved to the local artifacts folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8izePrhNQSUz3GiBn7WmSg.png" /><figcaption>Creating a Chocolatey package locally with Cake</figcaption></figure><p>To deploy the package you can type dotnet cake deploy.cake. This will build and launch the local Chocolatey Server with Docker and then verify it can publish the package from the local artifacts folder. After publishing it also tests whether it can be installed from the local source of course.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxvLtUQc_AxIBNkTOMysWA.png" /><figcaption>Publishing a Chocolatey package locally with Cake</figcaption></figure><h3>Resources</h3><p>Please see below a couple of links to get you started in case you want to know more about any of the topics:</p><ul><li><a href="https://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912">Continuous Delivery</a></li><li><a href="https://chocolatey.org/docs/CreatePackages">Chocolatey — Creating packages</a></li><li><a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline">Azure Pipelines — Quickstarts</a></li><li><a href="https://cakebuild.net/docs/tutorials/getting-started">Cake Build — Getting started</a></li><li><a href="https://gitversion.readthedocs.io/en/latest/examples/">GitVersion — Examples</a></li><li><a href="https://www.vagrantup.com/intro/getting-started/">Vagrant — Getting started</a></li></ul><h3>Feedback, please</h3><p>I hope you can join me now in appreciating feedback loops and any results they provide. I hope also that you liked all the above and will consider creating a new Chocolatey package at some point. In any case, please let me know in the comments below what do you think and what do you suggest to improve.</p><p>Thank you for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b66f82ebcfe5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/8-maintaining-chocolatey-packages-with-azure-pipelines-and-cake-build-b66f82ebcfe5">#8 Maintaining Chocolatey packages with Azure Pipelines and Cake Build</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#7 How not to shoot yourself in the foot with the Windows 10 October 2018 Update, WinRM and more]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/7-how-not-to-shoot-yourself-in-the-foot-with-the-windows-10-october-2018-update-winrm-and-more-49c761fabbb?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/49c761fabbb</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[release-notes]]></category>
            <category><![CDATA[virtualization]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Fri, 30 Nov 2018 02:59:38 GMT</pubDate>
            <atom:updated>2019-06-21T00:58:47.364Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Windows 10 Version 1809, Windows Server 2019, vagrant ssh windows and a lot more</h4><p><strong>Ok, </strong><a href="http://bit.ly/wdywttt5"><strong>it’s been a while</strong></a><strong>, but it does not mean I did not upload hundreds of GBs once in a while to </strong><a href="https://app.vagrantup.com/gusztavvargadr/"><strong>Vagrant Cloud</strong></a><strong> in the meantime. Here’s a quick summary of the major improvements, but feel free to take a look at </strong><a href="https://github.com/gusztavvargadr/packer/releases/"><strong>all the details</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Lzd5mtI8TZV83GEX6Q-YGQ.png" /><figcaption>At this point it’s already too late.</figcaption></figure><h3>TL;DR</h3><ul><li><a href="https://app.vagrantup.com/gusztavvargadr/">Vagrant boxes</a></li><li><a href="https://github.com/gusztavvargadr/packer/">Packer templates</a></li><li><a href="https://github.com/gusztavvargadr/workstations/">Virtual workstations</a></li></ul><h3>WinSSH</h3><p>Things were <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">used to be very different</a> on Windows, including the remote management options using WinRM. Although it works nicely with basic scripted provisioning scenarios, you can easily get into trouble, like when you need to upload multiple files and assuming that some of them are above 1 KB.</p><p>Also, some implementations still default to WinRM over plain HTTP, which is not what you want these days.</p><p>As it turns out, the <a href="https://chocolatey.org/packages/openssh/">OpenSSH port</a> is quite stable already for supporting most of the scenarios to be used with Vagrant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B20H0Id9QyjO5eiM8NJcFg.gif" /><figcaption>Of course, this works with VirtualBox as well.</figcaption></figure><p>All my <a href="https://github.com/gusztavvargadr/packer/">Packer templates</a> are now built with the SSH communicator and the <a href="https://github.com/gusztavvargadr/packer#windows">Vagrant boxes</a> support WinSSH besides WinRM as well.</p><p>Some implementations still incorrectly assume that using SSH means Linux, so the default is still WinRM for these boxes to maintain backwards compatibility. Let’s hope that we have a proper separation of the platform and the communicator being used across Vagrant core and its plugins soon.</p><p>Anyway, you can already use vagrant ssh windows or <a href="https://www.vagrantup.com/docs/vagrantfile/machine_settings.html#config-vm-communicator">set the default communicator</a> to winssh if you’re feeling lucky with some race conditions.</p><h3>Windows 1809</h3><p>Always be explicit about versions. Not just for the things you publish, but also for the dependencies you might rely on. Even if you don’t care, try to mention latest with a timestamp, or even better, what version it resolves to at the time of access, so the scenario can be reproduced easily.</p><p>Then pick a pattern and consider sticking with it. For example, <a href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a> itself has a semantic version, as you can expect.</p><p>Well, with Windows 10, this was not an easy exercise in October 2018. latest first meant major version 1803, then 1809, then back and there again. And some people even reported their biggest problems were not just the changing numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPHHZ-zmWHtz3_c5arrqpA.png" /><figcaption>It’s updating symlinks actually.</figcaption></figure><p>First, losing your data after an update, even a hectic one like this, simply means that you don’t really care about it. Please <a href="https://www.hanselman.com/blog/TheComputerBackupRuleOfThree.aspx">do something about it</a> as soon as possible. If you care about the costs, you should start with the toilet paper you use, as <a href="https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/">disk space is a lot cheaper for decades now</a>.</p><p>After that, have your workloads in virtual machines so you can <a href="https://github.com/gusztavvargadr/workstations/">easily recreate them</a> if needed. You can also test like <a href="https://github.com/gusztavvargadr/packer#windows">new OS versions</a> in an easy way, just before nuking your old workstations.</p><p>Finally, do a clean install for your host machines instead of patching them and risking the side effects of configuration drift. If it feels painful, <a href="https://martinfowler.com/bliki/FrequencyReducesDifficulty.html">you are on a good track</a>.</p><p>After all this, you can still complain if you have anything left to complain about. When you’re finished, <a href="https://stefanscherer.github.io/docker-on-windows-server-2019/">give the new Docker features a try</a>.</p><h3>Ubuntu Server and Desktop</h3><p>After having vagrant ssh windows working, it feels so natural to ask for more, for example, vagrant rdp linux. Also, for streamlining provisioning scenarios with Chef and deployments with Docker, having some basic Ubuntu boxes becomes a bare minimum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvI7mcBpHqHz4gZpSy1iSA.gif" /><figcaption>Of course, this works with VirtualBox as well.</figcaption></figure><p>Please give <a href="https://github.com/gusztavvargadr/packer#ubuntu">the core OS configurations</a> and the <a href="https://github.com/gusztavvargadr/packer#docker">Docker setups</a> a go and <a href="https://github.com/gusztavvargadr/packer#contributing">let me know</a> if you have any feedback.</p><h3>OMFG 100+ stars</h3><p>The day after deactivating all my social media accounts I’ve noticed a sudden increase in the number of stars of my <a href="https://github.com/gusztavvargadr/packer/">Packer repo</a>. I quickly logged back in to Twitter and noticed <a href="https://twitter.com/stefscherer/status/1062955416173322240">the root cause</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdrojOIdBhLJ824NEB5nJQ.png" /><figcaption>My pleasure.</figcaption></figure><p>Well, after this you don’t really have other options than publishing more and more often, do you? GitHub repo stars are the new Facebook likes anyway.</p><p>So, what do you want to vagrant up today?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49c761fabbb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/7-how-not-to-shoot-yourself-in-the-foot-with-the-windows-10-october-2018-update-winrm-and-more-49c761fabbb">#7 How not to shoot yourself in the foot with the Windows 10 October 2018 Update, WinRM and more</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#6 RESTful restlessness]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/6-restful-restlessness-3e2c189b94d9?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e2c189b94d9</guid>
            <category><![CDATA[personal]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Wed, 05 Jul 2017 22:32:25 GMT</pubDate>
            <atom:updated>2019-06-21T00:58:03.585Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Web API response types and anxiety disorder</h4><p><strong>This is a story of the key response types and their implications during the lifetime of an imaginary web API. Though it’s a service which has never been implemented, it (could have) happened to any deployments out there. Hopefully, the patterns here can be used to prevent similar issues in real systems in the future.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mYVa8yares8-cNw5." /><figcaption>The well-known <a href="https://waitbutwhy.com/2013/10/why-procrastinators-procrastinate.html">Panic Monster</a></figcaption></figure><p>The imaginary web API and the order of events below represent me and the development of my anxiety disorder. The real systems represent my fellow software engineers, or any humans in general, who will now have an insight into the basics of <a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes">HTTP status codes</a> also.</p><h3>TL;DR</h3><ul><li><a href="http://www.duffthepsych.com/letter/">Explaining anxiety</a></li><li><a href="https://mlafeldt.github.io/blog/if-it-hurts-do-it-more-often/">If it hurts, do it more often</a></li><li><a href="https://www.youtube.com/watch?v=eoC82RuAxqw">Pearl Jam: Not for You</a></li><li><a href="https://www.youtube.com/watch?v=pvV-B4JJqvM">Depeche Mode: Walking in My Shoes</a></li></ul><h3>200 OK</h3><p>So you’ve been deployed, and it was very good. This was the time when your masters should have implemented a couple of alerts so that it would have remained the same.</p><blockquote>Restless soul, enjoy your youth<br>Like Muhammad hits the truth</blockquote><p>The sun is shining. Does the fog in the morning have something to do with moving to the cloud?</p><h3>400 Bad Request</h3><p>We are all computers, and we can go wrong. There’s a chance that they will fix us later.</p><blockquote>Can’t escape from the common rule<br>If you hate something, don’t you do it, too</blockquote><p>Feeling a bit sleepy. Is the overtime causing drinking 15 coffees a day, or is it the other way around?</p><h3>429 Too Many Requests</h3><p>It’s all about resources. Can we please get some more of them?</p><blockquote>Small my table, sits just two<br>Got so crowded, I can’t make room</blockquote><p>It’s all about people. Can we please behave like that?</p><h3>405 Method Not Allowed</h3><p>Yes, it’s 24, but it’s a constant. Do you want me to recommend a movie instead?</p><blockquote>Oh, where did they come from? <br>Stormed my room<br>And you dare say it belongs to you, to you</blockquote><p>Fast, Good, and Cheap. Shall I draw it again?</p><h3>403 Forbidden</h3><p>Please talk to my token service first. By the way, why would you want to delete that in the first place?</p><blockquote>This is not for you<br>This is not for you<br>This is not for you<br>Oh, not for you ah, you</blockquote><p>Nice try to stop me, system. Please don’t do that again.</p><h3>500 Internal Server Error</h3><p>I have no clue. By the way, I could not find a movie either.</p><blockquote>Scream my friends don’t call me<br>Friends, they don’t scream<br>My friends don’t call my friends don’t</blockquote><p>OK, so if it’s dangerous outside, then I won’t go there. Simple, huh?</p><h3>503 Service Unavailable</h3><p>We’ll be back sooner or later. In the meantime, how about fixing us?</p><blockquote>All that’s sacred comes from youth<br>Dedications, naive and true</blockquote><p>Just two more days. Or weeks. Maybe months?</p><h3>304 Not Modified</h3><p>It’s the same ship; it’s just going a bit faster. Is it all that you can do?</p><blockquote>With no power, nothing to do<br>I still remember, why don’t you?<br>Don’t you</blockquote><p>It’s been only a few months. Do I still have my desk?</p><h3>401 Unauthorized</h3><p>I don’t recognize you. Maybe it’s time to renew some credentials?</p><blockquote>This is not for you<br>This is not for you<br>This is not for you<br>Oh, never was for you, <a href="https://github.com/nvbn/thefuck/issues/1">fsck</a> you</blockquote><p>Yeah, it’s still me, I’ve just lost my razor. How about a retina scan instead?</p><h3>204 No Content</h3><p>Job well done! Will that be all, sir?</p><blockquote>I would tell you about the things they put me through<br>The pain I’ve been subjected to<br>But the Lord himself would blush<br>The countless feasts laid at my feet<br>Forbidden fruits for me to eat<br>But I think your pulse would start to rush</blockquote><p>It’s business as usual, I’m just housebound. What is the question?</p><h3>302 Found</h3><p>This endpoint is now obsolete and will be removed soon. How about this new contract?</p><blockquote>Now I’m not looking for absolution<br>Forgiveness for the things I do<br>But before you come to any conclusions<br>Try walking in my shoes</blockquote><p>It seems that we want different things. What is the real issue?</p><h3>301 Moved Permanently</h3><p>Version 2 is out now. Will it be different this time?</p><blockquote>You’ll stumble in my footsteps<br>Keep the same appointments I kept<br>If you try walking in my shoes<br>Try walking in my shoes</blockquote><p>It feels like a fresh start. How may I help you?</p><h3>100 Continue</h3><p>See you soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e2c189b94d9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/6-restful-restlessness-3e2c189b94d9">#6 RESTful restlessness</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#5 Packer templates for Docker, IIS, SQL Server and Visual Studio]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/5-packer-templates-for-net-development-with-hyper-v-and-virtualbox-c20aa47eaa3f?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c20aa47eaa3f</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[virtualization]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Sun, 25 Jun 2017 20:46:39 GMT</pubDate>
            <atom:updated>2019-10-08T01:35:38.636Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Virtual machine images for .NET hosting and development</h4><p><strong>Whichever silo (e.g. development, QA, operations) you’ve been part of recently of a “classic” enterprise group of individuals (software factory), you’ve probably heard the term DevOps by now. Even though some of the </strong><a href="https://en.wikipedia.org/wiki/DevOps"><strong>official definitions</strong></a><strong> still seem to be a bit too vague, I’m glad that at least we have a term suggesting that the earlier approach of distinct work roles has some “smells” (and not just in the IT industry).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Lzd5mtI8TZV83GEX6Q-YGQ.png" /><figcaption>Are you tired of seeing this? Read on…</figcaption></figure><p>Even though I have some operations experience (yes, beyond helping family and friends fixing the common issues with their computers), I originally come from the development silo. I would like to share my experience on where I see this whole movement is now, and maybe some vision on what it could or should reach.</p><p>This should be a longer series of articles, but let’s take one step at a time (Agile, anyone?), and start with creating the foundation of our .NET development and hosting scenarios by automating the very first tasks we encounter:</p><ul><li>Install Windows</li><li>Wait for the updates</li><li>Restart</li><li>Install the tools we need</li><li>Restart again</li><li>Watch it crash</li><li>Restart a few more times</li><li>Reinstall</li><li>Wipe it</li><li>Start over</li></ul><h3>TL;DR</h3><ul><li><a href="https://app.vagrantup.com/gusztavvargadr">Vagrant boxes</a></li><li><a href="https://github.com/gusztavvargadr/packer">Packer templates</a></li><li><a href="https://github.com/gusztavvargadr/workstations">Virtual workstations</a></li></ul><h3>Why bother?</h3><p>You might wonder why do you need automating the installation of Visual Studio or IIS, when you did it for all the versions out there more than a thousand times each already in the last decade, and it always worked on your machine. You can do it now even without thinking (hey, Cortana, would you mind an aspnet_regiis -i for all the installed .NET Framework versions and something similar for .NET Core?). Still, I would argue that in the long term you’re better off with automation, even if it takes some time to learn how to use some fancy tools (the command line).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/0*YPQCxjqQtqBdcQK8.png" /><figcaption>Are you ready for the Ruby experience?</figcaption></figure><p>Here are some actual benefits and similarities to application development:</p><ul><li>Whatever you say, it’s always faster to let the machine do it than clicking and waiting (this even applies to some sites playing movies). You can use the time you gain to memorize for example the <a href="https://docs.chef.io/attributes.html#attribute-evaluation-order">attribute evaluation order</a> in <a href="https://www.chef.io/chef/">Chef</a>.</li><li>If the process involves more than one step, it’s less error-prone to automate it. Consider automation before the 2nd time of manually invoking a process, and do automate it before manually invoking it the 3rd time. If done properly, it will work outside the context of your machine as well.</li><li>You want to be explicit about your dependencies and their versions. It’s tempting to forget, but for example, your host OS version and the patches applied are also such dependencies, and even serverlessness has something to do with environments. Just as you rebuild when your .NET applications’ sources change, it’s cleaner and safer to rebuild your infrastructure components instead of e.g. patching in-place. You need these steps even for containers; it’s just that in that case, the application is “closer”.</li><li>Just as you use class libraries you trust, the same should apply to infrastructure components. Please don’t use my published <a href="https://app.vagrantup.com/gusztavvargadr">Vagrant boxes</a> without checking <a href="https://github.com/gusztavvargadr/packer">their sources</a>. You can minimize the risks by building these components yourself.</li><li>You version, package and publish your .NET application components, you should version, package and publish the infrastructure components as well, as something will depend on them.</li><li>Though you can deploy directly from Visual Studio, you hopefully don’t do that for applications which are used by others too, do you? For the same reason, don’t touch infrastructure components manually either.</li></ul><p>Although some tools along the way will have a steep learning curve, it’s still rather a lot to read than hard to learn in my opinion. To demonstrate why, consider what it takes to deploy your application for example through <a href="https://octopus.com/">Octopus Deploy</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*TJugx_cVUaT2L9Bt.png" /><figcaption>Where do you want to deploy today?</figcaption></figure><p>You simply click to deploy a release, or even better, based on <a href="http://semver.org/">some conventions</a>, you just let it flow through the pipeline. There are a lot of (not so) hidden components under the hood, though. In reality, you start with a credit card and a network cable only; it’s just that your fellows OPs took care of bridging the gap so far:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*AtA-E-wYJc5OdqlA." /><figcaption>Your default VPC ID, please</figcaption></figure><p>And it’s not that OPs don’t want to do it anymore, it’s just a lot better for almost any organization to actively collaborate on these components as well instead of firing and forgetting artifacts.</p><p>In my experience, the available toolkit for infrastructure automation is quite mature now (at least way better than a few years ago) to reliable automate Windows-related tasks, and as the above list suggests hopefully, it’s well worth the effort.</p><p>Last, but not least, it’s also very cool. Read on to see why.</p><h3>Hello, Packer!</h3><p>In this industry, for most of the problems, there are multiple solution options to choose from, and the correct answer is always “it depends”. However, I noticed that the particular problems <a href="https://www.hashicorp.com/">HashiCorp</a> offers a solution for, I’m quite satisfied with their approach, and consider less frequently to look for alternatives than I do with other “vendors”.</p><p>So meet Packer, and start creating simple JSON files to describe and build virtual machine images. Coming from a background in .NET development, you can think of Packer as the equivalent of NuGet. As you use NuGet to package an application component and make its version and dependencies explicit when publishing, you use Packer with the same purpose for virtual machine images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*0xLuIDDnqqZedhvA.jpg" /><figcaption>Pack your ship, folks</figcaption></figure><p>Though I’ll use some basic examples in the upcoming sections to build various Windows-based boxes, some Packer knowledge upfront might be useful. In case something is unclear, please refer to the excellent official <a href="https://www.packer.io/intro/getting-started/install.html">getting started guide</a>.</p><h3>Building a simple box</h3><p><a href="https://github.com/gusztavvargadr/packer">The repository</a> I use for building the virtual machine images contains <a href="https://github.com/gusztavvargadr/packer#overview">configurations</a> for core operating systems with Docker, .NET development with Visual Studio, and .NET hosting with IIS and SQL Server using either Hyper-V — now with support for nested virtualization — and VirtualBox. To prevent duplication and support easier management of complex templates, I’ve ended up creating some custom helper scripts with <a href="http://cakebuild.net/">Cake</a> to start building a proper pipeline for these components.</p><p>Let’s see how to use this to build a core OS image with Windows Server 2016 Standard. From the root of the clone of the repository you can invoke the build script to list the available configurations:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/750fa19c4f9e7a866be0afd001d5c337/href">https://medium.com/media/750fa19c4f9e7a866be0afd001d5c337/href</a></iframe><p>The output lists all the available configurations to build:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd538b5e5ec95a9e0abd2d6f08919a5f/href">https://medium.com/media/fd538b5e5ec95a9e0abd2d6f08919a5f/href</a></iframe><p>Let’s say we want to build a Windows Server 2016 Standard image for Hyper-V for now, so we filter for that:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4af25e4864a1c515d1a4f327a2d72107/href">https://medium.com/media/4af25e4864a1c515d1a4f327a2d72107/href</a></iframe><p>The output lists a single configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7029b16645025452cdcd640c1fee668c/href">https://medium.com/media/7029b16645025452cdcd640c1fee668c/href</a></iframe><p>Now let’s create the input files for Packer. Notice that the commands filter the available configurations and match only those which contain the specified argument (for example, for the restore command you type only w16s-hyperv, and it matches the w16s-hyperv-sysyprep configuration):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e94d934dd2643e23b9829dbc24752ea0/href">https://medium.com/media/e94d934dd2643e23b9829dbc24752ea0/href</a></iframe><p>This command will create Packer’s template.json and all the other necessary input files (for example, in this case, the Autounattend.xml for setting up Windows) in the build\w10\hyperv-sysprep folder. These contain some reasonable defaults, but at this stage, you can adjust the parameters according to your needs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67a9838340146bd3d5c9ca79ef55c9c4/href">https://medium.com/media/67a9838340146bd3d5c9ca79ef55c9c4/href</a></iframe><p>Now we can invoke the build process:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30f3ff9b008ec3f86306604bfeed3ffe/href">https://medium.com/media/30f3ff9b008ec3f86306604bfeed3ffe/href</a></iframe><p>At this stage it’s time to be patient. Packer downloads the OS ISO, and then it boots a Hyper-V virtual machine where it installs the OS, does some basic configuration, then exports the box to be reused with Hyper-V directly or with <a href="https://www.vagrantup.com/">Vagrant</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15d7dab976402d410e99c3b881eff918/href">https://medium.com/media/15d7dab976402d410e99c3b881eff918/href</a></iframe><p>We can test the build output locally by launching a virtual machine using Vagrant and connecting to it through RDP or PowerShell:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/87ff063910c797dc4de341fba7ab6e92/href">https://medium.com/media/87ff063910c797dc4de341fba7ab6e92/href</a></iframe><p>See the details of the required tools and the full steps to build various images <a href="https://github.com/gusztavvargadr/packer#getting-started">here</a>.</p><h3>Build chaining</h3><p>In the previous example, we’ve built an image by installing the core OS from the official ISO directly. Fortunately, Packer allows starting from the output of previous builds as well. This way we can save significant time by skipping the standard provisioning steps (e.g. installing Windows Updates) or installing the same tools again.</p><p>For example, to build a box with IIS for VirtualBox, we can type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28eb791c8a7ded6c00013626af75b9cc/href">https://medium.com/media/28eb791c8a7ded6c00013626af75b9cc/href</a></iframe><p>As the recursive parameter specifies, this command will first build the core w16s image, then, reusing its output, create a separate one with IIS as well.</p><p>Next time, if we want a Visual Studio image, the similar command will also reuse the core w16s image, reducing the build time significantly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b026846d180a7f9ca620e1ee49a69f1/href">https://medium.com/media/6b026846d180a7f9ca620e1ee49a69f1/href</a></iframe><p>Chaining builds like this has no limitations (other than time and disk space), so we can easily define custom configurations to contain multiple components:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b08dc24590cebec21ff12edb8e4c820c/href">https://medium.com/media/b08dc24590cebec21ff12edb8e4c820c/href</a></iframe><h3>Next steps</h3><p>I’ve prepared a couple of examples to build your workstations for .NET development using the images created above. For example, you can define the tools and repositories your projects need using simple YAML configuration files and share it with your teammates and collaborators. This way you can avoid writing extensive documentation to set up development environments manually, and simply do a vagrant up to recreate it anywhere, anytime. You can check the details of this approach <a href="https://github.com/gusztavvargadr/workstations">here</a>.</p><p>Let me know if you’d like more details on the Packer build process and / or other infrastructure automation tasks. In that case, don’t forget to <a href="https://blog.gusztavvargadr.me/">check back for updates</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c20aa47eaa3f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/5-packer-templates-for-net-development-with-hyper-v-and-virtualbox-c20aa47eaa3f">#5 Packer templates for Docker, IIS, SQL Server and Visual Studio</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#4 Three years later at AP-later]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/4-three-years-later-at-ap-later-e3c1d0be3f96?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3c1d0be3f96</guid>
            <category><![CDATA[personal]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Sun, 15 May 2016 00:00:00 GMT</pubDate>
            <atom:updated>2019-06-21T00:57:22.442Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Summary of my three years at Albumprinter</h4><p><strong>It’s been a while since my last post. It’s not that I haven’t been busy with experiments and prototypes worth sharing, it’s rather that I’ve been too busy to share them — at least that was the excuse I found for myself.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*APe7-tbVPaa3j4t0.jpg" /></figure><p>We have some hard deadlines at <a href="http://www.albumprinter.org/">Albumprinter</a>, my current employer, so while focusing on those projects, I kept postponing writing new posts for my blog. I’ve just had my three year anniversary there and since most of my experiments are more or less related to “regular work”, I though it might make sense to write a summary of my experiences so far.</p><p>I am now focusing on tackling <a href="http://www.amazon.com/Busy-How-Thrive-World-Much/dp/1455532983/">being busy</a> in general (represented by <a href="https://en.wikipedia.org/wiki/The_Scream">The Scream</a> above), and as part of that, setting up metrics and alerts for myself to provide early warnings when things are about to get out of control (such as now). As a critical metric, I’ll monitor the frequency of new posts on this blog, so expect some more topics soon and at a more solid pace. To achieve that, hopefully, I’ll find the time first that is required to take a step back, but writing this down is already a good sign in itself.</p><h3>Entering Albumprinter</h3><p>So let’s get back to “work”. This is of course not the only possible way or not even an optimal one to get it done, but here are the steps I took to get to Albumprinter.</p><ul><li>Be born and raised in <a href="https://en.wikipedia.org/wiki/Hungary">Hungary</a>. Focus on the abstract and spend some time in IT.</li><li>Have a girlfriend who is about to lose her job due to her employer reorganizing and centralizing, moving departments from all over Europe to <a href="https://www.iamsterdam.com/en/">Amsterdam</a>, the <a href="https://en.wikipedia.org/wiki/Netherlands">Netherlands</a>.</li><li>Decide together in three days that she should apply for a position at her department at the new location.</li><li>Quit everything and follow her when she gets the job.</li><li>Move to the Netherlands in the winter, but do some work remotely for your last employer in Hungary, so you don’t go crazy while watching people parking their cars in the rain for months, all this in grayscale.</li><li>Get a few job offers and reject them all, even if they have better benefits, in favor for Albumprinter, as you know from the first moment that this is the place to work at.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*wwkK_FLYwWF4NdTg.jpg" /></figure><p>How do you know you’ve found that place? You just feel it. People’s attitude during the interviews, but the overall atmosphere just reflects it. Being close to <a href="https://en.wikipedia.org/wiki/Amsterdam_Centraal_station">Centraal Station</a> and having an <a href="http://www.iamexpat.nl/read-and-discuss/lifestyle/articles/lunch-break-dutch-style">awesome lunch</a> are relative anyway.</p><h3>Early days</h3><p>Moving to another country is quite stressful in itself, even if it’s still in Europe (on the same continent, not necessarily the same “Europe”), and in our case, the same <a href="https://en.wikipedia.org/wiki/Central_European_Time">time zone</a>; and, there are a lot of tiny differences. It’s much more than that the sun rises and sets at weird times. You get used to it very quickly, though, as you realize soon that these little differences add up to something much more livable. You accept (and after a while, expect) the new environment as the new standard, and the differences become much more shocking when you return to where you came from, even if only for a couple of days.</p><p>In my experience, generally, in Hungary people are much more stressed and depressed. I think it’s a result of <a href="http://9gag.com/gag/6832266/some-fact-about-hungary">our history</a>, which is now part of our nationality somehow, which is further emphasized by some people’s living conditions. We never really give up, but also, we don’t expect too much. This results in anger, and yelling at each other is quite common in the workplace, and, unfortunately, at home too.</p><p>So, when starting working at Albumprinter, I was expecting the same, and it just did not happen. I did not understand why they did not yell at me because I probably made some mistakes or chose some sub-optimal solutions during the learning phase and since then, too. After a while, on purely a statistical basis, based on my former experience, I was expecting a <a href="http://how-i-met-your-mother.wikia.com/wiki/The_Chain_of_Screaming_(theory)">yelling-only day</a> or simply that I will be just fired for this and that. The turning point, when I realized it will never happen, arrived in two stages.</p><p>First, one of my emails starting with the standard line about being sorry for the stupid question was answered with stating that there’s no such thing as a stupid question. And it was in a way that I knew they meant it. Shortly after this, following one of our regular stand-up meetings, someone sent around an email apologizing for raising his voice during the meeting. I was quite surprised as I did not even notice it happened, as it did not hit my usual threshold of someone raising his voice. After a couple of months at Albumprinter, I was now quite sure that I’ve found a workplace where I can start focusing on building something great.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*ErJO30gRlOWgKA-g.jpg" /></figure><p>I cannot emphasize enough the importance of people smiling and being friendly and open to new ideas and discussions all the time. It yields such a great boost to morale and productivity that no one can afford not to have this. This behavior being the norm — not just in the workplace, but on the scale of a whole country — is sometimes still unbelievable to me. Again, people’s attitude is probably an indicator of how well things are going in general, but at least we have an indicator. It can be more complicated to quantify than <a href="https://en.wikipedia.org/wiki/Gross_domestic_product">GDP</a>, but it is also harder to <a href="https://en.wikipedia.org/wiki/World_Happiness_Report">lie about</a>.</p><h3>Projects</h3><p>Below is a quick summary of some of the actual projects I’ve been working on.</p><h4>Phone Cases</h4><p>This project was an excellent example of how we introduce new products, and also gave some good insights into how people think (differently) about doing business here in general. There is a slight difference between what each of the departments think about new product introduction. Sometimes, adding a new photo book to our portfolio with a different size or orientation is referred to as new or even an innovation, though in IT this is something we tend to call configuration.</p><p>Introducing <a href="http://www.albelli.co.uk/products/photo-phone-cases">phone cases</a>, on the other hand, started as a real experiment because it required a whole new product line. It was a great opportunity for me to learn the details of our infrastructure in general, as it involved changes to all the major components of our flow. New editors were required, so our customers could design their product, we had to adjust our checkout process, so customers could order it, and finally, we had to expand and customize our production facilities so we could fulfill the orders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ZpkmD423N6RQZFuq.jpg" /></figure><p>The project was a huge success; our customers loved it, the implementation went quite smoothly, and the business expectations were overachieved starting from day one. Based on that, I was expecting a much faster response from our side and quicker expansion of this part of the portfolio, but at least we have made some progress around this since then.</p><h4>Checkout Redesign</h4><p>This project was a must-have, bringing our checkout flow up-to-date in the context of user experience and modern web standards. I think that, unfortunately, we missed the point a bit here. Our checkout application is a classic monolith — too complicated to understand, too fragile to change. Changes were inevitable but, in my opinion, were carried out in a sub-optimal way.</p><p>The project was based on extensive <a href="https://en.wikipedia.org/wiki/User_experience">UX</a> research and great ideas but done in the classic <a href="https://en.wikipedia.org/wiki/Waterfall_model">waterfall</a> approach. By the time we released the new system, some of the core ideas were more than two years old, and they might not have reflected the actual customer needs (as they haven’t done it since then).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*QpM3CYSlJZqkQ4R0.jpg" /></figure><p>Our frontend developers did a great job implementing the markup according to the latest web standards, but unfortunately, the backend kept the monolith growing instead of taking the chance of making the whole system more maintainable. We ended up in a death march, cutting some major parts of the original scope (this is not necessarily a problem, “just” caused a lot of frustration), resulting in a quite stressful and time-consuming, though in the end successful big bang release.</p><h4>SSO</h4><p>I think we missed improving our overall user experience in general for a long time, focusing only on parts of our flow as separate entities, resulting in weird behavior like as many apps we had, the customer needed to authenticate again and again in all of them. You sign in to save your product in the editor, then sign in to order it in the checkout, and then sign in to the dedicated frontend to check its status.</p><p>We are only a short step away from closing this gap and implementing our <a href="https://en.wikipedia.org/wiki/Single_sign-on">single sign-on</a> solution for the last component of our pipeline too. The solution is based on industry-standard technologies and protocols (<a href="http://openid.net/connect/">OpenID Connect</a>, <a href="http://oauth.net/2/">OAuth 2.0</a>), to replace the diverse set of authentication and authorization methods used earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*yMKWSvq0GOOuoLTq.jpg" /></figure><p>This project was also a long journey, but all done in a backwards-compatible, incremental way, according to the industry’s best practices. The new identity stack is our team’s flagship product now. “Despite” the inherent complexity of security in general, it is designed to be of excellent quality and maintainability, working with high performance and being highly reliable. It is the proof that you can do it differently, even surrounded by a lot of legacy components. It’s all <a href="http://treasure.diylol.com/uploads/post/image/387049/resized_barney-stinson-meme-generator-possimpible-where-possible-and-impossible-meet-a9c0d9.jpg">possimpible</a>.</p><h3>State of the print</h3><p>Based on the idea of having <a href="http://uk.businessinsider.com/google-20-percent-time-policy-2015-4">20% of our time dedicated to innovation</a>, we have a dev day once a month, when, given that it’s slightly related to Albumprinter, people can choose freely what to work on. Increasing the frequency of this event by bringing it to closer to the above percentage, together with bringing back <a href="https://en.wikipedia.org/wiki/Hackathon">Hackathons</a> to live, could be a huge boost to improving our workflow and infrastructure in general. Even with the above setup, most of the significant achievements we’ve had recently were more or less related to these initiatives.</p><ul><li><em>Back then</em> Use <a href="https://subversion.apache.org/">SVN</a>, alone in the dark.</li><li><strong>Now</strong> Collaborate extensively using <a href="https://github.com/">GitHub</a> pull requests, work in pairs.</li><li><em>Back then </em>Merge binaries and configurations through SVN and <a href="https://technet.microsoft.com/en-us/library/cc733145(v=ws.11).aspx">Robocopy</a> the hell out of it.</li><li><strong>Now</strong> <a href="https://octopus.com/">Octopus Deploy</a>.</li><li><em>Back then</em> Contribute to a shared class library and propagate it everywhere <a href="http://haacked.com/archive/2012/02/16/changing-a-strong-name-is-a-major-breaking-change.aspx/">if you can</a>.</li><li><strong>Now</strong> Deploy a new <a href="http://martinfowler.com/articles/microservices.html">microservice</a> in hours.</li></ul><p>We parted ways with <a href="http://www.hema.nl/">HEMA</a> earlier this year but took the chance to strengthen our own main brand <a href="http://www.albelli.nl/">Albelli</a>.</p><p>We’re currently migrating the services of the Norwegian brand <a href="http://www.fotoknudsen.no/">FotoKndusen</a> (again, represented by <a href="https://en.wikipedia.org/wiki/The_Scream">The Scream</a> above) to our platform. This project has the same issues as Checkout Redesign had, but on a much larger scale. We are doing our best to avoid the risks of the waterfall approach and to minimize the impact of the big bang release two weeks from now.</p><p>We have introduced the term <a href="http://bit.ly/AP-later">AP-later</a> for tagging things which we think will never happen.</p><h3>Future</h3><p>I recently received a recognition award from Albumprinter for my achievements during the last quarter. Together with the award came a 50 EUR <a href="https://www.bol.com/">bol.com</a> voucher, which I spent on contributing back to the people (that is, all of my colleagues) who played a significant part in these. Now our list of offline resources is extended with:</p><ul><li>A copy of <a href="https://www.bol.com/nl/p/agile-project-management-for-dummies/1001004010936109/">Agile Project Management For Dummies</a>.</li><li>A copy of <a href="https://www.bol.com/nl/p/it-architecture-for-dummies/1001004007560364/">IT Architecture For Dummies</a>.</li><li>Two pairs of <a href="https://www.bol.com/nl/p/skandia-lasbril-opklapbaar-kleur-5/9200000010409348/">welding goggles</a>.</li></ul><p>After the FotoKnudsen migration, we can use these to take a step back, and reevaluate our goals and strategies. It would be a perfect time to, after making some agreements, start doing something actual about them.</p><p>I will push for bridging the gaps between the various departments by extending (reintroducing) the adoption of <a href="http://www.agilemanifesto.org/">Agile</a>, and setting up our ubiquitous languages for our problem domains based on <a href="https://en.wikipedia.org/wiki/Domain-driven_design">Domain Driven Design</a>. It seems that once we are quite familiar with the <a href="http://martinfowler.com/eaaCatalog/repository.html">repository pattern</a>, it might make sense to get back to the basics.</p><h3>Summary</h3><p>Thanks for all the great support to:</p><ul><li>Her.</li><li>All my current and ex-colleagues at Albumprinter.</li><li>All the people of the Netherlands.</li></ul><p>And, of course, “<a href="https://en.wikipedia.org/wiki/Himnusz">God, bless the Hungarians</a>”.</p><h3>Resources</h3><ul><li><a href="http://www.albelli-jobs.com/">We are hiring in one year!</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3c1d0be3f96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/4-three-years-later-at-ap-later-e3c1d0be3f96">#4 Three years later at AP-later</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#3 ASP.NET 5 configuration for the masses]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/3-asp-net-5-configuration-for-the-masses-1fa4e22e11e6?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fa4e22e11e6</guid>
            <category><![CDATA[aspnet]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Wed, 30 Dec 2015 00:00:00 GMT</pubDate>
            <atom:updated>2019-06-21T00:56:26.551Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>System.Configuration and beyond</h4><blockquote><strong>Update 2019–06–13</strong> Please note that some details have changed in the ASP.NET Core configuration system compared to what is outlined below since this article was originally published. Although the core concepts still hold, please double check the official documentation at <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/</a> as well.</blockquote><p><a href="https://docs.asp.net/en/latest/"><strong>ASP.NET 5</strong></a><strong>, being a complete redesign of the web stack from Microsoft, brings significant changes to the </strong><a href="https://docs.asp.net/en/latest/fundamentals/configuration.html"><strong>configuration system</strong></a><strong>, too.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*CYTNFg-2zYF7dCB1.png" /></figure><p>This post quickly introduces the new capabilities through the most common usage scenarios by comparing them to the previous versions and provides some easy workarounds for reusing your already existing settings.</p><h3>Core features</h3><p>Let’s see the new features one by one. Just reference the <a href="https://www.nuget.org/packages/Microsoft.Extensions.Configuration/">core NuGet package</a>, and import the Microsoft.Extensions.Configuration namespace to get started.</p><h4>Configuration providers</h4><p>ASP.NET 5 provides a much cleaner and more flexible way of declaring the sources of the configuration settings. Earlier, your only option was to define these values in the <a href="https://msdn.microsoft.com/en-us/library/1xtk877y(v=vs.110).aspx">classic </a><a href="https://msdn.microsoft.com/en-us/library/1xtk877y(v=vs.110).aspx">XML configuration files</a>. Machine and application or folder level settings provided some extensibility, but these options were somewhat limited.</p><p>Consider your settings in JSON like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0957a2070fe52b45cb619a170c4483a7/href">https://medium.com/media/0957a2070fe52b45cb619a170c4483a7/href</a></iframe><p>You then define this as the source of your configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c06c1ead35694643dd1e131236d8726d/href">https://medium.com/media/c06c1ead35694643dd1e131236d8726d/href</a></iframe><p>Getting your standalone settings is as simple as:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19ff06c681ee41486bb84a6b7f516e5a/href">https://medium.com/media/19ff06c681ee41486bb84a6b7f516e5a/href</a></iframe><p>Notice the use of the : character as the separator for the levels of the setting hierarchy. By the way, the keys used to retrieve the values are case-insensitive.</p><p>Of course, JSON is not the only option for loading your settings. Browse the <a href="https://www.nuget.org/packages?q=Microsoft.Extensions.Configuration">available providers</a> and reference the ones that you need, such as the XML file or environment variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db239f19b05fce11a418831a19c0f28f/href">https://medium.com/media/db239f19b05fce11a418831a19c0f28f/href</a></iframe><p>Besides the flexibility the different file formats provide, an excellent addition is supporting the abstraction for using various types of sources like environment variables or command-line parameters. This pattern provides a clear separation between defining and using the different settings via the explicit step for “building” from the sources.</p><h4>Environments</h4><p>When multiple sources are set up as above, they are modeled internally as layers, in the order which they are declared when building the configuration. That is, when a setting is defined in multiple sources, the last one overwrites the previous ones.</p><p>As <a href="https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx">configuration transformations</a> are not available, because the new system is not relying on XML anymore, this approach can be used to define settings for different environments effectively. Just create your baseline configuration and the differences for a given deployment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b079e6db7c07205bf9703c24efdf8025/href">https://medium.com/media/b079e6db7c07205bf9703c24efdf8025/href</a></iframe><p>Based on the application type, the environment itself can be identified by the <a href="https://docs.asp.net/en/latest/fundamentals/environments.html">host</a> or, just like another layer of configuration, with the sources of your choice (e.g. command-line or environment variables).</p><p>Unfortunately, no generic mechanism exists yet for getting notified of the changes of any of the sources, but you can manually invoke Reload() for the already-built configuration any time.</p><h4>Complex values</h4><p>One of the most powerful new features is the ability to bind to complex types. By referencing <a href="https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Binder/">the dedicated package</a> you can easily load typed settings, even of those having complex hierarchies:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/321a6699bc88ff81a7d191f4441cdeb8/href">https://medium.com/media/321a6699bc88ff81a7d191f4441cdeb8/href</a></iframe><p>This approach also supports defining default values, simply by assigning them to the type itself in the constructors, for example.</p><p>With the <a href="https://www.nuget.org/packages/Microsoft.Extensions.OptionsModel/">options model</a>, you can bring this to the next level, and use dependency injection to retrieve the settings. You can set up the related service, and then simply reference the settings you need.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6028a9e7dd6ac1a5f54e886a4bc03168/href">https://medium.com/media/6028a9e7dd6ac1a5f54e886a4bc03168/href</a></iframe><p>Configuration for the application itself and the related unit tests, solved.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/546363b041be377386b955cc53400254/href">https://medium.com/media/546363b041be377386b955cc53400254/href</a></iframe><h3>Reusing existing settings</h3><p>As expected, it is also possible to define custom configuration providers to load the settings from any alternative sources you might have. <a href="https://github.com/gusztavvargadr/aspnet-Configuration.Contrib">These simple providers</a> support loading settings from <a href="https://octopus.com/">Octopus Deploy</a> <a href="http://docs.octopusdeploy.com/display/OD/Variables">variables</a> and classic XML configuration files.</p><h4>Octopus Deploy variables</h4><p>If you are already using Octopus for deployments, you probably also have some of your applications’ settings defined as variables. This provider, which also enables some centralized configuration scenarios, can be used to load the appropriate settings scoped to the current project, environment, and machine.</p><p>Using one of the projects of the <a href="https://octopus.com/blog/demo-server">demo server</a> as a sample:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*Ij-2QXlveN8tJOe3.png" /></figure><p>Variable substitution and scoping works as expected:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/befd76c5cbc0a7e8d4257cebba2cb778/href">https://medium.com/media/befd76c5cbc0a7e8d4257cebba2cb778/href</a></iframe><p>See the <a href="https://github.com/gusztavvargadr/aspnet-Configuration.Contrib/wiki/Octopus-Deploy-variables">Wiki</a> for more details.</p><h4>Classic XML configuration files</h4><p>Independently of how weird it is to lock an advanced abstraction to its legacy roots, by using these providers, you can easily load your existing Web.config, app.config or other custom files to wire up the application settings and connection strings in the new system.</p><p>The settings are equivalent with the JSON format above:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/092eee66f3787631e3c9fe150247e5f9/href">https://medium.com/media/092eee66f3787631e3c9fe150247e5f9/href</a></iframe><p>The values are loaded as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69149fa7b6683ac5354528299fcfb76e/href">https://medium.com/media/69149fa7b6683ac5354528299fcfb76e/href</a></iframe><p>See the <a href="https://github.com/gusztavvargadr/aspnet-Configuration.Contrib/wiki/Classic-XML-configuration-files">Wiki</a> for more details.</p><h3>Summary</h3><p>As described above, the new configuration system provides a clean, lightweight, and easily extensible framework for working with settings. Through custom providers, you can support centralized configuration scenarios and an alternative approach for <a href="https://docs.asp.net/en/latest/security/app-secrets.html">managing secrets</a> safely.</p><h3>Resources</h3><ul><li><a href="https://docs.asp.net/en/latest/fundamentals/configuration.html">ASP.NET 5 Configuration</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fa4e22e11e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/3-asp-net-5-configuration-for-the-masses-1fa4e22e11e6">#3 ASP.NET 5 configuration for the masses</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#2 GitVersion to the rescue]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/2-gitversion-to-the-rescue-97781db31ec2?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/97781db31ec2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[semantic-versioning]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Fri, 30 Oct 2015 00:00:00 GMT</pubDate>
            <atom:updated>2019-06-21T00:55:23.461Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Convention-based GitFlow and Semantic Versioning</h4><blockquote><strong>Update 2019–06–13</strong> Please note that I consider the branching pattern outlined below now obsolete and NOT suitable for most solutions these days. Although I still recommend using Semantic Versioning and GitVersion, please see some more advanced approaches to continuous delivery and branching at <a href="http://www.davefarley.net/?p=269">http://www.davefarley.net/?p=269</a> as well.</blockquote><p><strong>In the </strong><a href="https://blog.gusztavvargadr.me/1-everyday-gitflow-and-semantic-versioning-6d04023d6bf2"><strong>previous post</strong></a><strong> about </strong><a href="http://nvie.com/posts/a-successful-git-branching-model/"><strong>GitFlow</strong></a><strong> and </strong><a href="http://semver.org/"><strong>Semantic Versioning</strong></a><strong>, I have outlined a configuration for convention-based version number generation and status checks through the deployment pipeline. As I have mentioned there, I just came across </strong><a href="https://github.com/GitTools/GitVersion"><strong>GitVersion</strong></a><strong>, the awesome tool that brings this setup to the next level. Actually, given this tool’s capabilities, what I have described earlier as an automated flow for the above tasks now feels like doing all the work manually.</strong></p><p>In this post, I show a configuration using this new tooling, producing the same result; however, it was achieved in a much more flexible and maintainable way. There is no need for maintaining a base version number manually and committing its changes back to source control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*ikt9uoM7ylIEqJO0.png" /></figure><p>Based on these posts, it seems that this is a blog about GitFlow and Semantic Versioning only, but this is not the case. It’s just that all of the posts are about that topic so far.</p><h3>Requirements</h3><p>The exact list of requirements is covered in detail in the <a href="https://blog.gusztavvargadr.me/1-everyday-gitflow-and-semantic-versioning-6d04023d6bf2">earlier post</a>, but here is a short excerpt. Given a sample list of GitFlow-based steps, we expect the following version numbers for our <a href="https://www.nuget.org/">NuGet</a> package artifacts:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c71a3ba862d5b8045bf2ea1c6311f2c3/href">https://medium.com/media/c71a3ba862d5b8045bf2ea1c6311f2c3/href</a></iframe><p>Using this pattern, we encode the type of the release in the version number, and we also have the natural order of “strength” of the artifacts as we go through the process of developing a feature from the first commit to deploying to production.</p><h3>Implementation with GitVersion</h3><p>I used custom CI build scripts earlier to set up the above versioning pattern based on the CI build number, the current branch, and some implicit rules derived from GitFlow. It is exactly what GitVersion masters, in a highly configurable way, resulting in a much more flexible solution than encoding custom rules in custom scripts.</p><p>It supports a <a href="http://gitversion.readthedocs.org/en/latest/usage/command-line/">command line</a> executable and an <a href="http://gitversion.readthedocs.org/en/latest/usage/msbuild-task/">MSBuild</a> task also to do its magic as part of the build process. For the purpose of setting up this configuration, I have chosen the command line version because just invoking it outside the context of a build was much more comfortable for some debugging scenarios. As soon as the solution gets more stable, the “regular” build integration might be a better option.</p><h4>Configuration</h4><p>After installing it, and invoking the command line executable by typing gitversion inside a folder containing the clone of a Git repository, GitVersion dumps out a list of variables containing the calculated version numbers for different purposes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16d4eaad430a76b9407fd8b0f9426e9d/href">https://medium.com/media/16d4eaad430a76b9407fd8b0f9426e9d/href</a></iframe><p>The values are <a href="http://gitversion.readthedocs.org/en/latest/more-info/version-sources/">determined</a> by the current branch and the commits since the latest base version (based on like tags and version numbers in branch names) and, of course, GitVersion’s configuration defining, for example, the version increment policies for the different branches. By default, it is set up for GitFlow, as we can check by executing gitversion /showconfig:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54cef2e496c546209f7ee7ef5704c8dc/href">https://medium.com/media/54cef2e496c546209f7ee7ef5704c8dc/href</a></iframe><p>The various global or branch-level <a href="http://gitversion.readthedocs.org/en/latest/configuration/">configuration options</a> can then be customized according to our needs by creating the GitVersionConfig.yaml file and specifying the differences:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28ce634ab320fef3ac4416d485c9926c/href">https://medium.com/media/28ce634ab320fef3ac4416d485c9926c/href</a></iframe><p>In this setup, I have applied the ContinuousDeployment mode and the custom assembly informational version formatting globally, resulting in a (NuGet) version number that differs for every commit and can be used as the input for Octopus Deploy’s <a href="http://docs.octopusdeploy.com/display/OD/Using+OctoPack">packaging tool</a> without any further configuration, fully supporting continuous deployment.</p><p>The custom tag values set up the prefixes for the prerelease version number extensions as described above. The only exception here is the configuration of feature branches; for that, currently, we need the hack of starting their names with the letter a to support the desired version order.</p><p>We can make sure that the settings are applied as expected by executing gitversion /showconfig again so our settings merge with the defaults:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/caccce571925852173109fa1df762f4a/href">https://medium.com/media/caccce571925852173109fa1df762f4a/href</a></iframe><h4>Usage</h4><p>GitVersion comes with out-of-the-box support for the major CI build providers, that is, it automatically recognizes its execution context and reads (like the current branch) and writes (like the CI build number) specific settings accordingly. The following is a sample <a href="http://www.appveyor.com/">AppVeyor</a> configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8c41d03ec0bac24aff9d1191175ba0b/href">https://medium.com/media/d8c41d03ec0bac24aff9d1191175ba0b/href</a></iframe><p>I have set up here logging to the console and writing output in the format specific to the CI build environment. Also, I have specified our custom file that stores the assembly version metadata and the branch name to make sure the correct one is used when like a branch is opened and pushed without any further commits yet.</p><p>After a couple of steps of improving the support for “working with values” in the sample project, we get the following version numbers:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94d937b0eaafdb3007770bf655aea444/href">https://medium.com/media/94d937b0eaafdb3007770bf655aea444/href</a></iframe><p>The prerelease tag prefixes are slightly different from the above requirements, but the same package order is still maintained. We no longer rely on internal build numbers of the CI environment, but use GitVersion’s commit counter instead. We just use the semantic version number as the build number too.</p><h3>Extras</h3><p>Besides relying now only on configuration, instead of writing custom scripts for handling version numbers, we gain the following extras also by using GitVersion.</p><h4>Status checks</h4><p>I am a huge fan of <a href="https://github.com/">GitHub</a>’s recently introduced <a href="https://github.com/blog/2051-protected-branches-and-required-status-checks">protected branches</a> feature. With the related required status checks, we can prevent propagating the required artifacts through the deployment pipeline by simply blocking creating the release itself. For this to work effectively, it seems to make sense to turn on the branch protection for every branch except the feature branches.</p><p>Manually maintaining a base version in this setup, though, requires usually new feature branches just for bumping the version number that feels to have a clear smell that something is wrong. Again, GitVersion solves this problem by resolving the base version based on the repository objects we already have, anyway.</p><h4>Deployment</h4><p>Now it feels natural that Octopus Deploy has just (pre)released supporting customizing deployment processes based on branching and versioning patterns. Its long-awaited <a href="https://octopus.com/blog/channels-walkthrough">Channels</a> feature eliminates the need for custom processes or scripts based on the type of a release. I look forward to this feature being available in the next stable release and further simplifying our continuous deployment workflow with it. They use GitVersion for demonstrating Channels, as you might have guessed.</p><h3>Summary</h3><p>I hope this post will help you to give GitVersion a try, in case you were unfamiliar with it before. Even if your workflow differs significantly from the one described above, I encourage you to play with it, as it natively supports all the major branching models as well as the CI build providers, and through its extensive configuration options, the possible use cases are basically endless. Share your experiences in the comments.</p><p>I am also glad that the recent new features for tooling are signs that at least some of us are getting closer to having an unofficial consensus on branching and release management. In case you still miss some features, create an issue or send them a pull request.</p><h3>Resources</h3><ul><li><a href="https://github.com/GitTools/GitVersion">GitVersion</a></li><li><a href="http://nvie.com/posts/a-successful-git-branching-model/">GitFlow</a></li><li><a href="http://semver.org/">Semantic Versioning</a></li><li><a href="https://octopus.com/">Octopus Deploy</a></li><li><a href="http://www.appveyor.com/">AppVeyor</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97781db31ec2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/2-gitversion-to-the-rescue-97781db31ec2">#2 GitVersion to the rescue</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#1 Everyday GitFlow and Semantic Versioning]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/1-everyday-gitflow-and-semantic-versioning-6d04023d6bf2?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d04023d6bf2</guid>
            <category><![CDATA[semantic-versioning]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Sun, 20 Sep 2015 00:00:00 GMT</pubDate>
            <atom:updated>2019-06-21T00:54:36.954Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Branching and versioning strategies for release management</h4><blockquote><strong>Update 2019–06–13</strong> Please note that I consider the branching pattern outlined below now obsolete and NOT suitable for most solutions these days. Although I still recommend using Semantic Versioning and GitVersion, please see some more advanced approaches to continuous delivery and branching at <a href="http://www.davefarley.net/?p=269">http://www.davefarley.net/?p=269</a> as well.</blockquote><p><strong>Although I’ve been using both </strong><a href="http://nvie.com/posts/a-successful-git-branching-model/"><strong>GitFlow</strong></a><strong> and </strong><a href="http://semver.org/"><strong>Semantic Versioning</strong></a><strong> for a long time now, I’ve always felt that something is missing from the everyday workflow. They are both nice concepts, but they offer solutions for problems in different domains. Nevertheless, applying them together seems to be a bit more complicated than I feel it should be.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*6EzF2qpGWU1IZfUO.png" /></figure><p>It might also mean, of course, that the workflow I try to apply it to is not optimal, but that can be a topic for a different post later. In this one, I just want to describe one simple approach for managing the release of applications and other shared components.</p><h3>The problem</h3><p>How do we make sure that an application release never gets to production without passing the integration tests? How do we make sure that a class library <a href="https://www.nuget.org/">NuGet</a> package never gets published to a public feed without passing the static code analysis requirements?</p><p>Most of the tools we need for these tasks are already there, and we are already using them “manually”. What’s missing is some more automation, but to achieve that, we need some conventions and patterns.</p><h3>The toolkit</h3><p>Let’s see in a bit more detail what we already have.</p><h4>Environments</h4><p>Unless we meet the requirements or the infrastructure for testing in production, a classic approach is using <a href="https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production">different environments</a> for different stages of the deployment pipeline, like integration testing or user acceptance. What we need to make sure of is that a specific version can be deployed only to the environments it is allowed to. For this, we need first the unique identification of each version.</p><h4>Semantic Versioning</h4><p>Before going into the details of what exactly we need to version, we have to think about how to do versioning at all. This topic is not new and, fortunately, we have Semantic Versioning, which is obviously versioned also conforming to itself as we can double-check reading through the <a href="http://semver.org/">specifications</a>.</p><p>A nice extra in the .NET world is that NuGet itself <a href="https://docs.nuget.org/create/versioning#really-brief-introduction-to-semver">almost supports it</a> as do <a href="https://www.nuget.org/packages/log4net/2.0.3">most of the public packages</a>. At least we have an option here.</p><h4>GitFlow</h4><p>For most of the projects, I have worked with GitFlow and always have felt it to be the first natural choice to go with. In case it turns out to be too complex, given the frequency of changes or the level of collaboration we can “fall back” to e.g., <a href="https://guides.github.com/introduction/flow/">GitHub Flow</a> where everything is “just” a hotfix.</p><p>I would like to add though that we don’t even need Git for this setup, as the ALM Rangers also <a href="http://vsarbranchingguide.codeplex.com/">describe</a>; it is just easier to implement with it than, for example, Subversion.</p><p>I will not go into the details of the various branching strategies themselves, as their documentation is already the <a href="http://nvie.com/posts/a-successful-git-branching-model/">best</a> <a href="https://guides.github.com/introduction/flow/">that</a> <a href="http://vsarbranchingguide.codeplex.com/">we can have</a>.</p><h3>A method to forget</h3><p>In the good old days, before the tools mentioned above were available, or were there but were just ignored, a common approach was to build a version once and propagate the same artifacts across different environments. A basic solution for this was to commit the actual binaries to a dedicated repository and propagate them through a custom set of branches that reflected the actual environments. This sometimes involved baseless merges and a lot of merge conflicts in mainly configuration files. “All we needed” after this was some custom script on top of Robocopy to make the actual deployment.</p><p>This setup is very error-prone due to the number of manual steps required, and because things can go wrong easily, they usually do. Please forget this approach and everything you read in the previous paragraph too.</p><h3>The next approach</h3><p>Now, let’s take a look at the possible uses of the above concepts and the related tools.</p><h4>Artifacts</h4><p>For identification, we version various (CI build) artifacts like deployment and shared component packages. A basic requirement is to link to the source of the change (in this case, a Git commit hash) and to the process that creates it (the CI build identifier). This is a fairly straightforward setup in most CI tools that use the internal build counter.</p><p>For shared components, NuGet is there for the rescue. Using a deployment manager like <a href="https://octopusdeploy.com/">Octopus Deploy</a> enables the use of the same concept for all these deliverables. However, how do we construct and apply the required metadata exactly?</p><h4>Branches and releases</h4><p>Instead of creating dedicated branches for environments, let’s create artifacts that describe their stage in the deployment pipeline to link naturally to the environment they need to be deployed to. Based on the convention of what the environment is used for, we can identify the next step in the workflow automatically.</p><p>First, we have to define how “stable” is an artifact built from a given branch:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d161d5b9db1662c32ebde5fa864c652f/href">https://medium.com/media/d161d5b9db1662c32ebde5fa864c652f/href</a></iframe><p>Based on the above version formats, we set up the <a href="http://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin">assembly metadata</a>, e.g., through a shared file across all the projects in a solution as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/018698785d3f168315577cc3301395b7/href">https://medium.com/media/018698785d3f168315577cc3301395b7/href</a></iframe><p>For AssemblyInformationalVersion, we use exactly the same format as defined in the table above. This setup provides the version numbers as expected according to Semantic Versioning for the runtime itself, the CI build identification, and the resulting artifacts’ package version.</p><p>Given some sample GitFlow-based steps, our NuGet packages will have the following versions after a CI build being triggered on commits:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a65cbe5b2ccb5c9f8d06569d1673d233/href">https://medium.com/media/a65cbe5b2ccb5c9f8d06569d1673d233/href</a></iframe><p>This pattern reflects the natural order of “strength” of releases when sorting packages by version, as well. When I have to bump the version number, I prefer incrementing it manually on release and hotfix creation in the shared metadata file and committing it to the repository. This way it propagates is through merging, as everything else, and I will always have the correct actual values for the local clones too.</p><h4>Deployments</h4><p>The first line of defense for making sure we do not accidentally deploy packages to “wrong” environments is to block package creation. Aside from the regular techniques like failing the whole CI build, when unit tests fail, we can utilize <a href="https://help.github.com/articles/about-protected-branches/">protected branches</a>.</p><p>Using the concept of <a href="http://docs.octopusdeploy.com/display/OD/Lifecycles">lifecycles</a> in Octopus Deploy, we can control the propagation of an actual release through the different environments. In the above flow, however, we have different artifacts and new releases for the various stages, so what we need is controlling where a release can enter the deployment pipeline:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e7251f9f75acf159b6b55b282cb3cd9/href">https://medium.com/media/6e7251f9f75acf159b6b55b282cb3cd9/href</a></iframe><p>This check can be enforced via a custom script, until something similar is natively supported in the form of like version-based multiple lifecycle types for a project. By encoding the release type information into the package version, we have the foundation now for “safe” and automatic release creation and deployment. We can use either Octopus Deploy <a href="http://docs.octopusdeploy.com/display/OD/Automatic+Release+Creation">natively</a>, or utilities like deployment trains, for example, based on a predefined schedule.</p><h3>Alternatives</h3><p>Having the same release number as the deployment packages’ version number itself (actually not separating the concepts of the release and the artifact properly) is still a bit smelly here. Especially for NuGet packages of class libraries, some additional release naming scheme based on, e.g., tagging (which is recommended to use, at least for stable releases, anyway) could be a nice improvement.</p><p>I have just came across that <a href="https://github.com/GitTools/GitVersion">GitVersion</a> supports these types of conventions natively in a highly customizable way, so this tool is definitely worth <a href="https://blog.gusztavvargadr.me/2-gitversion-to-the-rescue-97781db31ec2">taking a look at</a>.</p><h3>Summary</h3><p>In this post, we have seen a simple approach for managing the release of applications and other shared components. Hopefully, some parts might be useful for you in one way or another.</p><p>Add your comments below about the setup above or about how you do branching, versioning, and release management in general.</p><h3>Resources</h3><ul><li><a href="http://nvie.com/posts/a-successful-git-branching-model/">GitFlow</a></li><li><a href="http://semver.org/">Semantic Versioning</a></li><li><a href="https://octopusdeploy.com/">Octopus Deploy</a></li><li><a href="https://github.com/GitTools/GitVersion">GitVersion</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d04023d6bf2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/1-everyday-gitflow-and-semantic-versioning-6d04023d6bf2">#1 Everyday GitFlow and Semantic Versioning</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#0 Let the games begin]]></title>
            <link>https://medium.com/where-do-you-want-to-throw-today/0-let-the-games-begin-27ddaa818198?source=rss-82a1a3ed5fe5------2</link>
            <guid isPermaLink="false">https://medium.com/p/27ddaa818198</guid>
            <category><![CDATA[personal]]></category>
            <dc:creator><![CDATA[Gusztáv Varga]]></dc:creator>
            <pubDate>Wed, 16 Sep 2015 00:00:00 GMT</pubDate>
            <atom:updated>2019-06-21T00:53:42.171Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>The root of all evil</h4><p><strong>This starts with 0 as expected, but it’s already a major improvement considering that the site did not exist at all before.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*007K9rLCsVRvaRdd4hK7fQ.png" /></figure><p>But don’t worry, it will go soon to <a href="https://www.youtube.com/watch?v=KOO5S4vxi0o">11</a>, <a href="http://www.joelonsoftware.com/articles/fog0000000043.html">12</a> and then far beyond.</p><h3>Welcome to my world</h3><p><a href="http://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action?language=en">Why? How? What?</a></p><p>My name is Gusztáv Varga. I’m a software engineer working for <a href="http://www.albelli-jobs.com/">Albelli</a> in <a href="http://iamsterdam.com/">Amsterdam, The Netherlands</a>.</p><p>The name <a href="https://en.wikipedia.org/wiki/Gustav_(name)">Gusztáv</a> is of Swedish origin in contrast to my <a href="http://gotohungary.com/">Hungarian</a> in contrast to our <a href="http://www.setileague.org/askdr/hungary.htm">alien race</a>.</p><p>This is my blog about some personal matters and software engineering in general, but slightly biased towards .NET and the Microsoft platforms, which I most of the time work with.</p><p>The name of the site comes from a related <a href="https://en.wikipedia.org/wiki/Where_do_you_want_to_go_today%3F">famous campaign</a> from the last millennium.</p><p>Setting all this up and writing the <a href="https://blog.gusztavvargadr.me/1-everyday-gitflow-and-semantic-versioning-6d04023d6bf2">first actual post</a> after postponing it for years was inspired by <a href="http://simpleprogrammer.com/">John Sonmez</a>, <a href="http://www.hanselman.com/">Scott Hanselman</a>, <a href="http://www.joelonsoftware.com/">Joel Spolsky </a>and <a href="http://asizikov.github.io/">Anton Sizikov</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27ddaa818198" width="1" height="1" alt=""><hr><p><a href="https://medium.com/where-do-you-want-to-throw-today/0-let-the-games-begin-27ddaa818198">#0 Let the games begin</a> was originally published in <a href="https://medium.com/where-do-you-want-to-throw-today">Where do you want to throw today?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>