Thanks for getting in touch! By the title of the ticket, it seems that you want to transform a .csdef file, but then you said the package doesnt have one
I want to change vmsize with respect to environment. Vmsize is configured in ServiceDefinition.csdef file. I want to deploy “Small” cloud service in stage and “Large” in production.
Thanks for the clarification! This link shows how to make variables substitutions on pretty much any kind of file
You can put a variable on your .csdef file and then add the same variable 3 times on your Project Variables, but with different scopes and values. See the attached screenshot for better reference.
This way when Octopus deploys to your Octopus environment Stage, the variable will be substituted by the value Small on your csdef file (and so on for the rest of the environments)
The suggestion you gave, I am doing same thing with ServiceConfiguration (cscfg) file. But here, I do not have any .csdef file in my package. Let me try to explain the deployment flow.
· We use TeamCity to get nuget references and then we build and package inside TeamCity. TeamCity puts resulted artifacts in its nuget feed.
· Octopus deploy picks up from nuget feed, transforms variables in cscfg file with respect to environment and deploys to azure.
Now, when we package it inside TeamCity, the produced artifact does not have any .csdef file where I want to apply this environment based configuration.
I’m sorry but i’m not sure how to set the VM size without a .csdef file. I have very little knowledge these kind of azure configuration, but from what I’ve just googled, your package should have this .csdef file if you want to change the VM size.
I am trying to work through this myself. According to http://docs.octopusdeploy.com/display/OD/Deploying+a+package+to+an+Azure+Cloud+Service Octopus will extract the cspkg file and then run the pre-deploy script. One of the items in the cspkg file is a csdx file. That is another archive file i believe that has the csdef file in it (use 7Zip to see this). I suspect the pre-deploy will need to extract that csdx file, perform the transform on csdef and then repackage the csdx file.
Anyhow, that’s my understanding. As to the actual predeploy script and implementation of above, I am still researching.
Thanks for reaching out. If you set the variable Octopus.Action.Azure.LogExtractedCspkg to true on your project, the layout of the extracted package to be written into the Task Log. Use this to confirm if you are setting up the transformation to the correct paths.