2019-11-20 16:11:28 +00:00
|
|
|
parameters:
|
|
|
|
version:
|
|
|
|
type: string
|
2020-03-15 10:01:55 +00:00
|
|
|
default: 1.2.4
|
2019-11-20 16:11:28 +00:00
|
|
|
steps:
|
|
|
|
- run:
|
2020-05-04 23:02:15 +00:00
|
|
|
name: Install Vault
|
2019-11-20 16:11:28 +00:00
|
|
|
command: |
|
2020-05-04 23:02:15 +00:00
|
|
|
set -x
|
|
|
|
|
2020-05-15 16:22:15 +00:00
|
|
|
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
|
2020-05-04 23:02:15 +00:00
|
|
|
|
2020-05-15 16:22:15 +00:00
|
|
|
if [[ "${os}" != "windows" ]]; then
|
2020-05-04 23:02:15 +00:00
|
|
|
sudo unzip -d /usr/local/bin /tmp/vault.zip
|
|
|
|
rm -rf /tmp/vault*
|
2020-05-15 16:22:15 +00:00
|
|
|
else
|
|
|
|
rm -rf c:\Windows\vault.exe
|
|
|
|
unzip /tmp/vault.zip -d "/c/Windows"
|
|
|
|
rm -rf /tmp/vault*
|
2020-05-04 23:02:15 +00:00
|
|
|
fi
|