I’m wondering what is considered best practice for environment specific config tranforms in Octopus. I’m currently going down the path of using variables that are scoped to environments, but finding two issues here:
The number of variables across multiple environments is pretty big
For things outside of AppSettings & ConnectionStrings, I need custom step template or a custom script, which I have in place
I feel that the route of File Config Transform would make maintenance easier, though wanted to get your thoughts on what you’ve seen work best for majority cases. I also saw this hybrid approach that is appealing:
We use a combination of both. Our projects define a single configuration transform file (we name it Octopus.config) that performs all of our config transforms using Octopus variables. We then set each package deployment to “Substitute Variables in Files” on Octopus.config, then we apply a custom transformation of “Octopus.Config => Web.config” (or the .exe.config as the case may be). We also turn off the other options to substitute appSettings and values in config files since we’ve accounted for all of that explicitly within Octopus.config.
It doesn’t help a lot with the number of variables; for even a moderate number of environments, a handful of variables doesn’t take long to become a big list when you multiply it by the number of environments.
One other followup question… outside of the out-of-the-box config transform feature, do you have any feature that replaces an entire config file with another file in my project/solution? For example, if I have a file called “web.QA.config” (a copy of my main web.config), can I swap that file in at deploy time using Octopus?
Thanks for reaching out! I completely agree with Adam’s approach of first replacing variables in the transform file, and then using it to transform the web.config.
outside of the out-of-the-box config transform feature, do you have any feature that replaces an entire config file with another file in my project/solution? For example, if I have a file called “web.QA.config” (a copy of my main web.config), can I swap that file in at deploy time using Octopus?