Manual Intervention from PowerShell script

Hi,

Is it possible to request a manual intervention from within a PowerShell script?

For example:
We have two type of SQL scripts
Type 1 - the ones which do not require manual validation
Type 2 - the ones which require user to perform some manual actions

Typical deployment would iterate though all SQL scripts in sequence
e.g.
Script 01 (Type 1)
Script 02 (Type 1)
Script 03 (Type 2)
Wait for manual intervention
Script 04 (Type 1)
Script 05 (Type 2)
Wait for manual intervention
Script 06 (Type 1)
etc.

Number of SQL scripts for each release is variable.

We can easily define a loop in PowerShell to iterate through all scripts but is it possible to ask user for manual intervention several times for the same step?

Thanks,
Mau.

Hi,
We do not support manual intervention from within scripts since that would add many layers of complexity to the whole communication, execution and orchestration layers.
The only way I could imagine that you can get this to work is by creating multiple script steps for each script you are trying to run, and then have a manual intervention step where necessary. Or perhaps run all variable number of Type1 scripts in the first step, and then have a Manual intervention followed by all Type2 scripts in the second step.
Unfortunately we do not support variable number of manual intervention steps since these needs to be defined on the project level and not from within other steps themselves.
Sorry about the bad news, but I hope you can still find a way to get as close to your requirements as possible.
Cheers,
Robert

Rob,

Thanks a lot for your detailed response.

We can workaround it by failing the step e.g. throwing an exception and make the deployment script clever enough to understand which scripts have been already executed e.g. keeping the log on the database side.
Once the manual intervention is completed user will re-try execution of the step and this time it will carry on from the first script which haven’t been executed yet.

Thanks,
Mau.

Maurycy Widera
Senior Business Analyst

T: +44 131 247 7483

116040810084805223.jpg

116091409092102431.jpg

116040810084806423.jpg

116091409092102631.jpg

116091409092102231.jpg

116091409092101931.jpg

Rob,

When Guided failure mode is used as per http://docs.octopusdeploy.com/display/OD/Guided+failures
Is it possible to get access of user entered notes from the PowerShell script?

e.g. similar to output variables of Manual Intervention

Thanks,
Mau.

From: Maurycy Widera
Sent: 08 April 2016 10:09
To: ‘Rob Erez’ tender2+d4828201bb@tenderapp.com
Subject: RE: Manual Intervention from PowerShell script [Questions #7718]

Rob,

Thanks a lot for your detailed response.

We can workaround it by failing the step e.g. throwing an exception and make the deployment script clever enough to understand which scripts have been already executed e.g. keeping the log on the database side.
Once the manual intervention is completed user will re-try execution of the step and this time it will carry on from the first script which haven’t been executed yet.

Thanks,
Mau.

Maurycy Widera
Senior Business Analyst

T: +44 131 247 7483

116040810084805223.jpg

116091409092102431.jpg

116040810084806423.jpg

116091409092102631.jpg

116091409092102231.jpg

116091409092101931.jpg

Hi Maurycy,
Unfortunately the details from the guided failure are not currently passed back into the deployment and are only stored in the logs. If this is a feature you would really like to see included in Octopus Deploy you can create a request in UserVoice so that we can get the whole community’s feedback. If enough people vote on your feature request we may add it in a future version!
What scenario are you trying to support that requires the use of dynamic scripts along with non-deterministic inclusion of manual intervention?
I’m sorry that there doesn’t yet seem to be a simple solution for what you are trying to acheive. Hopefully we can talk through your requirements and come up with a solution that helps meet its aims.
Cheers,
Robert

Why not just add a variable in powershell inside your loop that you have already created that prompts the user for input and based on that input, the whole script will run again?? example…

$runScriptsAgain = read-host -prompt “$($ThisVariable) is missing, run again?”(yes/no):
#user manually enters variables needed in sql before they click yes
if(runScriptsAgain -eq “yes”)
{
#add steps to begin scripts over again
}

Your question isn’t very revealing as to where exactly you need an intervention or what variables you expect to be missing, so if you would like more specifics on what you should do as steps in Powershell, then please share more specific information about what problem you are trying to solve.

We have restructured the way we work and we no longer require such functionality in Octopus.