Issues icon indicating copy to clipboard operation
Issues copied to clipboard

Unscoped account value prevents deployment when account is restricted to an environment

Open felixi-octopus opened this issue 11 months ago • 2 comments

Severity

No response

Version

Earliest observed was 2023.3.13042

Latest Version

None

What happened?

An unscoped account variable prevents deployments to an environment when that account is configured to only be available for deployment to another environment.

Reproduction

  1. Create a Development and Production environment
  2. Create a username / password account A. Configure it to only be available for deployment to the Development environment
  3. Create a username / password account B. Configure it to only be available for deployment to the Production environment
  4. Create a project. Add a User.Account account project variable.
  5. Set the variable value to A and make it unscoped
  6. Add another variable value and set it to B and scope it to the Production environment
  7. Configure the deployment process with any step and create a release.
  8. Attempt to deploy the release to the Production environment and note the error

This is by design. Octopus has access to the unscoped account variable A and the value scoped to an environment - B, but the A does not have permission to be used in Production. Octopus is testing that all variable values it has access to can be used in the attempted deployment scope.

image

Error and Stacktrace

No response

More Information

This error happens when there is a mismatch between the project environment scoping and the account environment scoping. When preparing to deploy, we first fetch all variables that could apply to the deployment (un-scoped applies to every deployment), and then evaluate the specificity of variables when a step is executed, not when the deployment is created. The only way to use a scoped account variable is to also scope it to the same environments in the project variables.

Workaround

For Accounts that have Environment restrictions set via the Account configuration: image

and are set as an unscoped Variable value: image (1)

You will need to define an Environment scope for the Variable value that includes some or all of the Environments listed on the Account configuration page: image

felixi-octopus avatar Nov 11 '24 01:11 felixi-octopus