I am looking at various ways to assign port numbers to an IIS deployment. I know I can do this with a step prior to the deployment step, but I’m wondering if there is a way to set output variables in PreDeploy to be used by the deployment. I haven’t been able to get it to work, but I’m not sure if it’s an issue with what I’m doing, or if it’s not possible. Can you update the variables used by a deployment step within the PreDeploy script?
I want to run code in PreDeploy that picks an open port for an IIS WebSite. From my understanding, I wouldn’t be able to use the port from the code in the IIS setup (via the Octopus Step configured in the UI). Is that correct?
I know I can have a separate step to find an open port, but I’m trying to keep everything in a single package.
I can’t see why you couldn’t set a value for a variable in the predeploy that the IIS feature is set to use later in the step. Have you tried this? Do you need some pointers? (I wanted to confirm this myself but have run out of daylight hours)
I haven’t tried it. I found a couple of posts[1] talking about how to do it (I can only find one at the moment). They both had the port assignment being done in an explicit script step prior to the deployment step, so I assumed that was required. If I can update a value in the PreDeploy script, that makes life so much simpler!
From that other post, the only thing Octopus cannot do is pick the port, but if you do that in PreDeploy the rest can be done. Binding the variable for the port and then using it later.
Let me know if it behaves unexpectedly.