#{Octopus.Machine.Roles} in transforms

Hi,

I have a doubt about the way additional transforms work with regards to lists of values.

For example if I have the transform: Web.#{Octopus.Machine.Roles}role.config => Web.config
and the server has two roles www and www-web1 then I expected, as #{Octopus.Machine.Roles} is a list, the net result to be

Web.wwwrole.config => Web.config
Web.www-web1role.config => Web.config

However what I think I get is:
Web.www,www-web1role.config => Web.config

Which is really unhelpful. Am I missing a trick? and it there a workaround?

Cheers
Andy

Hi Andy,

Thanks for reaching out. #{Octopus.Machine.Roles} is not a list, but a string that contains all roles between single quotes like this: 'www, www-1'

If your deployment step is scoped only 1 role, you can use the variable #{Octopus.Tentacle.CurrentDeployment.TargetedRoles} like this:

Web.#{Octopus.Tentacle.CurrentDeployment.TargetedRoles}Role.config => web.config

If the step is scoped to more than 1 role, there are other trickier ways to do this.

Let me know if the above works for you

Dalmiro

Hi Damiro,

I have a workaround in place that uses variables instead of the multiple roles I was using before.

Thanks anyway.

Andy