Skip to content

Commit 01e1649

Browse files
committed
Collecting logs in script
1 parent 00bde59 commit 01e1649

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.DS_Store
22
.gobuild
33
bin
4-
4+
logs

Jenkinsfile.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
101101
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
102102
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
103103
]) {
104-
sh "mkdir -p logs"
105-
sh returnStatus: true, script:"kubectl logs -n ${env.DEPLOYMENTNAMESPACE} --selector=name=arango-deployment-operator > ./logs/deployment-${kubeconfig}.log"
106-
sh returnStatus: true, script:"kubectl logs -n kube-system --selector=name=arango-storage-operator > ./logs/storage-${kubeconfig}.log"
104+
sh "./scripts/collect_logs.sh ${env.DEPLOYMENTNAMESPACE} ${kubeconfig}"
107105
archive includes: 'logs/*'
108106
sh "make cleanup-tests"
109107
}

scripts/collect_logs.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Collect logs from kube-arangodb operators
4+
5+
NS=$1
6+
POSTFIX=$2
7+
8+
if [ -z $NS ]; then
9+
echo "Specify a namespace argument"
10+
exit 1
11+
fi
12+
if [ -z $POSTFIX ]; then
13+
echo "Specify a postfix argument"
14+
exit 1
15+
fi
16+
17+
mkdir -p ./logs
18+
kubectl logs -n ${NS} --selector=name=arango-deployment-operator &> ./logs/deployment-${POSTFIX}.log
19+
kubectl logs -n kube-system --selector=name=arango-storage-operator &> ./logs/storage-${POSTFIX}.log

0 commit comments

Comments
 (0)