Unable to remove target roles from parent step

Hello,

I have an deployment process which includes a parent step with two child steps. The parent step is scoped against a role, but I wish to remove that role. However, when I try, I’m presented with an error -

Please select one or more roles that ‘Deploy Front Door’ step will apply to.

When I try to update the deployment process via the API I’m also presented with the same error -

{
  "ErrorMessage": "There was a problem with your request.",
  "Errors": [
    "Please select one or more roles that 'Deploy Front Door' step will apply to."
  ],
  "ParsedHelpLinks": [],
  "Details": {
    "Steps[3].Octopus.Action.TargetRoles": "Please select one or more roles that 'Deploy Front Door' step will apply to."
  }
}

However, it is possible to create a step that runs on the Octopus server (that does not target any roles), and then transform it into a parent step by adding one or more child steps to it, as can be seen in the screen shot of a different plan below.

I’m not sure which one of these behaviours is a bug, as I can find no explicit mention of either in the documentation.

I’m hoping the first behaviour that I described is the bug, but can someone please confirm?

Thanks,
David

Hi David,

Thanks for getting in touch. This behaviour depends on the type of step used. Most steps require a role to be defined as their function is reliant on deployment targets in some form. If a multi-step includes any of these kind of steps, then it will be impossible to remove the parent role.

You can group steps that don’t require a role, such as CloudFormation or similar, without assigning a role to the parent. However, you won’t be able to add any steps that require a role to this group without first assigning one to the parent.

What step types were you using in your initial attempt at this?

Best regards,
Paul

Hi Paul,

Thanks for your swift reply.

As you can see from the screenshot in the OP, I have a parent step with no target role assigned that has child steps of type ‘Run an Azure PowerShell script’ (via a Step Template) and the ‘Deploy an Azure Resource Manager Template’.

In another project, I have a parent step with those same two child steps as well as one of type ‘Run a Script’. It’s this project where I cannot remove the target role from the parent step.

The ‘Run a Script’ step can be run on the Octopus Server without targeting a role, so I was expecting to be able to use it as a child step in the same way. Perhaps that is not the case here?

Thanks,
David

Hi David,

The ‘Run a Script’ step does behave as if it requires a role assigning even when set to run on the Octopus Server. If I try to add a ‘Run a Script’ step to a multi-step that doesn’t have a role assigned, it refuses to apply too.

I’ll run this past our engineers to get their take on it, as it does feel like erroneous behaviour.

Regards,
Paul

That’s great, thanks Paul.

Thanks,
David

Hi David,

I’ve had a chat with the engineers, and this is intended behaviour. Essentially, any step that has the capability of being run against a single deployment target (e.g. ‘Run a Script’) will always require a role in a multi-step. Even if the step is set to run on the Octopus Server.

The reasoning behind this is that the scope of the multi-step was to allow a rolling deployment to run against a sub-set of targets within a role at a time. So running a script on the Octopus Server within a rolling deployment was never included in this scope.

Would you be able to achieve what you’re aiming for by moving the content of the ‘Run a Script’ step into one of the other steps as a Post-Deployment script?

Regards,
Paul

Hi Paul,

Yep, I can move the step out, it’ll just make the deployment look a little untidy :wink:

It just seems a bit buggy so thought I would reach out to see if there was a workaround.

Thanks,
David

1 Like