Preview config changes

Hi team,

Hope everyone is doing great :blush:

At my team we are finding ourselves in a situation where too many hands are touching variables, and when the time to deploy to production comes, we find either odd or simply badly scoped values in our config files.

We are going to tackle this from a couple of fronts, and there’s one of them I’d like some input into: We want to pre-deploy the already transformed config files and then compare them with its currently deployed version. So the process would look like this:

  1. Pull packages
  2. Apply transform/variable replacement to config file in a safe directory without pointing IIS to it yet.
  3. Use Powershell compare-object to compare the new file and the current one
  4. trigger a manual intervention so a human can review the changes
  5. If everything looks ok, proceed.

Do you have any recomendations on what’s the best way to do this? I do have ideas, your support hivemind always has better ones :wink:

Cheers!
Dalmiro

Its worth mentioning that the only type of scopes we use are Roles, Environments and Tenants. So nothing related to Steps which could complicate implementing this solution.

Hey there Dalmiro! One way this can be accomplished is to use a Deploy a Package Step, which has all the transform functionality the Deploy to IIS step has. Once this step has been completed, have a Run a Script step that uses the PowerShell that you mentioned to compare the two files. To get access to where the transformed files are, use $DeployedPath = $OctopusParameters["Octopus.Action[DeployPackageStepName].Output.Package.InstallationDirectoryPath"] then Get-WebVirtualDirectory (WebAdministration) | Microsoft Docs to get the current path for IIS.

The Run a Script step can produce an Output Variable containing the results from the comparison as the Instructions for the Manual Intervention step so the user can stay within Octopus

Hope this helps!

Regards,

Shawn

1 Like

Thanks for the input, Shawn! That was pretty much what I had in mind, except for that nice Output variable trick which I’m definitely going to use.

Cheers buddy

Excellent :slight_smile: Pleaes let me know if I can help further (you helped me so many times in the past, gotta pay you back, lol)