Script not running before acquiring packages

We are running our test servers in AWS and only firing them up when deploying, so our first step has always been to start machines in environment we are deploying to. Used to do this with a script running on a tentacle installed on octopus server, which worked fine. Now I’m trying to do it with a this new step “Run Script on Server”, but it is not working.
The script does not run before acquiring packages. So first step fails since it can’t connect to the server as it is offline. Have tried to check and uncheck the checkbox to run step before acquiring packages, but to no effect. It still does not start on step 1 until acquiring packages is done. Can’t tell for sure if this is only related to the “Run Script on Server”.

Hi!

Thanks for getting in touch. I’m glad you’re trying out the new feature in Octopus 3.3, but I’m sad it’s not working for you. It sounds like you’ve already gone to some effort to figure out what’s going wrong.

I’ve tried to reproduce the behaviour you’re seeing, and I created a new project with two steps:

And I’ve configured the Server Script Step as follows:

And when I run a deployment, I get the result I’m expecting:

Is this how you’ve configured your project? Perhaps you can send me a screenshot of your entire process? Also could you send me the raw log from the deployment so I can see in detail what’s happening?

Hope that helps!
Mike

The main difference I have in my process is that I use script inside a package. Which sort of makes sense why it would run acquiring packages first. Would it be possible to only acquire the package needed by the server step first, before acquiring the other packages? I really like to keep the scripts in source Control and like this New feature of having being able to use scripts in packages.
I can send the full log if still needed. I assume this is related to using script in package though.

Hi!

Thanks for getting back to me. Yes, that does make sense why package acquisition has been executed before the Server Script step. We deliberately do all package acquisition at the same time, and we don’t have any plans to change this behaviour.

At this point my recommendation would be to extract that script out of your package, and put it into the deployment process as an inline script. I know this means you would lose the ability to source control the file as easily, but at least the deployment process would work as you’d expect.

In addition to this, I’ve raised a UserVoice Suggestion on your behalf to see if we can gain support for this kind of concept.

I think it would make sense for us to change the user interface, and remove the option for running a Script Step before package acquisition when the script is contained in a package. I’m really glad you helped us pick up this confusing scenario! I’ve raised this GitHub Issue to track the progress of that work.

Hope that helps!
Mike