Package control type can't be used in script source
Severity
Blocking a few customers using custom step templates, workaround exists.
Version
2023.3.4541, 2024.1.12087, 2024.2.2914
Latest Version
I could reproduce the problem in the latest build
What happened?
When creating custom Step Templates with a Parameter that's of Package type, the option to let the project select the package doesn't appear in the step, instead giving a warning message when the Template is added to a Project:
This parameter is not currently used by the step, it might have been replaced by another parameter
Workaround is shown at the bottom of this GitHub issue.
Our engineers mentioned this as a missing functionality.
Reproduction
- Create a step template, choosing “Run a script” as the base step.
- Add a parameter “MyPackage” with the control type “Package”.
- In the step’s “Script source”, choose “Package”
- Enable “Bind” on Package ID, and set #{MyPackage} as the value, make sure you give the script a filename and save it. (Note - I can also get this to break if I don't bind the field and I use the dropdown option to select a package from the feed).
- Try to add this step template to any deployment process. It won’t let you select a package, saying:
This parameter is not currently used by the step, it might have been replaced by another parameter.
Error and Stacktrace
This parameter is not currently used by the step, it might have been replaced by another parameter
More Information
Old forum post where this was initially mentioned (the forum is no longer in use) - https://help.octopus.com/t/step-template-package-parameter-not-usable-because-it-is-not-used-by-the-step-even-though-im-referencing-it/29184
R and D thread for this (internal) - https://octopusdeploy.slack.com/archives/CNHBHV2BX/p1688535818633209
Workaround
Adding the package as an additional reference in the step template allows for the package selection option to appear in the project step:
You will need to ensure you chose choose Let the project select the package:
This then allows you to pick a package when adding that step template to a step:
Tickets in so far for this (internal):
- https://octopus.zendesk.com/agent/tickets/154573
- https://octopus.zendesk.com/agent/tickets/176938