Extra Build: Check build result before skipping LAVA submit

Build result needs to be checked first so that error could be thrown
to notify Jenkins about the failure.

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I99cdd982a8f56570a75c2d89242e3aa163696170
diff --git a/jenkins/ci.jpl b/jenkins/ci.jpl
index f2e897d..12b1860 100644
--- a/jenkins/ci.jpl
+++ b/jenkins/ci.jpl
@@ -213,17 +213,17 @@
 
     // Filter out configs do not need LAVA tests
 
-    // Job tf-m-extra-build does not need LAVA tests
-    if (env.JOB_NAME.equals("tf-m-extra-build")) {
-      print("LAVA is not needed in tf-m-extra-build job.")
-    }
     // Configs with build failure do not need LAVA tests
-    else if (build_res.result in failure_states) {
+    if (build_res.result in failure_states) {
       error("Build failed at ${build_url}")
     } else {
         // Build successful
+        // Job tf-m-extra-build does not need LAVA tests
+        if (env.JOB_NAME.equals("tf-m-extra-build")) {
+          print("LAVA is not needed in tf-m-extra-build job.")
+        }
         // Submit test job for NXP LPCXpresso55S69 & Cypress PSoC64
-        if (params_collection["TFM_PLATFORM"].contains("lpcxpresso55s69") || params_collection["TFM_PLATFORM"].contains("psoc64")) {
+        else if (params_collection["TFM_PLATFORM"].contains("lpcxpresso55s69") || params_collection["TFM_PLATFORM"].contains("psoc64")) {
           submit_lava_tests(config, results, build_res, params, params_collection)
         } else {
             // Configs without BL2 do not need LAVA tests