Commit Graph

8 Commits

Author SHA1 Message Date
Mark Goddard 651b8be1a0 kayobe-env: Unstick KOLLA_SOURCE_PATH and KOLLA_VENV_PATH
The kayobe-env script does not update the KOLLA_SOURCE_PATH and
KOLLA_VENV_PATH variables if they are already set.  This can lead to
dangerous and difficult to diagnose issues where Kayobe uses a different
version of Kolla Ansible than expected.

This change updates these variables each time the kayobe-env script is
sourced.

Change-Id: I3b4b0b611750b9c7846ff5f74554aee2f14939e4
Closes-Bug: #2036711
2023-09-21 10:01:03 +00:00
Pierre Riteau 2af2c3a3b5 Support reading Kayobe environment name from file
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
2021-03-31 14:56:53 +02:00
Pierre Riteau d0514fec02 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: I9a44578196086ec24de80b992fed385826778feb
2021-03-31 13:38:12 +02:00
Pierre Riteau 75b6402f8b Support specifying a Kayobe environment to use
Change-Id: I604c2ae6c47ef16fdc98e0598cad820e49e2ff26
Story: 2002009
Task: 41577
2021-03-15 12:26:13 +01:00
Bharat Kunwar afeee3c07e Make source kayobe-env zsh compatible
The config falls back to zsh of $BASH_SOURCE is not found

Change-Id: Icfcb55cb2be7971c578c93740a4cdd600d3e36b9
Story: 2006173
Task: 35693
2019-07-08 10:22:14 +01:00
Mark Goddard dd942ed498 Update kayobe-env for new recommended directory structure 2017-09-20 17:31:55 +01:00
Mark Goddard c54c50398d Add Apache2 license 2017-04-19 15:55:40 +01:00
Mark Goddard b95a01d75d Add a script to set kayobe environment variables 2017-04-19 15:53:31 +01:00