You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tasks often need several environment variables set.
We could make writing reliable tasks much easier if we had easy way to assert that the specified env vars are (1) set, and (2) not empty right before executing the commands.
If one or more of those asserted environment vars are not set right before executing the command, or are empty, we get a error printing all assertion errors in one error message:
The following environment variables are not set
USERNAME, PASSWORD
The following environment variables are set, but are empty
SRC
Yes, this is doable with preconditions, but
it's a very common pattern, and making it easier adds value
it's tricky to do with preconditions in a way which would print out all unset/empty env vars in one error message (and printing them this way makes troubleshooting easier -- it's clear if only one is missing, or more, without needing to rerun the task after setting the first one reported, only to find a second env var is also missing)
Furthermore, making a distinction in the error message between unset and set-but-empty env vars makes debugging even easier.
We should first evaluate "env" (in case it sets some of the env vars), and only then evaluate 'assert-env'.
It should be also possible to set this on the global (Taskfile) level. This would help avoid repeat it in case multiple tasks require same env vars.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Tasks often need several environment variables set.
We could make writing reliable tasks much easier if we had easy way to assert that the specified env vars are (1) set, and (2) not empty right before executing the commands.
If one or more of those asserted environment vars are not set right before executing the command, or are empty, we get a error printing all assertion errors in one error message:
Yes, this is doable with
preconditions
, butFurthermore, making a distinction in the error message between unset and set-but-empty env vars makes debugging even easier.
We should first evaluate "env" (in case it sets some of the env vars), and only then evaluate 'assert-env'.
It should be also possible to set this on the global (Taskfile) level. This would help avoid repeat it in case multiple tasks require same env vars.
Beta Was this translation helpful? Give feedback.
All reactions