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 dc4aada
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
language: go

go:
# - 1.9.x
- 1.9.x
- 1.10.x
# - 1.11.x
# - tip
- 1.11.x
- tip

go_import_path: github.com/xetys/hetzner-kube

before_install:
- go get -v github.com/golang/dep/cmd/dep
- dep ensure
# - go get -v github.com/golang/lint/golint
# - go get -u honnef.co/go/tools/...
# - go get -u mvdan.cc/unparam
# - go get -u github.com/client9/misspell/cmd/misspell
- go get -v github.com/golang/lint/golint
- go get -u honnef.co/go/tools/...
- go get -u mvdan.cc/unparam
- go get -u github.com/client9/misspell/cmd/misspell

after_script:
- make hard-cleanup

script:
# - golint cmd/ pkg/
- golint cmd/ pkg/
- go test -v ./...
# - unused $(go list ./...)
# - gosimple $(go list ./...)
# - misspell -error $(git ls-files | grep -v vendor/)
# - unparam $(go list ./...)
# - staticcheck $(go list ./...)
- unused $(go list ./...)
- gosimple $(go list ./...)
- misspell -error $(git ls-files | grep -v vendor/)
- unparam $(go list ./...)
- staticcheck $(go list ./...)

jobs:
include:
Expand Down
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 dc4aada

Please sign in to comment.