Update stage3 to archive logs from Airflow DAGs 31/13431/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Sun, 21 May 2023 22:47:42 +0000 (00:47 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 22 May 2023 09:12:23 +0000 (11:12 +0200)
Change-Id: I99b6d6b9afe94135be8909c7aa96866615532389
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
jenkins/ci-pipelines/ci_stage_3.groovy

index 0b9cf8b..29e438a 100644 (file)
@@ -124,13 +124,13 @@ void run_robot_systest(String tagName,
 
 void archive_logs(Map remote) {
 
-    sshCommand remote: remote, command: '''mkdir -p logs'''
+    sshCommand remote: remote, command: '''mkdir -p logs/dags'''
     if (useCharmedInstaller) {
         sshCommand remote: remote, command: '''
-            for container in `kubectl get pods -n osm | grep -v operator | grep -v NAME| awk '{print $1}'`; do
-                logfile=`echo $container | cut -d- -f1`
+            for pod in `kubectl get pods -n osm | grep -v operator | grep -v NAME| awk '{print $1}'`; do
+                logfile=`echo $pod | cut -d- -f1`
                 echo "Extracting log for $logfile"
-                kubectl logs -n osm $container --timestamps=true 2>&1 > logs/$logfile.log
+                kubectl logs -n osm $pod --timestamps=true 2>&1 > logs/$logfile.log
             done
         '''
     } else {
@@ -148,6 +148,11 @@ void archive_logs(Map remote) {
                 > logs/$statefulset.log
             done
         '''
+        sshCommand remote: remote, command: '''
+            schedulerPod="$(kubectl get pods -n osm | grep airflow-scheduler| awk '{print $1; exit}')"; \
+            echo "Extracting logs from Airflow DAGs from pod ${schedulerPod}"; \
+            kubectl cp -n osm ${schedulerPod}:/opt/airflow/logs/scheduler/latest/dags logs/dags -c scheduler
+        '''
     }
 
     sh 'rm -rf logs'