open-nomad/.circleci/config/commands/install-vault.yml
Mahmood Ali e50fb91557 Few Windows CI changes:
Always install go and vault: the check may accidentally use the CircleCI
pre-installed go version instead of the cached version.

Also, always install from sources without caching.  Go/vault
installation is basically a tarball download.  That's equivalent to
CirleCI caching without the complexity.  These steps don't add much time
either.

Lastly, infer the OS when downloading tarball to avoid managing them in
the job spec.
2020-05-15 12:22:15 -04:00

28 lines
760 B
YAML

parameters:
version:
type: string
default: 1.2.4
steps:
- run:
name: Install Vault
command: |
set -x
case "${OSTYPE}" in
linux*) os="linux" ;;
darwin*) os="darwin" ;;
msys*) os="windows" ;;
*) echo "unknown os: ${OSTYPE}"; exit 1 ;;
esac
curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"<< parameters.version >>"/vault_"<< parameters.version >>"_"${os}"_amd64.zip
if [[ "${os}" != "windows" ]]; then
sudo unzip -d /usr/local/bin /tmp/vault.zip
rm -rf /tmp/vault*
else
rm -rf c:\Windows\vault.exe
unzip /tmp/vault.zip -d "/c/Windows"
rm -rf /tmp/vault*
fi