0

I've got a build process using a cake script that is executed from TeamCity. In my build script, I build a web api, a db (dacpac) project, and also a WPF app. One of the tasks in the script is to create a Squirrel.Windows release package for the WPF client app.

Once that build artifact (squirrel release nuget pkg) is created, TeamCity will kick off an Octopus deploy release, and hand that off to be deployed. I rely on Octopus to keep my configuration variables (appSettings, db conn strings, etc.) per tenant/environment.

The client app has an app.config with a db connection string, which should be transformed by Octopus Deploy so it gets the correct values for the environment/tenant.

Once OD deploys the squirrel pkg, it doesn't do config transforms, which means the app.config file has incorrect values for DB conn, among others. Is there anyway to make this happen?

Thiago Silva
  • 14,183
  • 3
  • 36
  • 46
  • What Octopus Process are you using for to deploy? Have you thought of doing it in a pre-deploy script before deploying? If that is not what you're looking for, it is more of triggering a transform on the teamcity side before creating the package with Octopus deploy. – t0mm13b May 13 '17 at 13:36
  • OD is only pushing the nuget package out. The package is built from TeamCity by executing our cake build script which creates the squirrel release. We cannot trigger transforms from TeamCity because the values of the dbconn string per environment/tenant are kept in Octopus, not Team City. – Thiago Silva May 14 '17 at 03:19
  • Include in the source, pre/post deployment scripts, which would be bundled into a nupkg, when Octopus Deploy (from the teamcity side) pushes that nupkg across, the pre-post deployment scripts are run automatically [Octopus Deploy Script Reference](https://octopus.com/docs/deploying-applications/custom-scripts/standalone-scripts) You will have to use Powershell within to apply the transforms by passing in the Octopus environment variablesets based on per environment/tenant. – t0mm13b May 14 '17 at 21:21

1 Answers1

0

New Answer

  1. Use an Octopus step to deploy the first package
  2. Use a second "Deploy Package" step to deploy the inner package
  3. Run the transformations on the second package
  4. Use NuGet pack to package the final result

This can be all be done within Octopus Deploy, but my recommendation is build a Posh script, or use a Chocolatey extension (I can point you to what I'm doing) to do do your transformation and packaging.

Ben Richards
  • 3,437
  • 1
  • 14
  • 18
  • I understand that, and I use this feature for my web api project deployment, however, for Squirrel.Windows, it creates a nuget package which contains another nuget package with the actual app. So, enabling the "replace appSettings" option doesn't really do anything since when OD deploys the Squirrel release package, there are no app/web config files immediately in the output - rather, the output contains another nuget pkg with the wpf app. – Thiago Silva May 16 '17 at 20:56
  • A NuGet _within_ a NuGet..? @ThiagoSilva - that sounds wonky. – gvee May 19 '17 at 15:20
  • @gvee I agree that all this sounds wonky. But I can't seem to find a better solution, short of moving the creation of the squirrel release out of my cake build (run by TeamCity) and into a posh script executed in Octopus. But that creates some other issues for us as well. Not ideal. – Thiago Silva May 22 '17 at 22:48