Running a Script Module only when the active work directory is the project

We initially started by using a power shell script Deploy.ps1 inside of our application. It worked great, we realized thought that having Deploy scripts in our App didn’t make a lot of sense. It seems Deployment shouldn’t realy live in the App code.

So we are trying to setup Script Modules.

However it seems that during a deploy in the work folder there are folders that our code is on, that don’t have our code in them. Thus creating an error when we try do performa an action in a dir where there are not expected files.

For example why is our code triggered in this dir:

C:\Octopus\Work\20150911233447-246
16:35:10Info
Directory: C:\Octopus\Work\20150911233447-246
16:35:11Info
Mode LastWriteTime Length Name
16:35:11Info


16:35:11Info
-a— 9/11/2015 11:35 PM 2549 azure_certificate.pfx
16:35:11Info
-a— 9/11/2015 11:34 PM 431 Bootstrap.ps1
16:35:11Info
-a— 9/11/2015 11:35 PM 1725 Octopus.AzureContext.ps1
16:35:11Info
-a— 9/11/2015 11:34 PM 20 Script.ps1
16:35:11Info
-a— 9/11/2015 11:35 PM 17484 Variables.json

How do we only trigger code when Octopus is actually in the Pre / Deploy / Post phases. Just like if we were to create PreDeploy.ps1, Deploy.ps1 etc.

Hi,

Thanks for reaching out. Please check this doc on how to do this: http://docs.octopusdeploy.com/display/OD/Custom+scripts#Customscripts-Scriptsinpackagesteps

Hope that helps!

Dalmiro

Hi Dalmiro,

Thanks!

I was looking for the “Pre-deployment” “Deployment” “Post-deployment” text areas inside of the stand alone script step. I now see that if I Configure features & enable scripts in the deploy Nuget package step, i can set my code inside the “Deployment” phase.

Thank you,

Mark
Thank you!