Is it possible to pull in a previous steps parameters in a custom step temple

Hello, I am new to OD and I am trying to create a custom step to help us validate the status of apps after a deployment. Is it possible if i use a parameter of type “Previous Step” be able to pull in the information that was supplied for that step when it executed?

For example, if i referenced a “Deploy to IIS” step would I be able get the web site name, app pool, and bindings applied to IIS? I want to use this to make sure i get back a Http 200 or 403 response instead of a 500 response.

Hi Todd,

Thank you for your question. Yes, this is all possible. Firstly, as you’ve suggested, you would add a parameter to your step template with a control type of “A previous deployment step name”.

Then, assuming your step template is a “Run a script” step, you can access all the necessary information through the $OctopusParameters variable. If your parameter was named DeployStepName then you will be able to access the name of the step via $OctopusParameters["DeployStepName"] You can also access the parameters used in that step by its name:

$stepName = $OctopusParameters["DeployStepName"]
$webSiteName = $OctopusParameters["Octopus.Action[$stepName].IISWebSite.WebSiteName"]

If you’d like to see all the available parameters, just add a script step with the body Write-Output $OctopusParameters to see a list of them all written to the deployment log.

I hope that information helps! Let me know if there is anything else I can assist with.

Regards,
Jayden

1 Like

Thanks for the help. Just curious, how do i submit step templates the the library? I am new to OD.

Hi,

Sorry, I confused “custom step” with our “Custom step template” feature and assumed that is what you were using. When you say “submit step templates to the library”, do you mean adding a custom step template to your Octopus Server, or contributing a new step to the public community step library?

We have some really helpful documentation on custom step templates for adding a new custom step template to your Octopus Server. That should get you started. There is also a step named HTTP - Test URL in the community library which you may find helpful either directly, or as a starting point for writing your own step.

Please let me know if I you would like me to clarify anything further.

Regards,
Jayden

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.