SQUAD : Adding a memory footprint gathering script launched from ci

This patch sets up the TFM memory footprint tracking using SQUAD and CI.
A python script is launched by the ci build-config pipeline if it has
been started by a nightly build. This python script sends bl2.axf and
tfm_s.axf sizes to a SQUAD interface.

Signed-off-by: Hugo L'Hostis <hugo.lhostis@arm.com>
Change-Id: I17f8efffb3f4398a2991b8c9e387d712b981403f
diff --git a/jenkins/build-config.jpl b/jenkins/build-config.jpl
index 21e7ea0..665f939 100644
--- a/jenkins/build-config.jpl
+++ b/jenkins/build-config.jpl
@@ -1,6 +1,6 @@
 #!/usr/bin/env groovy
 //-------------------------------------------------------------------------------
-// Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+// Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
 //
 // SPDX-License-Identifier: BSD-3-Clause
 //
@@ -100,6 +100,16 @@
     stage("Post") {
       archiveArtifacts 'trusted-firmware-m/build/bin/**'
       archiveArtifacts 'trusted-firmware-m/build/install/interface/**'
+      if (env.SQUAD_CONFIGURATIONS != ""){
+        //Creating a folder to store memory footprint artifacts and launching the memory footprint script.
+        sh "mkdir tf-m-ci-scripts/Memory_footprint/"
+        withCredentials([string(credentialsId: 'QA_REPORTS_TOKEN', variable: 'TOKEN')]) {
+          sh(script: "python3 tf-m-ci-scripts/memory_footprint.py ${env.WORKSPACE}/trusted-firmware-m/ ${env.CONFIG_NAME} \'${env.SQUAD_CONFIGURATIONS}\' ${TOKEN}", returnStdout: true)
+        }
+        if (fileExists('tf-m-ci-scripts/Memory_footprint/filesize.json')) {
+          archiveArtifacts 'tf-m-ci-scripts/Memory_footprint/filesize.json'
+        }
+      }
     }
   } catch (Exception e) {
     manager.buildFailure()