Issues
Issues copied to clipboard
Unscoped account value prevents deployment when account is restricted to an environment
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
- Create a
DevelopmentandProductionenvironment - Create a username / password account
A. Configure it to only be available for deployment to theDevelopmentenvironment - Create a username / password account
B. Configure it to only be available for deployment to theProductionenvironment - Create a project. Add a
User.Accountaccount project variable. - Set the variable value to
Aand make it unscoped - Add another variable value and set it to
Band scope it to theProductionenvironment - Configure the deployment process with any step and create a release.
- 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.
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:
and are set as an unscoped Variable value:
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: