Dry test Step Template Slack - Notify Deployment with parameter of type checkbox left unchecked fails

Hi there,

We’ve been using the Community Library Step Template Slack - Notify Deployment for a while now.
The template has a checkbox for including the machine name. We left it unchecked.
All works like a charm!

However, when dry testing the template by going to Library, Step Templates, selecting the template, press Run, fill in the same values that are used in our process step and leaving the Include machine name checkbox unchecked, the script fails.

What the script does on line 23 is $IncludeMachineName = [boolean]::Parse($OctopusParameters['IncludeMachineName']);

The script fails with the following error:

Exception calling "Parse" with "1" argument(s): "String was not recognized as a
January 20th 2017 21:12:44Error
 valid Boolean."
January 20th 2017 21:12:44Error
At C:\Octopus\Work\20170120201242-158\Script.ps1:23 char:1
January 20th 2017 21:12:44Error
+ $IncludeMachineName = [boolean]::Parse($OctopusParameters['IncludeMachineName
January 20th 2017 21:12:44Error
']) ...
January 20th 2017 21:12:44Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
January 20th 2017 21:12:44Error
~~~
January 20th 2017 21:12:44Error
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE 
January 20th 2017 21:12:44Error
   xception
January 20th 2017 21:12:44Error
    + FullyQualifiedErrorId : FormatException
January 20th 2017 21:12:44Error
January 20th 2017 21:12:44Info
Exit code: 1
January 20th 2017 21:12:44Fatal
The remote script failed with exit code 1

Since the same settings work during deployment, I think it’s not an issue with the template itself.

Kind regards,

Emiel

Hi Emiel,

I’m sorry to hear you are having this issue!

I’ve done some investigations and it looks like there’s 2 bugs at play here. The first bug is that we don’t populate the default values of the step template when you run it through the test run feature and this leads to bug #2 which is that checkbox parameters can have 3 states (undetermined, true and false), if a checkbox hasn’t been assigned a value (either through a default value, or a user checking and then un-checking again) it has a value that is not defined and this is why when the script tries to parse it as a boolean it fails as it’s getting passed a null value.

I’ve raised the following GitHub issues for bug #1 and bug #2 to have this issue fixed as soon as possible.

My apologies for the inconvenience caused by this.

Thank you and best regards,
Henrik

Hi Henrik,

I’m not sure this is related to the bugs you just mentioned, but I just clicked Modify and re-run after ‘test running’ a certain Step Template and all fields are empty again. I need to re-enter all the parameter values.

I’m not entirely sure but I believe that a few versions earlier (we’re on Octopus Deploy 3.8.5 now) this worked. You could just modify one or more values and run it again.

I tried it on both a Community Template as well as a local copy of one. Same results.

Kind regards,

Emiel

Hi Emiel,

I’d hazard a guess here that this bug is caused by the same underlying reason, so I’ll update the GitHub issue to mention this and fix it at the same time.

Thank you and warm regards,
Henrik