diff --git a/.gitignore b/.gitignore index f336ed3cb..bb269abd8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .DS_Store .gobuild bin - +logs diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 083e02564..599673891 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -101,6 +101,8 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) { "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", ]) { + sh "./scripts/collect_logs.sh ${env.DEPLOYMENTNAMESPACE} ${kubeconfig}" + archive includes: 'logs/*' sh "make cleanup-tests" } } diff --git a/Makefile b/Makefile index 57d5b0859..5a343e28e 100644 --- a/Makefile +++ b/Makefile @@ -261,9 +261,6 @@ endif kubectl apply -f $(MANIFESTPATHTEST) $(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE) $(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS) -ifneq ($(DEPLOYMENTNAMESPACE), default) - kubectl delete namespace $(DEPLOYMENTNAMESPACE) --ignore-not-found --now -endif .PHONY: cleanup-tests cleanup-tests: diff --git a/scripts/collect_logs.sh b/scripts/collect_logs.sh new file mode 100755 index 000000000..794fbe95b --- /dev/null +++ b/scripts/collect_logs.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Collect logs from kube-arangodb operators + +NS=$1 +POSTFIX=$2 + +if [ -z $NS ]; then + echo "Specify a namespace argument" + exit 1 +fi +if [ -z $POSTFIX ]; then + echo "Specify a postfix argument" + exit 1 +fi + +mkdir -p ./logs +kubectl logs -n ${NS} --selector=name=arango-deployment-operator &> ./logs/deployment-${POSTFIX}.log +kubectl logs -n kube-system --selector=name=arango-storage-operator &> ./logs/storage-${POSTFIX}.log