Skip all child steps

From a parent step, is there a way to skip all of the child steps under it? Basically, I use the parent to test for a condition and based on that condition, run or don’t run the child steps.

It appears there is a way to stop the rest of a deploy from happening, but I just want to skip all the child steps within a parent step.

Hi Joshua,

Currently the only way to do this is via conditional PowerShell in the steps you want to skip.

In the first step, that decides what to run, you can set an output variable:

Set-OctopusVariable -Name "SkipChildren" -Value "True"

In each child step, if the child step’s a PowerShell step you can simply exit if the variable is set:

$skip = $OctopusParameters["Octopus.Action[Parent Step].Output.SkipChildren"]

if ($skip -eq "True") {
  exit 0
}

If the child step is a package step, instead of exiting, use PreDeploy.ps1 to set:

Set-OctopusVariable -Name "Octopus.Action.SkipRemainingConventions" -Value $skip

You can use the new Custom PowerShell scripts feature to add this to the process, rather than the .NUPKG file itself.

Note the package will still be extracted onto the target system (though not copied to a custom directory if one’s in use).

Hope this helps, know it is a bit indirect but should cover most needs.

This works, but it feels like a hack. I hope there will be a more elegant solution to this soon.

Hi,

Is there an update? I’ve had to disable all my substeps rather than just skipping the parent. I’m using 3.3.1.

Thanks, Lukas

Hi Lukas,

Thanks for getting in touch! Unfortunately we do not use old threads to gauge what the community is after in regards to new features/enhancements. We have a UserVoice page where you can see what other users have suggested and you can make suggestions of your own. You can vote and comment on other features also.

https://octopusdeploy.uservoice.com/

If you make a suggestion there, we can get a better idea of how much community support we have for this.

Let me know how you go. :slight_smile:

Best regards,
Daniel