Another try to setup doctl with the right version

This commit is contained in:
Robert Schäfer 2019-04-04 15:11:36 +02:00
parent 923d106c23
commit 262655a1d8
2 changed files with 21 additions and 5 deletions

View File

@ -5,10 +5,8 @@ addons:
packages:
- libgconf-2-4
snaps:
- 'doctl --classic'
- docker
- chromium
- 'kubectl --classic'
before_install:
- yarn global add wait-on
@ -33,9 +31,6 @@ script:
- yarn run cypress:run --record --key $CYPRESS_TOKEN
after_success:
- doctl auth init --access-token $DOCTL_ACCESS_TOKEN
- mkdir -p ~/.kube/
- doctl kubernetes cluster kubeconfig show nitro-staging > ~/.kube/config.yaml
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success $WEBHOOK_URL
@ -50,6 +45,9 @@ after_failure:
- chmod +x send.sh
- ./send.sh failure $WEBHOOK_URL
before_deploy:
- ./scripts/setup_kubernetes.sh
deploy:
- provider: script
script: scripts/docker_push.sh

18
scripts/setup_kubernetes.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# This script can be called multiple times for each `before_deploy` hook
# so let's exit successfully if kubectl is already installed:
command -v kubectl && exit 0
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
curl -LO https://github.com/digitalocean/doctl/releases/download/v1.14.0/doctl-1.14.0-linux-amd64.tar.gz
tar xf doctl-1.14.0-linux-amd64.tar.gz
chmod +x ./doctl
sudo mv ./doctl /usr/local/bin/doctl
doctl auth init --access-token $DOCTL_ACCESS_TOKEN
mkdir -p ~/.kube/
doctl kubernetes cluster kubeconfig show nitro-staging > ~/.kube/config.yaml