I am having trouble using project variables in configuration transforms. I have the following setup:
One environment “Demo”
Multiple targets within the environment : Demo1, Demo2, Demo3 etc.
There is a project variable “EnvironmentName” scoped to each target above.
Each target has its own app.config, connection.config etc., so there are app.Demo1.config, app.Demo2.config etc. I would like to transform these based on what target they are being deployed to.
I used the following “Additional transform”
*.#{EnvironmentName}.config => *.config
but it does not seem to be working. Is this configuration even supported?
Thanks for reaching out! That configuration is supported, but It’ll all come down to what the values of your variables are at the moment of the deployment. We can give you a hand with this if you help us with this info:
A screenshot of your variables screen where I can see all the values assigned to #{EnvironmentName}
A screenshot of your package contents where I can see the names of all the .config files. You can use this tool for this: https://npe.codeplex.com/
Finally, follow the below steps to provide afull deployment log
1) Add these 2 variables to your project http://docs.octopusdeploy.com/display/OD/Debug+problems+with+Octopus+variables
2) Create a new release (so the new variables take effect) and deploy it. If possible skip as many steps as you can and only leave step we are troubleshooting in order to avoid the noise in the log.
3) Send us the raw log of that deployment http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task
The transformations seem to be working.They go from lines 405 to 836 and on each transformation Octopus tells you which files were used. Can you double check that the correct file was used for the transformations on each time, and hopefully spot the ones you think are not working properly?
The lines that show each transformation look like this
16:12:59 Info | Transforming 'C:\Octopus\Applications\ACA_DEMO1\DEMO\ACATS\2016.11.2.205-demo-1\ACATSDeploy\Valuation\log4net.config' using 'C:\Octopus\Applications\ACA_DEMO1\DEMO\ACATS\2016.11.2.205-demo-1\ACATSDeploy\Valuation\log4net.Demo1.config'.
I’m gonna need to see the package’s contents to see what’s going on here. Can you please upload a copy of it to this private folder: https://file.ac/iE2tYXRnt3Q/
Feel free to remove any other file that’s not involved in the config transform process. Just make sure to leave the configs in the correct subfolders.
I just uploaded the entire package to the portal. Please keep in mind some of these configurations contain confidential information, so please be sure it’s handled privately and properly discarded after the investigation is closed.
The configurations in question is in this folder 2016.11.2.200-demo-1_5\ACATSDeploy\Analytics. Specifically the connection.config.
$file = ".\2016.11.2.200-demo-1_5\ACATSDeploy\Analytics\connections.config"
write-output "The content of $file post transforms is:"
get-content $file -verbose
make sure the path for $file is correct. I’m trying to aim to the transformed file
Thank you for your email. I am currently out of the office, returning November 28, 2016. Should your request need immediate handling, please reach out to Johan Glozman (jglozman@acats.commailto:jglozman@acanpf.com).
This is really strange but just adding the custom script section to the process fixed the issue. Even if I leave the sections blank, it still works. I will do a bit more testing here and revert back to you.