Release Dual Control (Output Parameter Problem)

The built in Manual intervention step is great, but we are a small team so having people in fixed “deployment” or “sign off” roles will not always be practical. What I’d like to achieve is a dual-control / dual sign-off procvedure where 2 different people have to be involved in the deployment procedure.

The manual intervention doesn’t support this (though perhaps that would be a good feature to add in future).

My idea is simply to include a script step after the manual intervention which throws an error if the user who started the release is the same as the user who performed the manual interventions step. Alternatively, I could use 2 or more manual intervention steps and compare the users for each for more complex senarios.

In any case, I’ve been doing this as below as a first test:

$createdBy = $OctopusParameters[“Octopus.Deployment.CreatedBy.Username”]
$signoffBy = $OctopusParameters[“Octopus.Action[SignOff].Output.ResponsibleUser.Username”]

Write-Host "Release started by: $createdBy"
Write-Host “Release signed off by: $signoffBy”

But no matter what I do, the $signoffBy variable is always null. If I try in C# I get a “Key not Found” exception, in powershell it just writes an empty string to the output.

I’m sure the step name is correct and I’ve tried all the different options I can think of. Can anyone tell me either:

  1. Is there a better / existing way to achieve this
  2. What I’m doing wrong in my script above?

Kind regards,

Alexander

Additional info:

Version: Octopus 3.5.1
Full Log:

   Task ID:        ServerTasks-399
Task status:    Success
Task queued:    25 November 2016 13:11
Task started:   25 November 2016 13:11
Task duration:  19 seconds
Server version: 3.5.1+Branch.master.Sha.4feefbec21f18bc1b1908b5721dd03570fec86a6

                    | == Success: Deploy Test release 0.0.11 to Integration ==
13:11:09   Verbose  |   Guided failure is not enabled for this task
13:11:25   Info     |   Deploy Test release 0.0.11 to Integration
13:11:25   Verbose  |   Guided failure is not enabled for this task
13:11:28   Info     |   The deployment completed successfully.
                    | 
                    |   == Success: Step 1: SignOff ==
13:11:25   Verbose  |     Resuming after completion
13:11:25   Info     |     Submitted by: Alexander Harris
13:11:25   Verbose  |     SignOff completed
                    |   
                    |     Success: Octopus Server
13:11:09   Verbose  |       Octopus Server version: 3.5.1+Branch.master.Sha.4feefbec21f18bc1b1908b5721dd03570fec86a6
13:11:09   Info     |       Pausing the deployment while manual intervention is requested
                    |     
                    |   == Success: Step 2: Dual Control ==
13:11:28   Verbose  |     Dual Control completed
                    |   
                    |     Success: MyIntegrationServer
13:11:25   Verbose  |       Octopus Server version: 3.5.1+Branch.master.Sha.4feefbec21f18bc1b1908b5721dd03570fec86a6
13:11:26   Info     |       Unpacking Calamari version 3.5.3 to 'D:\Octopus\Calamari\Local\3.5.3'
13:11:26   Verbose  |       Cleaning up old versions of Calamari...
13:11:27   Verbose  |       Keeping only latest Calamari version 3.5.3...
13:11:27   Verbose  |       Octopus Deploy: Calamari version 0.0.0
13:11:28   Info     |       WARNING: The names of some imported commands from the module 'RationalTeamCity'
13:11:28   Info     |       include unapproved verbs that might make them less discoverable. To find the
13:11:28   Info     |       commands with unapproved verbs, run the Import-Module command again with the
13:11:28   Info     |       Verbose parameter. For a list of approved verbs, type Get-Verb.
13:11:28   Verbose  |       Name                           Value
13:11:28   Verbose  |       ----                           -----
13:11:28   Verbose  |       PSVersion                      3.0
13:11:28   Verbose  |       WSManStackVersion              3.0
13:11:28   Verbose  |       SerializationVersion           1.1.0.1
13:11:28   Verbose  |       CLRVersion                     4.0.30319.42000
13:11:28   Verbose  |       BuildVersion                   6.2.9200.16398
13:11:28   Verbose  |       PSCompatibleVersions           {1.0, 2.0, 3.0}
13:11:28   Verbose  |       PSRemotingProtocolVersion      2.2
13:11:28   Info     |       Release started by: alexanderh
13:11:28   Info     |       Release signed off by:
                |

So having dug around some more, I see the correct variable name is:

Octopus.Action[StepName].Output.Manual.ResponsibleUser.Username

NB the “Manual” in the title.

I based my initial code on: http://docs.octopusdeploy.com/display/OD/System+variables where the variable name doesn’t include the “Manual” part. Updated info I found here http://docs.octopusdeploy.com/display/OD/Output+variables

I don’t quite understand why there is this difference or if I just missed the subtleties of use.

Hi Alexander,

I was just starting to look into this when I saw your reply. I’ve confirmed that the documentation is incorrect and that the Manual part should be included. I’ve updated it now.

Thank you for letting us know!

Robert W

Hi Robert,

No worries, glad to have found the solution and thanks for looking into it.

Alexander