testing a bit, i may have answered my own question. i’ve created a step [named “collect_target_hostnames”] that runs locally on the octopus server, using powershell, which does this:
Set-OctopusVariable -name “MachineHostnames” -value #{Octopus.Machine.Hostname}
that step runs first. then, i’ve adjusted the email step to do this, for the email body:
a deployment has just been initiated:
project: #{Octopus.Project.Name}
release: #{Octopus.Release.Number}
environment: #{Octopus.Environment.Name}
targets:
#{each machine in Octopus.Action[collect_target_hostnames].Output}
#{machine.MachineHostnames}#{/each}
with brief testing thus far, this seems to get me what i’m after:
a deployment has just been initiated:
project: email_test
release: 0.0.24
environment: infrastructure-qa
targets:
foo.example.com
bar.example.com
is this the right way to accomplish this?
one other question - i’ve made these two steps into step templates, as they’ll be used repeatedly among numerous projects. when that happens though, if someone decides to name their “collect_target_hostnames” step something else, this mechanism fails. how can i more elegantly handle that?
thanks!