Variable substitution when only running a powershell deployment

We create a zip file package of (if this case a windows service) that has a few files, one of them being app.config.

to deploy it we need to push the file to an API endpiont, (the api receives the name and version and the zip as a stream). The only way I can see how to do that in octopus is via a regular powershell script. The issue with that is I do not see how I can transform the app.config inside the zip file as powershell run option doesn’t allow for configuration extras.

  1. is there a better way of pushing the zip file to the API than using a powershell script?
  2. how would I go about doing the config transform before the zip is pushed?

Regards

Can I add a third question to that:

  1. how do I find the path to the package on the deployment server so that I can use it in the powershell api httpput call?

Hi Jon,

You are correct; You will have to execute custom PowerShell to push the package to the HTTP endpoint.

I would suggest using a Deploy a Package step.
This will allow you to use the built-in features for transforming your app.config.

The only catch is that this will extract the package (and to transform app.config you would have to, whichever approach you took).
So then your custom PowerShell script would need to re-zip and push the package. Your script could either be included in the package, or configured in the Octopus Step UI.

The get the location of the extracted package in your script, you can use the Octopus.Action.Package.InstallationDirectoryPath variable.

I hope that helps. If you have any follow-up questions, don’t hesitate.

Regards,
Michael