XML Transformation

I want to do xml transformation. I have the following database.settigns.xml file. When the package deployed, I want the values to be replaced with the actual values from variables defined in Octopus.

<?xml version="1.0" encoding="utf-8"?>

As this xml file is used by the code, I’ve to create another database.settings.Release.xml file that contains octopus variable names like

<?xml version="1.0" encoding="utf-8"?>

I used Substitution variable for database.settings.Release.xml which is working fine. However, when I try to do transform database.settings.Release=>database.settings.xml, the transform does not occur. did I miss something here?

I dont know why the xml file is not properly rendered when I put on the ticket. Here is the image

Hi @endashaw.adane,

Thanks for reaching out.

Would you please let me know which version of Octopus you’re running?
Would you also be able to add a screenshot of how you have the variable substitution set up within your Octopus step so I can take a look at that?
Can you also attach a screenshot of the variables on your variables page?(you can censor the values, I would just like to see the names and scopings.)

If you prefer to privately message the screenshots for security reasons that works fine for me.

Finally, I just want to confirm, nothing is being substituted correct? The octopus variables are just there in the file untouched after deployment? What does the task log state about substitutions on that file?

Please let me know.

Best,
Jeremy

we are running 2019.13.7 version
substitution is fine. but transformation is not



In the task log, I can see the following…but actual transformation has not happened

Hi @endashaw.adane,

Thanks for all the information.

I believe the reason the Configure XML transform is not working is because you need to format the file that will be doing the transforming to have the xdt syntax.

For example here:

In our example here, the transform file will match on the key and then substitute the value in the base file.

Please let me know if I explained that okay.

Best,
Jeremy

@jeremy.miller
Thanks for your prompt response! I noticed xdt syntax. should I need to put appSettings tag too? this is not web config file.

Hi @endashaw.adane,

You’re very welcome!

That’s just an example. I believe it should work in your case as long as you add the proper xdt syntax on the lines where you want transformation.

Please let me know how it goes.

Best,
Jeremy

@jeremy.miller

Thanks that’s working fine. I’ve one entry in the config file like below…I want to replace the url per each envt during deployment

entry name

I put the following in the transformation file, but does not work…used also Replace attribute…same.
any idea?
#{docclient_url}

hi @endashaw.adane,

Within your database.settings.Release.xml file, you have placed #{docclient_url} and its not being substituted? Do you have that variable with various environment scoping values in your project?

Please let me know.

Thanks,
Jeremy

This was solved via Private messages.

For anyone who finds this thread looking for the answer, the resolution syntax was

<entry name="http.url" xdt:Transform="Replace" xdt:Locator="Match(name)">#{docclient_url}</entry>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.