Skip to content

Commit

Permalink
test cleaup after scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo committed Sep 1, 2018
1 parent ba0deeb commit 6f11b0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ before_install:
# - go get -u mvdan.cc/unparam
# - go get -u github.com/client9/misspell/cmd/misspell

after_script:
- make hard-cleanup

script:
# - golint cmd/ pkg/
- go test -v ./...
Expand All @@ -25,12 +28,12 @@ script:
# - unparam $(go list ./...)
# - staticcheck $(go list ./...)

jobs:
include:
- stage: e2e test
script:
- go build
- make preparare
- make test-all
- make cleanup
go: 1.10.x
# jobs:
# include:
# - stage: e2e test
# script:
# - go build
# - make preparare
# - make test-all
# - make cleanup
# go: 1.10.x
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ test-cluster-with-ha-level4:
cleanup:
${HETZNER_KUBE} ssh-key delete --name ${SSH_KEY_NAME}
${HETZNER_KUBE} context delete ${CONTEXT_NAME}

hard-cleanup:
curl -s --request GET --url https://api.hetzner.cloud/v1/servers --header "Authorization: Bearer ${HETZNER_API_KEY}" | jq '.servers[] | "\(.name) \(.id)"' | grep ${TRAVIS_JOB_NUMBER} | awk 'BEGIN { FS = "\"" } ; { print $$2 }' | awk '{ print $$2 }' | xargs -I '{}' bash -c "curl -s --request DELETE https://api.hetzner.cloud/v1/servers/{} --header \"Authorization: Bearer ${HETZNER_API_KEY}\""
curl -s --request GET --url https://api.hetzner.cloud/v1/ssh_keys --header "Authorization: Bearer ${HETZNER_API_KEY}" | jq '.ssh_keys[] | "\(.name) \(.id)"' | grep ${TRAVIS_JOB_NUMBER} | awk 'BEGIN { FS = "\"" } ; { print $$2 }' | awk '{ print $$2 }' | xargs -I '{}' bash -c "curl -s --request DELETE https://api.hetzner.cloud/v1/ssh_keys/{} --header \"Authorization: Bearer ${HETZNER_API_KEY}\""

0 comments on commit 6f11b0a

Please sign in to comment.