Kustomize version manager inspired by kzenv
Currently kzenv supports the following OSes
- Mac OS X (64bit)
- Linux
- 64bit
- Arm
Install via Homebrew
$ brew tap lzecca78/kzenv
$ brew install kzenv
- Check out kzenv into any path (here is
${HOME}/.kzenv
)
$ git clone https://github.com/tfutils/kzenv.git ~/.kzenv
- Add
~/.kzenv/bin
to your$PATH
any way you like
$ echo 'export PATH="$HOME/.kzenv/bin:$PATH"' >> ~/.bash_profile
OR you can make symlinks for kzenv/bin/*
scripts into a path that is already added to your $PATH
(e.g. /usr/local/bin
) OSX/Linux Only!
$ ln -s ~/.kzenv/bin/* /usr/local/bin
On Ubuntu/Debian touching /usr/local/bin
might require sudo access, but you can create ${HOME}/bin
or ${HOME}/.local/bin
and on next login it will get added to the session $PATH
or by running . ${HOME}/.profile
it will get added to the current shell session's $PATH
.
$ mkdir -p ~/.local/bin/
$ . ~/.profile
$ ln -s ~/.kzenv/bin/* ~/.local/bin
$ which kzenv
Install a specific version of kustomize. Available options for version:
i.j.k
exact version to installlatest
is a syntax to install latest versionlatest:<regex>
is a syntax to install latest version matching regex (used by grep -e)min-required
is a syntax to recursively scan your kustomize files to detect which version is minimally required. See required_version docs. Also see min-required section below.
$ kzenv install 1.0.11
$ kzenv install latest
$ kzenv install latest:^0.8
$ kzenv install
If you use a .kustomize-version file, kzenv install
(no argument) will install the version written in it.
String (Default: amd64)
Specify architecture. Architecture other than the default amd64 can be specified with the KZENV_ARCH
environment variable
KZENV_ARCH=arm tfenv install 0.7.9
Integer (Default: 2)
Set the mechanism used for displaying download progress when downloading kustomize versions from the remote server.
- 2: v1 Behaviour: Pass
-#
to curl - 1: Use curl default
- 0: Pass
-s
to curl
String (Default: https://releases.hashicorp.com)
To install from a remote other than the default
KZENV_REMOTE=https://example.jfrog.io/artifactory/hashicorp
Integer (Default: 1)
To disable colouring of console output, set to 0.
String (Default: +%F %T)
The display format for the date as passed to the date
binary to generate a datestamp used as a prefix to:
FILE
type log file lines.- Each console output line when
BASHLOG_EXTRA=1
Integer (Default: 0)
By default, console output from kzenv does not print a date stamp or log severity.
To enable this functionality, making normal output equivalent to FILE log output, set to 1.
Integer (Default: 0)
Set to 1 to enable plain text logging to file (FILE type logging).
The default path for log files is defined by /tmp/$(basename $0).log Each executable logs to its own file.
e.g.
BASHLOG_FILE=1 kzenv use latest
will log to /tmp/kzenv-use.log
String (Default: /tmp/$(basename ${0}).log)
To specify a single file as the target for all FILE type logging regardless of the executing script.
String (Default: "")
BE CAREFUL - MISUSE WILL DESTROY EVERYTHING YOU EVER LOVED
This variable allows you to pass a string containing a command that will be executed using eval
in order to produce a prefix to each console output line, and each FILE type log entry.
e.g.
BASHLOG_I_PROMISE_TO_BE_CAREFUL_CUSTOM_EVAL_PREFIX='echo "${$$} "'
will prefix every log line with the calling process' PID.
Integer (Default: 0)
Set to 1 to enable JSON logging to file (JSON type logging).
The default path for log files is defined by /tmp/$(basename $0).log.json Each executable logs to its own file.
e.g.
BASHLOG_JSON=1 kzenv use latest
will log in JSON format to /tmp/kzenv-use.log.json
JSON log content:
{"timestamp":"<date +%s>","level":"<log-level>","message":"<log-content>"}
String (Default: /tmp/$(basename ${0}).log.json)
To specify a single file as the target for all JSON type logging regardless of the executing script.
Integer (Default: 0)
To log to syslog using the logger
binary, set this to 1.
The basic functionality is thus:
local tag="${BASHLOG_SYSLOG_TAG:-$(basename "${0}")}";
local facility="${BASHLOG_SYSLOG_FACILITY:-local0}";
local pid="${$}";
logger --id="${pid}" -t "${tag}" -p "${facility}.${severity}" "${syslog_line}"
String (Default: local0)
The syslog facility to specify when using SYSLOG type logging.
String (Default: $(basename $0))
The syslog tag to specify when using SYSLOG type logging.
Defaults to the PID of the calling process.
Switch a version to use
latest
is a syntax to use the latest installed version
latest:<regex>
is a syntax to use latest installed version matching regex (used by grep -e)
$ kzenv use 0.7.0
$ kzenv use latest
$ kzenv use latest:^0.8
Uninstall a specific version of kustomize
latest
is a syntax to uninstall latest version
latest:<regex>
is a syntax to uninstall latest version matching regex (used by grep -e)
$ kzenv uninstall 0.7.0
$ kzenv uninstall latest
$ kzenv uninstall latest:^0.8
List installed versions
% kzenv list
* 0.10.7 (set by /opt/kzenv/version)
List installable versions
% kzenv list-remote
If you put a .kustomize-version
file on your project root, or in your home directory, kzenv detects it and uses the version written in it. If the version is latest
or latest:<regex>
, the latest matching version currently installed will be selected.
$ cat .kustomize-version
0.6.16
$ kustomize --version
kustomize v0.6.16
$ echo 0.7.3 > .kustomize-version
$ kustomize --version
kustomize v0.7.3
$ echo latest:^0.8 > .kustomize-version
$ kustomize --version
kustomize v0.8.8
$ git --git-dir=~/.kzenv/.git pull
$ rm -rf /some/path/to/kzenv
- kzenv itself
- rbenv
- kzenv partially uses rbenv's source code