It is always better to provide this type of validation so that it fail fast to ensure all the initial required data are gathered.
scopes:
- name: global
dvars:
- name: student_name
desc: show that if required ENV var is empty and it will fail if this is empty
value: '{{ env "STUDENT_NAME" |validateMandatoryFailIfNone "student_name" }}'
#same as below:
# value: '{{ expandenv "$STUDENT_NAME" |validateMandatoryFailIfNone "student_name" }}'
tasks:
- name: task
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> f0045
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/f0045
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
ERROR: validateMandatoryFailIfNone [Required var:(student_name) must not be empty, please fix it]