Deploy serverless project through Octopus (means extract package and run command line script)

Hi all! I have a quick question that I ve been trying to sort out all day.

We are looking to run a deployment from octopus. What’s happening is that we create a package and add it to Octopus. Then we want to extract it somewhere locally and run serverless deploy on that folder. which should do the trick. The thing is though that there is no tentacle involved. This just runs a cloud deployment. Is there any way to extract a package into a directory and run a script inside that directory? It seems that the run script template doesn’t support packages and, unless I specify to run it on the tentacle, the package reference feature doesn’t help?

Any way we could do that?

Hi @Yannis,

Thanks for reaching out.

Just to be sure we’re on the same page, you want to run a script inside of a package within an Octopus step, but you don’t want it to be done on a Tentacle. Please let me know if I got that wrong.

If so, I think the best way to handle this is to run a script step with the following settings:

If you select to run on a worker from a worker pool, and select the default worker pool, it will run on the built-in worker on the server itself.

You can then upload your package with your script to the built-in feed, and tell the step that the script is contained in a package. Then select the package ID, and tell it the name of the script to run within that package.

Please let me know if that will work for your use case.


Hi Jeremy.

Thanks for getting back to me. This would work but the script I want to run is not inside the package itself. Hence I need to do it inline (but don’t know how to bring the package contents in scope).

Let me know if that makes sense?

Hi @Yannis,

When an Octopus worker does a step, it has a working directory it works in. For example I’ve taken a Run A Script step and dont Get-Location.

This shows that my current directory is


With variable logging enabled, I can take a look at where the package is being extracted.

09:45:33   Info     |       Extracting package 'C:\Octopus\Packages\Spaces-1\feeds-builtin\ScriptToRun\' to 'C:\Octopus\Work\20201019134532-4842-27\ScriptToRun'

09:45:33   Verbose  |       Performing variable substitution on 'C:\Octopus\Work\20201019134532-4842-27\Script.ps1'

So you can see from the above, an associated package gets extracted to \PackageName from where the script is currently operating.

If I then do cd ScriptToRun (you could dynamically do this by using system variables instead of hardcoding it) at the beginning of my script, then do Get-Location, I now am in C:\Octopus\Work\20201019135048-4843-28\ScriptToRun

I should be able to then run anything I’d like in my script step and it will do the work from that folder.

If we put it all together,

My Step settings:


The package ScriptToRun only has a ps1 file in it that creates a text file called newitem.txt.

Please let me know if that would work for you or if I’ve misunderstood the question again.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.