jenkins/: Use tfgit.checkout_ci_scripts()

Consistently use single function for clone tf-m-ci-scripts repo with
parameters defined by job (e.g. specifying a change reference to fetch).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I76eb4c6c31633b98489f82d29015c7d9486418ff
diff --git a/jenkins/build-config.jpl b/jenkins/build-config.jpl
index 9cb2175..15eff68 100644
--- a/jenkins/build-config.jpl
+++ b/jenkins/build-config.jpl
@@ -22,7 +22,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         sh "git rev-parse --short HEAD"
         // Clone TF-M repositories so share folder can be reused by downstream jobs
         sh "./clone.sh"
diff --git a/jenkins/build-docs.jpl b/jenkins/build-docs.jpl
index 7a2a969..59baf8b 100644
--- a/jenkins/build-docs.jpl
+++ b/jenkins/build-docs.jpl
@@ -14,7 +14,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         // Clone TF-M repositories so share folder can be reused by downstream jobs
         sh "./clone.sh"
       }
diff --git a/jenkins/checkpatch.jpl b/jenkins/checkpatch.jpl
index ecc3507..2aa18f0 100644
--- a/jenkins/checkpatch.jpl
+++ b/jenkins/checkpatch.jpl
@@ -15,7 +15,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         sh "./clone.sh"
       }
     }
diff --git a/jenkins/ci.jpl b/jenkins/ci.jpl
index 0da1e27..55bb6bf 100644
--- a/jenkins/ci.jpl
+++ b/jenkins/ci.jpl
@@ -327,7 +327,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         sh "git rev-parse --short HEAD"
         // Clone TF-M repositories so share folder can be reused by downstream jobs
         sh "./clone.sh"
@@ -379,7 +379,7 @@
 
     stage("Tests") {
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         withCredentials([string(credentialsId: 'TUXSUITE_TOKEN', variable: 'TUXSUITE_TOKEN')]) {
           sh "jenkins/tuxsuite-setup.sh"
         }
diff --git a/jenkins/cppcheck.jpl b/jenkins/cppcheck.jpl
index 46e6956..632c60f 100644
--- a/jenkins/cppcheck.jpl
+++ b/jenkins/cppcheck.jpl
@@ -15,7 +15,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         sh "./clone.sh"
       }
     }
diff --git a/jenkins/lava-submit.jpl b/jenkins/lava-submit.jpl
index 631a6c8..5103d31 100644
--- a/jenkins/lava-submit.jpl
+++ b/jenkins/lava-submit.jpl
@@ -6,6 +6,9 @@
 //
 //-------------------------------------------------------------------------------
 
+@Library('trustedfirmware') _
+
+
 @NonCPS
 def isPerPatchJob() {
   def upstream_job = manager.build.getAction(hudson.model.CauseAction.class).getCauses()[0]
@@ -64,7 +67,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         withCredentials([string(credentialsId: 'TUXSUITE_TOKEN', variable: 'TUXSUITE_TOKEN')]) {
           sh "jenkins/tuxsuite-setup.sh"
         }
diff --git a/jenkins/static-checks.jpl b/jenkins/static-checks.jpl
index 0e32c5c..217e057 100644
--- a/jenkins/static-checks.jpl
+++ b/jenkins/static-checks.jpl
@@ -14,7 +14,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         // Clone TF-M repositories so share folder can be reused by downstream jobs
         sh "./clone.sh"
       }
diff --git a/jenkins/static.jpl b/jenkins/static.jpl
index 10b477b..443ea27 100644
--- a/jenkins/static.jpl
+++ b/jenkins/static.jpl
@@ -6,6 +6,8 @@
 //
 //-------------------------------------------------------------------------------
 
+@Library('trustedfirmware') _
+
 
 def trigger(job_name) {
   return {
@@ -39,7 +41,7 @@
     stage("Init") {
       cleanWs()
       dir("tf-m-ci-scripts") {
-        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+        tfgit.checkout_ci_scripts()
         // Clone TF-M repositories so share folder can be reused by downstream jobs
         sh "./clone.sh"
       }