Output variable scoping does not work correctly with Cloud Regions

Hi,

I found an issue with output variable scoping using Cloud Regions.

Steps to reproduce:

  • Create two cloud regions (eg: northeurope / westeurope) and apply the same role to them (eg Web)
  • Create a new project
  • Add a step to the process to execute a powershell script on the previously defined role (Web) and name “Write var” with the following code:
    Write-Host "Setting MachineNameTest : $($OctopusParameters['Octopus.Machine.Name'])"
    Set-OctopusVariable -name "MachineNameTest" -value $OctopusParameters["Octopus.Machine.Name"]
  • Add another step to the process to execute a powershell script on the previously defined role (Web) and name “Read var” with the following code:
    Write-Host "Getting MachineNameTest : $($OctopusParameters['Octopus.Action[Write var].Output.MachineNameTest'])"

Expected result:
The output variables should be scoped to the cloud region. In step 2, I expect northeurope when deploying to the northeurope cloud region and westeurope when deploying to the westeurope cloud region

Actual result (see screenshot):
In step 2, both deployments receive the value “northeurope”, the output variable is not correctly scoped to the cloud region

Hi Kenneth,

Thanks for getting in touch!

Are your script steps set to run on the Octopus Server? I’ve run the scenario your provided and when I set my scripts to run on the Octopus server I see the same behaviour as you describe in your actual result. If I change the script steps to run on the deployment target, I see the behaviour you expect.

Hope that helps!

Thank you,
Henrik

Hi Kenneth,

I’ve had a quick chat to the team and we’ve come to the conclusion that this is a bug and it should work as you expect it to work.

I’ve raised issue #2661 to have this investigated and fixed.

Thank you,
Henrik

Notice:

This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.