The first step of this tutorial is: "How to customize the Team Foundation Server (TFS) 2013 workflow".
- Into the TFS "build" tab of visual studio, right click on the build definition to customize and click on "Edit Build Definition"
- In the "Process" tab, click on show details and then download you current template. This will download a xaml file. Save it somewhere in your project and rename the file.
- Now you can open this file in visual studio or in a notepad++ for example. I will use both tools depending of what I need to change. Sometime it is easier to edit in notepad, sometime in visual studio.
- First thing to do is adding a section with the octopus parameter and another one with the TDS options as in this screenshot:
- To do that, wa need to create 5 new variables by adding the following code before </x:Members>
<x:Property Name="Octopus_OctoPackPublishApiKey" Type="InArgument(x:String)" /> <x:Property Name="Octopus_OctoPackPublishPackageToHttp" Type="InArgument(x:String)" /> <x:Property Name="Octopus_RunOctoPack" Type="InArgument(x:Boolean)" /> <x:Property Name="TDS_IsDesktopBuild" Type="InArgument(x:Boolean)" /> <x:Property Name="TDS_GeneratePackage" Type="InArgument(x:Boolean)" />
- Add those parameter into the UI by adding the following code before </mtbw:ProcessParameterMetadataCollection>
<mtbw:ProcessParameterMetadata BrowsableWhen="Always" Category="#500 Octopus" Description="Set this to true to run OctoPack" DisplayName="OctoPack : Run OctoPack" ParameterName="Octopus_RunOctoPack" /> <mtbw:ProcessParameterMetadata BrowsableWhen="Always" Category="#500 Octopus" Description="Url where the octopack need to be published" DisplayName="OctoPack : Publish package to http" ParameterName="Octopus_OctoPackPublishPackageToHttp" /> <mtbw:ProcessParameterMetadata BrowsableWhen="Always" Category="#500 Octopus" Description="API Key of the nuget server for the publish" DisplayName="OctoPack : API Key of the nuget server" ParameterName="Octopus_OctoPackPublishApiKey" /> <mtbw:ProcessParameterMetadata BrowsableWhen="Always" Category="#600 TDS" Description="Set this to true if it is a desktop build" DisplayName="TDS : IsDesktopBuild" ParameterName="TDS_IsDesktopBuild" /> <mtbw:ProcessParameterMetadata BrowsableWhen="Always" Category="#600 TDS" Description="Set this to true to generate the packages" DisplayName="TDS : Generate packages" ParameterName="TDS_GeneratePackage" />
- Switch to Visual Studio because it will be easier to edit. Click on the "Run MsBuild" and the in the properties window, replace the "CommandLineArgument" by the following one:
String.Format("/p:SkipInvalidConfigurations=true {0} /p:OctoPackPublishPackageToHttp={1} /p:OctoPackPublishApiKey={2} /p:RunOctoPack={3} /p:IsDesktopBuild={4} /p:GeneratePackage={5}", AdvancedBuildSettings.GetValue(Of String)("MSBuildArguments", String.Empty), [Octopus_OctoPackPublishPackageToHttp], [Octopus_OctoPackPublishApiKey], [Octopus_RunOctoPack], [TDS_IsDesktopBuild], [TDS_GeneratePackage])
If you prefer to do that in notepad, don't forget to escape the characters.
This change will add some extra parameters to the msbuild command. - Check-in this workflow into TFS.
- Edit your build definition again. In the "Process" tab, expand the "Build process template" section and click on "New..."
Next steps:
- Setup a continuous integration for Sitecore with TDS - TFS 2013 and Octopus - Architecture
- Setup a continuous integration for Sitecore with TDS - TFS 2013 and Octopus - Step 1: Customize the TFS workflow
- Setup a continuous integration for Sitecore with TDS - TFS 2013 and Octopus - Step 2: Configure TFS
- Setup a continuous integration for Sitecore with TDS - TFS 2013 and Octopus - Step 3: Configure octopus
- Setup a continuous integration for Sitecore with TDS - TFS 2013 and Octopus - Step 4: Align the version number
great post!
ReplyDeleteI had to change the AdvancedBuildSettings parameter to the default one: MSBuildArguments.
Otherwise I get a compiler error (not accessible) in vs2013.