If using separate branches for each environment, it can be useful to
read the environment name from a file committed to each branch. Or, if
sharing the same branch for all environments, it can be useful to set
the default environment to one with lower impact, e.g. dev or staging.
If no --environment option is specified and a .environment file exists
at the root of the directory, use its content as KAYOBE_ENVIRONMENT.
Change-Id: I22b2b466e47a3b4d96931d754a4de7544f0ada5d
(cherry picked from commit 2af2c3a3b5387c577801b165ecd749fe782fddb9)
This also includes a cherry-pick of
I9a44578196086ec24de80b992fed385826778feb, Stop accessing unbound
variables.
The kayobe-env script would try accessing $1 which is an unbound
variable if no argument is passed. This fails when `set -u` is set.
Also refactor usage output into a function. As a side effect, a missing
argument to --environment now causes the script to properly exit with an
error.
Change-Id: I604c2ae6c47ef16fdc98e0598cad820e49e2ff26
Story: 2002009
Task: 41577
(cherry picked from commit 75b6402f8b0d4e39c40a1d11091ca760d8b99dee)