This question is similar to an earlier posted question (http://help.octopusdeploy.com/discussions/questions/1360-azure-deployments-and-transform-on-csdef-file-vmsize-different-in-each-env).
In that reply, I saw suggestion to use PreDeploy script.
We actually use TeamCity as a build server and hand over nupkg to Octopus that does not contain csdef file. It has cspkg in it. I have attached the snapshot of artifact generated in teamcity.
Any suggestion, how should I use different vmsize for different environments (Test, Stage and Production)
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
Exactly which file are you looking to transform?
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.
Sent from my iPhone
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)
Hope that helps!
Thanks for your reply.
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.
Do you have any suggestion for this scenario?
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.
Sorry i cant be of more help
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
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.
See http://help.octopusdeploy.com/discussions/questions/5529-octopus-31-beta-update-cloud-service-definition-file for a starting point and my update. Got it working where everything transforms properly including the csdef file.
Sounds great. I will surely test this solution in couple of days
Sent from my iPhone