I’ve noticed that the PowerShell script for Step Templates (at https://octopusdeploy.example.org/app#/library/steps) can be pulled in from an Octopus Package, which means I can maintain my PowerShell scripts in source control, run Pester tests against them in TeamCity and push updates to the Step Templates package without needing to write my own import / export scripts.
However, I don’t seem to have the same luxury with “Script Modules” (at https://octopusdeploy.example.org/app#/library/scripts). I can’t reference a script in a Package and let my CI process take care of updating it when I commit to source control.
I can probably write my own shonky version with the import and export features of Octopus Deploy, but it would be really helpful if this functionality was native.
Thanks for getting in touch!. You are right, Script Modules don’t provide the features you are looking for and if you believe this would be a valuable addition to Octopus then please add your idea to https://octopusdeploy.uservoice.com/.
That being said I can think of two possible alternative solutions.
- Keep your modules in a separate package.
- Create an additional step (e.g. Deploy Modules) in your deployment process that deploys the package with modules and place it before the step that executes the step template.
- Pass the value of
Octopus.Action[Deploy Modules].Output.Package.InstallationDirectoryPath system variable to your step template script via script parameters and load modules from there.
The advantage of this solution is that it lets you keep your step template scripts and your modules separated. The disadvantage is that this makes testing your scripts locally a bit more difficult and requires you to add additional step to your deployment process.
Bundle scripts together
- During your build process (CI) embeded modules in the package used your step template.
The advantage of this solution is that your scripts are self contained because their dependencies are shipped with them and there is no need to modify the deployment process. The disadvantage is that you would need to modify your build process.
Please let me know if that doesn’t solve your problem.
This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.