2019-11-20 16:11:28 +00:00
|
|
|
parameters:
|
|
|
|
version:
|
|
|
|
type: string
|
2020-03-15 10:01:55 +00:00
|
|
|
default: 1.2.4
|
2020-05-04 23:02:15 +00:00
|
|
|
os:
|
|
|
|
type: string
|
|
|
|
default: linux
|
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
|
|
|
|
|
|
|
|
curl -SL --fail -o /tmp/vault.zip https://releases.hashicorp.com/vault/"<< parameters.version >>"/vault_"<< parameters.version >>"_"<< parameters.os >>"_amd64.zip
|
|
|
|
|
|
|
|
if [[ << parameters.os >> == "linux" ]]
|
|
|
|
then
|
|
|
|
sudo unzip -d /usr/local/bin /tmp/vault.zip
|
|
|
|
rm -rf /tmp/vault*
|
|
|
|
fi
|
|
|
|
if [[ << parameters.os >> == "windows" ]]
|
|
|
|
then
|
|
|
|
if [[ ! -f "c:\Windows\vault.exe" ]]
|
|
|
|
then
|
|
|
|
echo "Cache not found, doing a fresh install of vault"
|
|
|
|
unzip /tmp/vault.zip -d "/c/Windows"
|
|
|
|
rm -rf /tmp/vault*
|
|
|
|
fi
|
|
|
|
fi
|