From b2319762a2b0ed594b28748ea90264df376daca5 Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Thu, 5 Apr 2018 09:09:43 +0200 Subject: [PATCH 1/4] Archive log files --- Jenkinsfile.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 083e02564..e1e816434 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -101,6 +101,9 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) { "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", ]) { + sh "mkdir -p logs" + sh "kubectl logs -n ${env.DEPLOYMENTNAMESPACE} --selector=name=arango-deployment-operator > ./logs/deployment-${kubeconfig}.log" + archive includes: 'logs/*' sh "make cleanup-tests" } } From 00bde593563d3e1e74329f3155a907ed238e24d3 Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Thu, 5 Apr 2018 09:40:27 +0200 Subject: [PATCH 2/4] Ignore errors in `kubelet logs` --- Jenkinsfile.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index e1e816434..63b1f6948 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -102,7 +102,8 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) { "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", ]) { sh "mkdir -p logs" - sh "kubectl logs -n ${env.DEPLOYMENTNAMESPACE} --selector=name=arango-deployment-operator > ./logs/deployment-${kubeconfig}.log" + sh returnStatus: true, script:"kubectl logs -n ${env.DEPLOYMENTNAMESPACE} --selector=name=arango-deployment-operator > ./logs/deployment-${kubeconfig}.log" + sh returnStatus: true, script:"kubectl logs -n kube-system --selector=name=arango-storage-operator > ./logs/storage-${kubeconfig}.log" archive includes: 'logs/*' sh "make cleanup-tests" } From 01e164914b3b4a963ea37c71e5203e40a0b1017f Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Thu, 5 Apr 2018 09:58:42 +0200 Subject: [PATCH 3/4] Collecting logs in script --- .gitignore | 2 +- Jenkinsfile.groovy | 4 +--- scripts/collect_logs.sh | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100755 scripts/collect_logs.sh 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 63b1f6948..599673891 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -101,9 +101,7 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) { "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", ]) { - sh "mkdir -p logs" - sh returnStatus: true, script:"kubectl logs -n ${env.DEPLOYMENTNAMESPACE} --selector=name=arango-deployment-operator > ./logs/deployment-${kubeconfig}.log" - sh returnStatus: true, script:"kubectl logs -n kube-system --selector=name=arango-storage-operator > ./logs/storage-${kubeconfig}.log" + sh "./scripts/collect_logs.sh ${env.DEPLOYMENTNAMESPACE} ${kubeconfig}" archive includes: 'logs/*' sh "make 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 From bea1b0fd2dc9f9bc08183131a4808514b2b4700a Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Thu, 5 Apr 2018 10:15:04 +0200 Subject: [PATCH 4/4] Only remove namespace in cleanup phase --- Makefile | 3 --- 1 file changed, 3 deletions(-) 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: