`Required` variables for jobs
Description
Gitlab offers way to provide CI/CD variables that jobs can consume.
What happens if a "required"/"needed" variable is not available to the job? My thought is it should fail/pause until added.
The workaround today is to do a script variable check, i.e. If (!(Test-Path variable:global:foo)) {Throw "Variable foo is missing..."}
. This seems very ugly.
Proposal
Add a required_vars
entry for job definition, ensuring a job doesn't run without missing a variable dependency.
job1
stage: stage1
script:
- Echo $MyPipelineVAR
required_vars:
- MyPipelineVAR
Links / references
This specifically affected Production/non-test environments as test environments had dynamically generated variables where as Prod environments uses variables generally entered into Gitlab CI/CD settings page. #tookdownprod