Various CI fixes

* Output CSV on build stage
* Check more failure states in pipeline
* Allow configs.py to use multiple groups
* Add build log as artifact
* Add links to particular build configs
* Host CMSIS_5 pack file internally
* Adding mbedcrypto url as a param
* Move the LAVA job generation into a new jenkins job
* Make job_ids strings for adding to job description

Change-Id: I801a1a5d15a7f55e25477ad371e8ec59eb14fd7f
Signed-off-by: Dean Birch <dean.birch@arm.com>
diff --git a/jenkins/lava-submit.jpl b/jenkins/lava-submit.jpl
new file mode 100644
index 0000000..fbb8611
--- /dev/null
+++ b/jenkins/lava-submit.jpl
@@ -0,0 +1,43 @@
+#!/usr/bin/env groovy
+//-------------------------------------------------------------------------------
+// Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-3-Clause
+//
+//-------------------------------------------------------------------------------
+
+node("docker-amd64-xenial") {
+  stage("Init") {
+    cleanWs()
+    dir("tf-m-ci-scripts") {
+      git url: '$CI_SCRIPTS_REPO', branch: 'master', credentialsId: 'GIT_SSH_KEY'
+    }
+  }
+  stage("LAVA") {
+    withCredentials([usernamePassword(credentialsId: 'LAVA_CREDENTIALS', passwordVariable: 'LAVA_TOKEN', usernameVariable: 'LAVA_USER')]) {
+      print("Generating LAVA jobs...")
+      def bl2_string = ""
+      if (env.BL2.equals("True")) {
+        bl2_string = "--bl2"
+      }
+      dir("tf-m-ci-scripts") {
+        def res = sh(script: """./lava_helper/lava_create_jobs.py \
+--build-number ${env.BUILD_NUMBER} --output-dir lava_jobs \
+--compiler ${env.COMPILER} --platform ${env.TARGET_PLATFORM} \
+${bl2_string} --build-type ${env.CMAKE_BUILD_TYPE} \
+--jenkins-build-url ${env.BUILD_URL} --proj-config ${env.PROJ_CONFIG}
+""", returnStdout: true).trim()
+        print(res)
+        job_ids = sh(script: """./lava_helper/lava_submit_jobs.py \
+  --lava-url https://tf.validation.linaro.org --job-dir lava_jobs \
+  --lava-user ${LAVA_USER} --lava-token ${LAVA_TOKEN}
+  """, returnStdout: true).trim()
+        currentBuild.setDescription(job_ids)
+      }
+    }
+  }
+  stage("Post") {
+    archiveArtifacts artifacts: 'tf-m-ci-scripts/lava_jobs/**', allowEmptyArchive: true
+    cleanWs()
+  }
+}