Transform is not working

ruf-u
(Shane Walford) #1

Hi

I am trying to use a transform to modify an application insights config file, but cannot get it working.

Can i specify a path of the config file to modify like the example below? i am deploying the applicationinsights.octopus.config file as a separate package to the app.

ApplicationInsights.octopus.config => I:\App01\ApplicationInsights.config

Thanks
Shane

(Shannon Lewis) #3

Hi Shane,

Thanks for reaching out. The transformations don’t support absolute paths, at least not on the right hand side. The right hand side is only file name of the config the transform is to be applied to. There are docs here, just in case you haven’t seen them yet.

There are other potential traps in this too. I assume you’re deploying an Azure Web App or Function? Do you then have multiple steps? If you are, this will work while you only have a single worker (there’s a built in one by default that Azure steps run on), but as soon as there a multiple there is no assurance they will run on the same worker. There is also no assurance that the worker won’t clean up files between steps. So assuming the paths will always be relative across these steps is brittle.

Is there data in the config file that you need separated for security purposes or something like that? Just trying to understand what’s driving the need for the separate packages.

Regards
Shannon

(Shane Walford) #4

Hi Shannon
Thanks for the response.
I will provide a bit more of a background so you can understand better what i am trying to do. I am actually trying to configure ApplicationInsights.config with a transform by injecting the Instrumentation Key into the config file.
Application Insights is configured to monitor IIS applications. And the site i was trying to apply the transform to is already deployed, i created another step, which had the ApplicationInsights.octopus.config packaged and this is deployed to the server. We were then trying to use the transform as i mentioned above to apply it to the applicationinsights.config files. I assume this is not going to work?

Next were going to try deploying the site again with the tranform, would the ApplicationInsights.octopus.config file have to be include in the site package that is deployed and then apply the transform during the IIS site deployment rather than an additional step as i have tried already?

Thanks
Shane

(Shannon Lewis) #5

Hi Shane,

Yeah, if the site is already deployed then applying the transform will be problematic. If I remember correctly, we apply the transforms where we unpack the package for the current step. So applying across to another folder isn’t going to work.

Including it in the site package and applying the transform during its deployment (not as a separate step) is your best option.

Regards
Shannon