New simpler pipeline

Adding basic script to generate combinations of builds in python.
Probably can use some existing script for this, but this was simpler to
get working with pipeline.

Pipeline to query the python script for build configuration names,
obtain parameters for them, then trigger downstream jobs for them. Does
not yet run any LAVA tests.

Also putting build commands into this repository instead of just being
in the job. This makes it far easier to reproduce what would be run in
Jenkins.

Change-Id: Ie1a7431eb38191e7fcd23edebd284537878e2dde
Signed-off-by: Dean Birch <dean.birch@arm.com>
diff --git a/jenkins/cppcheck.jpl b/jenkins/cppcheck.jpl
new file mode 100644
index 0000000..eacdc3a
--- /dev/null
+++ b/jenkins/cppcheck.jpl
@@ -0,0 +1,83 @@
+#!/usr/bin/env groovy
+//-------------------------------------------------------------------------------
+// Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-3-Clause
+//
+//-------------------------------------------------------------------------------
+
+def verifyStatus(value, stage_name) {
+  withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'VERIFY_PASSWORD', usernameVariable: 'VERIFY_USER')]) {
+    sh """
+if [ -z "\$GERRIT_HOST" ] ; then
+  echo Not running for a Gerrit change, skipping vote.
+  exit 0
+fi
+if [ ! -d venv ] ; then
+  virtualenv -p \$(which python3) venv
+fi
+. venv/bin/activate
+pip -q install requests
+./tf-m-ci-scripts/jenkins/verify.py --value ${value} --verify-name tf-m-${stage_name} --user \$VERIFY_USER
+"""
+  }
+}
+
+node("docker-amd64-xenial") {
+  stage("Init") {
+    cleanWs()
+    dir("trusted-firmware-m") {
+      checkout(
+        poll: false,
+        scm: [
+          $class: 'GitSCM',
+          branches: [[name: '$GERRIT_BRANCH']],
+          extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]],
+          userRemoteConfigs: [[
+            credentialsId: 'GIT_SSH_KEY',
+            refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO'
+          ]]
+        ])
+    }
+    dir("tf-m-ci-scripts") {
+      git url: '$CI_SCRIPTS_REPO', branch: 'master', credentialsId: 'GIT_SSH_KEY'
+    }
+    dir("mbed-crypto") {
+      checkout(
+        changelog: false,
+        poll: false,
+        scm: [
+          $class: 'GitSCM',
+          branches: [[name: 'FETCH_HEAD']], 
+          userRemoteConfigs: [[
+            refspec: 'refs/tags/$MBEDCRYPTO_VERSION',
+            url: 'https://github.com/ARMmbed/mbed-crypto.git'
+          ]]
+        ]
+      )
+    }
+    sh """
+wget -O cmsis.pack -q https://github.com/ARM-software/CMSIS_5/releases/download/${CMSIS_VERSION}/ARM.CMSIS.${CMSIS_VERSION}.pack
+unzip -o -d CMSIS_5 cmsis.pack
+"""
+  }
+  stage("Check") {
+    def verify = 1
+    try {
+      sh """
+cd trusted-firmware-m
+export GIT_REF_ARG=""
+if [ ! -z "\$GERRIT_PATCHSET_REVISION" ] ; then
+  export GIT_REF_ARG="HEAD"
+fi
+../tf-m-ci-scripts/run-cppcheck.sh -r \$GIT_REF_ARG
+"""
+    } catch (Exception e) {
+      manager.buildFailure()
+      verify = -1
+    } finally {
+      verifyStatus(verify, 'cppcheck')
+      cleanWs()
+    }
+  }
+}