We have a custom step template which runs a ps1 file embedded in a referenced package.
Whenever we attempt to run this step template we get the following error:
Step templates that do not include a script body are currently not supported
Does the reference to an embedded script not count as an included script body?
Thanks for getting in touch! Sorry to hear you’re hitting this unexpected issue. I’ve seen this exact thing in the past, but for the life of me I can’t spot it though I’m pretty sure this bug has been fixed. I haven’t been able to reproduce this in my local instance (running 2019.8.4); can you let me know which version you’re currently on? If you’re still hitting this issue, can you send a screenshot showing where and when you’re hitting this?
I look forward to hearing back!
Thanks. We are running 2019.8.3.
Here is more detail:
We have a package in zip format created with this command:
dotnet octo pack --id="MyInstaller" --basePath="./src" --include="MyInstaller.exe" --include="install.ps1" --outFolder="./artifacts" --format="zip"
install.ps1 is just a simple wrapper that calls the embedded .exe:
...Start-Process $exe -Wait -ArgumentList $args...
We publish this package to Octopus and then reference it in a step template:
When we use the template from the
RUN button under Library/Step Templates, we get this error almost immediately (it does not seem long enough for the package to have copied to the target)
Thanks for keeping in touch! When running this step template on its own, it doesn’t actually deploy the package. If you had a package step that deployed the package, this step template running afterwards in the same process should then pick up this script file from that previously deployed package.
I’ve seen it accomplished (having the script in a package run directly from the step template, outside of the deployment process) in another way by instead referencing the package (by uploading and extracting) and executing the PowerShell script from an inline PS script in the step template. Something like the below:
Would that give you the behavior you’re after? Let me know how you go or if you have any further questions going forward.
Thanks for the workaround. I’ll try this later today.
I’m still curious when is it appropriate to use the “Script File in Package” option. If the package is not deployed within the context of the step template (and we dont yet have composite step templates) why does the option exist at all? If it requires a companion step in a project to deploy the package wouldn’t an additional script step in that project be a better option?
Thanks again for the follow-up.
@Kenneth_Bates Any idea why that variable would not be available?
When I try to access the .ExtractedPath using your example or $OctopusParameters[“Octopus.Action.Package[MyPackage].ExtractedPath”] the value is null.
I have marked the referenced package to be Extracted: true.
With OctopusPrintVariables enabled, I can see the ExtractedPath variable is not present.
@Kenneth_Bates Is there a file size limit on the package? This zip we are referencing is rather large at 120MB.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.