Script / Run a Script template: inline sourced script incorrectly uses script package parameters

The “Run a Script” template offers two options for Script Source:

I first selected the second option, “Script file inside a package”, referenced a PowerShell script, and added a few script parameters:

Later, I changed my mind and changed the script source to “Inline Source Code”. Note that there are no parameters here, just the PowerShell script body.

When I ran the deployment, the script failed with “ObjectNotFound: the term -myParameter is not recognized…”. It seems like Octopus passed the script parameters which I specified earlier in the “Script file inside a package” selection to the inline script, which is unexpected.

Temporarily switching back to “Script file inside a package”, removing the parameters, and switching back to “Inline source code” again fixed the problem.

Hi @mhorstmann,

Thanks for reaching out to Octopus Deploy.

I appreciate you bringing this to our attention. I’m going to reproduce this in a test instance and bring this up with our engineers for expected behavior.

I will let you know once I have more information.

Regards,
Garrett

Hi @mhorstmann,

I just wanted to give you a quick update.

It looks like you’re running into this bug here: Step template retains script parameters if entered and then the Script Source is changed · Issue #6695 · OctopusDeploy/Issues · GitHub

Could you please let me know if that looks like the same thing you’re experiencing?
I am also curious if you’re on cloud or a local Octopus Server instance? Could I know which version if local?

Looking forward to hearing back and please let me know if you have any additional questions.

Regards,
Garrett

Thanks for the quick update! Yes, that’s the bug. Any ETA for a fix?

We’re using Octopus Cloud.

Hi @mhorstmann

I’m not sure about the status of this at the moment, so I’m reaching out internally to our engineers to see if I can get an update. I will let you know what I’m able to find.

As always, we appreciate you reaching out.

Regards,
Garrett

Hi @mhorstmann,

Just wanted to give you a quick update. I’ve verified this has been bumped and is on the radar. You should be able to follow along on Github for any updates.

If you have any further issues don’t hesitate to reach out.

Regards,
Garrett

Awesome! Thank you very much, Garrett!