octopus-deployconfig-transformation

Variable Substitution in .config file with Octopus Deploy 3


I am using Octopus Deploy v3 for my deployment.

Within my project I have defined a variable called data.folder

I am trying to use this variable to set the value in a transformation file that was deployed using a package

I have the following .config file

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" >
  <sitecore>
    <sc.variable name="dataFolder">
      <patch:attribute name="value">/Data</patch:attribute>
    </sc.variable>
  </sitecore>
</configuration>

and the following .ci.config file

<?xml version="1.0"?>
<configuration 
     xmlns:patch="http://www.sitecore.net/xmlconfig/" 
     xmlns:set="http://www.sitecore.net/xmlconfig/set/" 
     xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <sitecore>
    <sc.variable name="dataFolder" xdt:Transform="Replace" xdt:Location="Match(name)" set:value="#{data.folder}" />
  </sitecore>
</configuration>

Both of these files are located in folder App_Config\Include

As you can see I have set the variable in the transformation file to include the variable "{data.folder}"

Within Octopus, I have created a package deployment step, and have set the following features:

Within the Substitute variables in files I have included the target files

App_Config\Include\Z_Project.#{Octopus.Environment.Id}.config

I believe that I have followed http://docs.octopusdeploy.com/display/OD/Substitute+Variables+in+Files correctly, however when the deployment runs. the variable in the .ci.config file is not being set.

I am sure I have made a very basic mistake, but I have no idea what I have done wrong

What do I need to get the transform file to use the variable from Octopus


Solution

  • It sounds like you've got the process correct in terms of the steps, the variables etc, but I don't think the transformation in the .ci.config file is correct after previewing a transformation.

    It ends up like this

    <sitecore>
      <sc.variable name="dataFolder" set:value="#{data.folder}"/>
    </sitecore>
    

    try using

    <sitecore>
      <sc.variable name="dataFolder" xdt:Transform="Replace" xdt:Location="Match(name)">
        <patch:attribute name="value">#{data.folder}</patch:attribute>
      </sc.variable>
    </sitecore>
    

    Running this through Slow Cheetah (Visual Studio Gallery) performs the transformation correctly and provided everything else is setup in Octopus Deploy correctly this should get the value injected before the transformation happens.

    Hope this helps