Script Modules in Octopus are only inline code - no package support?

Hi Guys,

I want to centrally manage and maintain all PowerShell code used in Octopus across all projects and steps.

At first I looked at using the Script Modules under Library, but unfortunately it does not have package support only inline code!?
I want the code to be source controlled where TeamCity will publish the package to the Octopus package repository - this model offers most benefits like change control, auditing, history, versioning etc.

I have already created PowerShell module that holds all code used in Octopus and I am using it from deployment steps like this:

I import the module in each step via the bootstrap-module.ps1 and then use the Script Parameters field to call a module member function. Obviously this is a hack and ideally I would like to use it like shared across projects module but there is no support for packaging - are there any plans to introduce this feature?

Thanks,
Emil

Hi Emil,

We have had similar suggestion before about integration with source control and we have raised a uservoice idea about it, see https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/15698781-version-control-configuration.

Feel free to add extra comments to the user voice idea or comment on the blog post mentioned, we are listening and haven’t given up on source control integration.

Cheers
John

Hi John,

excellent news - I am glad to see there is rfc and hopefully we can see the new planned features in a preview version soon…

Thanks,
Emil

Hi Emil,

So after talking to my colleagues, we kind of already support what you are asking for.
The solution is to package your scripts as a package and then select “Script file inside a package” in https://octopus.com/docs/deploying-applications/custom-scripts/standalone-scripts.

So to summarise, keep the scripts in source control and as part of your build server package these as a package (eg nuget package), and then push that package to Octopus and finally follow https://octopus.com/docs/deploying-applications/custom-scripts/standalone-scripts.

Does this sound like a solution ?

Cheers
John