archiving kube pod logs during post execution

Change-Id: I699ed6ad1687d7b72e70f5c6c0b16fe291ce36ed
diff --git a/jjb/pipeline/all-xos-api-test-helm.groovy b/jjb/pipeline/all-xos-api-test-helm.groovy
index 5359312..bfba93f 100644
--- a/jjb/pipeline/all-xos-api-test-helm.groovy
+++ b/jjb/pipeline/all-xos-api-test-helm.groovy
@@ -341,6 +341,11 @@
   post {
     always {
       sh '''
+         for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+         do
+           kubectl logs \$pod > $WORKSPACE/\$pod.log;
+         done
+
          kubectl get pods --all-namespaces
 
          echo "# removing helm deployments"
@@ -355,6 +360,7 @@
 
          sudo minikube delete
          '''
+         archiveArtifacts artifacts: '*.log'
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "suchitra@opennetworking.org, you@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
     }
   }
diff --git a/jjb/pipeline/chart-api-test-helm.groovy b/jjb/pipeline/chart-api-test-helm.groovy
index 627910c..e3a5d73 100644
--- a/jjb/pipeline/chart-api-test-helm.groovy
+++ b/jjb/pipeline/chart-api-test-helm.groovy
@@ -269,6 +269,11 @@
   post {
     always {
       sh '''
+         for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+         do
+           kubectl logs \$pod > $WORKSPACE/\$pod.log;
+         done
+
          kubectl get pods --all-namespaces
 
          echo "# removing helm deployments"
@@ -283,6 +288,7 @@
 
          sudo minikube delete
          '''
+         archiveArtifacts artifacts: '*.log'
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "suchitra@opennetworking.org, you@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
     }
   }
diff --git a/jjb/pipeline/xos-synchronizer-update.groovy b/jjb/pipeline/xos-synchronizer-update.groovy
index da4c4c7..4a3d5e8 100644
--- a/jjb/pipeline/xos-synchronizer-update.groovy
+++ b/jjb/pipeline/xos-synchronizer-update.groovy
@@ -387,6 +387,11 @@
   post {
     always {
       sh '''
+         for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+         do
+           kubectl logs \$pod > $WORKSPACE/\$pod.log;
+         done
+
          kubectl get pods --all-namespaces
 
          echo "# removing helm deployments"
@@ -401,6 +406,7 @@
 
          sudo minikube delete
          '''
+         archiveArtifacts artifacts: '*.log'
          step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "suchitra@opennetworking.org, you@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
     }
   }