Support Required Variables
It would be great if my deployment failed if a variable was not available in a particular environment. Currently I place a PreDeploy.ps1 with checks for particular variables (not empty) and I'm wondering if there could be a better experience for specifying that certain (or all) variables must be provided if they are used from PowerShell or elsewhere. We've had issues where our deployment went green but a variable was missing in a particular environment.
Paul Wilcox commented
I would also say that this is applicable to step templates and libray, variable sets.
In my view, it would be nice to be able to setup a set of "required variables" as part of (or in a similar way to) library sets so:
- A user can define a variable set (including "required variables") which are available in the library. These "required variables" may have a default value (fixed or derived from another variable) or no value. There would also the option to setup these variables with a fixed/allowed/dropdown of values that can be selected/used.
- When a variable set (from the library) gets added into the Project Variables, these "required variables" are added in a virtual/non-permanent manner. These may be changed (they are not fixed like variables in a standard variable set) but the team member updating the project is then aware they need to provide those values.
Also, related to this, it would be useful to be able to set library variable sets (including "required variable" sets) as "depended upon" by other variable sets and step templates. This would allow cascading/nested variables to be managed more strictly (ensuring consistency) and would allow variables to be setup in a project as "required" if they were needed by a step template.
I guess this could be extended to something like "Variable Policy" for example:
- all variables available in one environment must be identical in this environment
- use all variables from another environment i.e. if a variable is not available in current environment try to resolve it from another environment
The use case here is to apply "Variable Policy" rules in Pre-Prod & PROD environments to stop false "green" releases with missing or incorrect variable values. For example we can fully test releases in Pre-Prod but cannot test in PROD and the variables setup is manual step with high risk!
I guess the current implementation of DryRun will solve the problem of what happens of variables for a particular target environment :)