Packer version manager mainly inspired by tfenv
Currently pkenv supports the following OSes
- Linux (64bit)
- Mac OS X (64bit)
- Arm
- Windows - tested in Cygwin and WSL.
On Mac OS X, you can install pkenv with Homebrew:
$ brew tap kwilczynski/homebrew-pkenv
$ brew install pkenv
On any other platform, you can install pkenv as follows:
- Check out pkenv into any path (here is
${HOME}/.pkenv
)
$ git clone https://github.com/iamhsa/pkenv.git ${HOME}/.pkenv
- Add
${HOME}/.pkenv/bin
to your$PATH
any way you like
$ echo 'export PATH="${HOME}/.pkenv/bin:$PATH"' >> ${HOME}/.bash_profile
OR you can make symlinks for pkenv/bin/*
scripts into a path that is already added to your $PATH
(e.g. /usr/local/bin
) OSX/Linux Only!
$ ln -s ${HOME}/.pkenv/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 ~/.pkenv/bin/* ~/.local/bin
$ command -v pkenv
Install a specific version of Packer. 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)
$ pkenv install 1.1.1
$ pkenv install latest
$ pkenv install latest:^1.3
$ pkenv install
If shasum
is present in the path, pkenv will verify the download against Hashicorp's published sha256 hash.
If keybase is available in the path it will also verify the signature for those published hashes using Hashicorp's published public key.
You can opt-in to using GnuPG tools for PGP signature verification if keybase is not available:
$ echo 'trust-pkenv: yes' > ~/.pkenv/use-gpgv
$ pkenv install
The trust-pkenv
directive means that verification uses a copy of the
Hashicorp OpenPGP key found in the pkenv repository. Skipping that directive
means that the Hashicorp key must be in the existing default trusted keys.
Use the file ~/.pkenv/use-gnupg
to instead invoke the full gpg
tool and
see web-of-trust status; beware that a lack of trust path will not cause a
validation failure.
If you use .packer-version, pkenv install
(no argument) will install the version written in it.
Architecture other than the default amd64 can be specified with the PKENV_ARCH
environment variable
PKENV_ARCH=arm pkenv install 1.3.1
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)
$ pkenv use 0.12.3
$ pkenv use latest
$ pkenv use latest:^0.12
Uninstall a specific version of Packer
latest
is a syntax to uninstall latest version
latest:<regex>
is a syntax to uninstall latest version matching regex (used by grep -e)
$ pkenv uninstall 0.7.0
$ pkenv uninstall latest
$ pkenv uninstall latest:^0.8
List installed versions
$ pkenv list
* 1.1.1 (set by /opt/pkenv-build/work/pkenv/version)
0.12.3
0.12.2
0.7.5
0.6.1
List installable versions
$ pkenv list-remote
1.4.2
1.4.1
1.4.0
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.3
1.1.2
1.1.1
...
If you put .packer-version
file on your project root, or in your home directory, pkenv detects it and use the version written in it. If the version is latest
or latest:<regex>
, the latest matching version currently installed will be selected.
$ cat .packer-version
1.4.2
$ packer --version
1.4.2
$ echo 1.4.2 > .packer-version
$ packer --version
1.4.2
$ echo latest:^1.4 > .packer-version
$ packer version
1.4.2
String (Default: https://releases.hashicorp.com)
To install from a remote other than the default
$ PKENV_REMOTE=https://example.jfrog.io/artifactory/hashicorp
$ git --git-dir=${HOME}/.pkenv/.git pull
$ rm -rf ${HOME}/.pkenv
- pkenv itself
- tfenv : pkenv mainly uses tfenv's source code