Erratic substitution of same variable defined with multiple scopes on same machine

It seems that the rules for variable substitution based on the most specifically scoped variable does not work correctly when deploying to the same machine:

Steps to reproduce (simplified):

  • Having one environment: “Test” with one machine.
  • The one machine has two roles: “Webserver” and “Servicehost”.
  • One process with two steps: “Deploy webserver” and “Deploy servicehost” respectively deploying a “Webserver-package” to “Webserver” role and “Servicehost-package” to “Servicehost” role.
  • Both packages contains a web.config file with a “LogLevel” substitution variable.
    The process has a variable defined twice; “LogLevel”, with the following value and scope(s):
  1. Loglevel - “INFO” - Scope: (none)
  2. Loglevel - “WARN” - Scope: Test; Servicehost

On deploy the resulting loglevel becomes WARN in both web.config files (Webserver and Servicehost).

“WARN” loglevel on Servicehost, and “INFO” on Webserver (fallback).

The version of Octopus server is

Hi André,

Thanks for getting in touch! I am sorry but this is working as intended. Roles will always take precedence, and your machine has a role that has a scoped variable.
Even though the step isn’t for that role, it will still take the precedence for the variable.

To work as you want to expect, if you add a variable with a scope for your second role ‘webserver’ it will then work as you expect, because that role is scoped for the step, and that one will override the priority of the second role scoped.

Hope that helps!