Use contents of array to loop over child task items

Hello all,

I have a question on how to take a variable that contains a list of comma delimited strings (for instance Azure Regions) and loop over a set of child items where the “current item” in the array is set to a variable so I can use the variable in the child build steps as a parameter.

Has anybody ever done something similar before?

Thank you
Gareth

Hi Gareth,

Thanks for getting in touch. Have you considered using Cloud Regions for this? It struck me that the problem you were describing could be tackled with cloud regions and it avoids the need to keep your CSV in sync with the actual regions you deploy to. From our cloud regions page…

Cloud Region targets will enable steps which execute on the Octopus Server to execute multiple times, with variables scoped for each iteration. The specific scenario this is designed to support is deploying cloud applications to multiple geographic regions.

So you could define cloud regions (i.e. Azure regions) instead of creating a CSV list of regions and you could scope variables to each region.

NOTE: Cloud regions are available in Octopus 3.4.0 and newer.

I understand this doesn’t directly address your question but does this sound like it handles your scenario? If not, could you give me a bit more of an example so I can better understand and help.

Hope this helps!

Rob

Rob, thanks for replying. Ill take a look and see if it fits.

Thanks
Gareth