OC version manager inspired by tfenv.
- Install OC versions in a reproducible and easy way
- Enforce version in your git repositories with a
.oc_version
file
Currently ocenv supports the following OSes
- Mac OS
- Linux
- Windows
There are two components in ocenv
. One is the ocenv
binary, the other one
is a oc
wrapper. It works as if were oc
, but it has some logic to choose
the version to execute. You should take care and ensure that you don't have any
oc
binary in your path. To check which binary you're executing, you can see
it with:
$ which oc
/opt/brew/bin/oc
This is the recomended way, since it provides upgrades. It should work in Mac, Linux and Windows with WSL.
# Just the first time, activate the repository
brew tap little-angry-clouds/homebrew-my-brews
# To install
brew install ocenv
# To upgrade
brew upgrade ocenv
You should add your homebrew
binary path to your PATH:
echo 'export PATH="$(brew --prefix)/bin/:$PATH"' >> ~/.bashrc
# Or
echo 'export PATH="$(brew --prefix)/bin/:$PATH"' >> ~/.zshrc
For Windows you should do the weird stuff that it needs to set an environmental variable.
- Add
~/.bin
to your$PATH
and create it if doesn't exist
echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.bashrc
# Or
echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc
mkdir -p ~/.bin
- Download the binaries and put them on your path
Go to the releases page and download the version you want. For example:
wget https://github.com/little-angry-clouds/kubernetes-binaries-managers/releases/download/v1.0.0/kubernetes-binaries-managers_1.0.0_linux_amd64.tar.gz
tar -xzf kubernetes-binaries-managers_1.0.0_linux_amd64.tar.gz
mv oc-linux-amd64/ocenv ~/.bin/ocenv
mv oc-linux-amd64/oc-wrapper ~/.bin/oc
And that's it!
$ ocenv help
Oc version manager
Usage:
ocenv [command]
Available Commands:
help Help about any command
install Install binary
list Lists local and remote versions
uninstall Uninstall binary
use Set the default version to use
Flags:
-h, --help help
Use "ocenv [command] --help" for more information about a command.
This option uses Github API to paginate all versions. Github API has some usage limitations. It usually works, but if you happen to do a lot of requests to github or are on an office or similar, chances are that this command will fail. You can still install binaries if you know the version you want, thought.
$ ocenv list remote
4.7.0-0.okd-2021-07-03-190901
4.7.0-0.okd-2021-06-19-191547
4.7.0-0.okd-2021-06-13-090745
4.7.0-0.okd-2021-06-04-191031
4.7.0-0.okd-2021-05-22-050008
4.7.0-0.okd-2021-04-24-103438
4.7.0-0.okd-2021-04-11-124433
...
$ ocenv list local
4.7.0-0.okd-2021-07-03-190901
4.7.0-0.okd-2021-06-19-191547
4.7.0-0.okd-2021-06-13-090745
4.7.0-0.okd-2021-06-04-191031
4.7.0-0.okd-2021-05-22-050008
4.7.0-0.okd-2021-04-24-103438
4.7.0-0.okd-2021-04-11-124433
$ ocenv install 4.7.0-0.okd-2021-07-03-190901
Downloading binary...
Done! Saving it at /home/user/.bin/oc-4.7.0-0.okd-2021-07-03-190901
$ ocenv use 4.7.0-0.okd-2021-07-03-190901
Done! Using 4.7.0-0.okd-2021-07-03-190901 version.
$ ocenv uninstall 4.7.0-0.okd-2021-07-03-190901
Done! 4.7.0-0.okd-2021-07-03-190901 version uninstalled from /home/ap/.bin/oc-4.7.0-0.okd-2021-07-03-190901.
GPL3