Previewing transforms and substitution

nshenoy's Avatar

nshenoy

05 Apr, 2016 04:18 PM

We have teams in the process of moving lots of apps to Octopus and making a few mistakes as part of this process. Is there a way to hook into the substitution engine and somehow "preview" a configuration transformation with variable substitution? It would be extremely helpful to say preview what the end result web.config will look like for a Production deployment before actually deploying to production (because someone will screw it up). :)

  1. Support Staff 1 Posted by Dalmiro Grañas on 05 Apr, 2016 07:52 PM

    Dalmiro Grañas's Avatar

    Hi,

    Thanks for reaching out. This isn't possible at the moment but there's a uservoice sugestion for this: https://octopusdeploy.uservoice.com/forums/170787-general/suggestio... . Please drop by if you'd like to see it implemented and add some votes. A few of us in the team have already expressed that we like it, but we need the community to root for it before we put it in our (already busy) queue.

    Thanks,
    Dalmiro

  2. 2 Posted by nshenoy on 06 Apr, 2016 02:20 AM

    nshenoy's Avatar

    From looking at the Calamari code on GitHub, it seems like we should be able to make a call to Calamari.Integration.Substitutions.FileSubstitutor.PerformSubstitution() with the transformed file. But where does the VariableDictionary ultimately come from? I see that it may originate from DeployPackageCommand(), but I don't see how it's actually instantiated and initialized with the values from the database. If there's any info you can give me there, perhaps we can hack something in as a stop gap for my team.

  3. Support Staff 3 Posted by Vanessa Love on 07 Apr, 2016 09:24 AM

    Vanessa Love's Avatar

    Hi,

    I'm taking this over as Dalmiro is headed of on some leave. While Calamari does these calls OD server itself orchestrates the transformation and applies the variables.
    That is where they come from.

    I had an idea - when we provide the files for a package drop, we also provide the variables in a JSON format that can be used by variable substitution, you could use that to come up with something. Or you could create your own variables list. Have a go at adding a drop target to that environment, and look at the scripts. It might get you started.

    Vanessa

  4. 4 Posted by nshenoy on 07 Apr, 2016 11:37 AM

    nshenoy's Avatar

    Very interesting. If all of the "final" variable values are provided in the
    JSON, then it may be something I can work with. Let me look into that.
    Thanks!

  5. 5 Posted by nshenoy on 10 Jun, 2016 03:15 AM

    nshenoy's Avatar

    I created a little powershell script that will take in a variable JSON file from a drop target, a web.config, and a web.foo.config transform file and spit out a transformed file with the final substitutions. Here's a link to the GitHub Gist: https://gist.github.com/nshenoy/79ac16c84edcc65485dff263d1e2781f . This is just an initial stab at it, but seems to work ok for what we need. Hopefully someone may find this helpful.

  6. Support Staff 6 Posted by Vanessa Love on 10 Jun, 2016 03:54 AM

    Vanessa Love's Avatar

    Hi,

    That is really great! Thanks for sharing! I've shown the team :)

    Vanessa

  7. 7 Posted by nshenoy on 10 Jun, 2016 08:04 PM

    nshenoy's Avatar

    I blogged a walkthrough for how to use this: https://repne.wordpress.com/2016/06/10/previewing-octopus-web-confi... . Feedback welcome.

  8. Support Staff 8 Posted by Vanessa Love on 13 Jun, 2016 09:27 AM

    Vanessa Love's Avatar

    Hi Nithin,

    The blog post is great, no other feedback :)

    Vanessa

  9. Paul Stovell closed this discussion on 04 Jan, 2017 07:40 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac