Jenkins: Add timestamps wrapper

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Idfbf9ea149d664b5451b3a938fcc4e5d4e601485
diff --git a/jenkins/build-docs.jpl b/jenkins/build-docs.jpl
index 38b207f..a559eb8 100644
--- a/jenkins/build-docs.jpl
+++ b/jenkins/build-docs.jpl
@@ -9,84 +9,86 @@
 @Library('trustedfirmware') _
 import org.trustedfirmware.Gerrit
 
-node("docker-amd64-tf-m-bionic") {
-  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'
-          ]]
-        ])
+timestamps {
+  node("docker-amd64-tf-m-bionic") {
+    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") {
+        checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+      }
+      dir("mbedtls") {
+        checkout(
+          changelog: false,
+          poll: false,
+          scm: [
+            $class: 'GitSCM',
+            branches: [[name: 'FETCH_HEAD']],
+            userRemoteConfigs: [[
+              refspec: 'refs/tags/$MBEDTLS_VERSION',
+              url: params.MBEDTLS_URL
+            ]]
+          ]
+        )
+      }
+      dir("mcuboot") {
+        checkout(
+          changelog: false,
+          poll: false,
+          scm: [
+            $class: 'GitSCM',
+            branches: [[name: 'FETCH_HEAD']],
+            userRemoteConfigs: [[
+              refspec: '$MCUBOOT_REFSPEC',
+              url: params.MCUBOOT_URL
+            ]]
+          ]
+        )
+      }
+      dir("tf-m-tests") {
+        checkout(
+          changelog: false,
+          poll: false,
+          scm: [
+            $class: 'GitSCM',
+            branches: [[name: 'FETCH_HEAD']],
+            userRemoteConfigs: [[
+              refspec: '$TFM_TESTS_REFSPEC',
+              url: params.TFM_TESTS_URL
+            ]]
+          ]
+        )
+      }
     }
-    dir("tf-m-ci-scripts") {
-      checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
+    try {
+      verify = 1
+      stage("Build") {
+        sh "tf-m-ci-scripts/build-docs.sh"
+      }
+      stage("Post") {
+        archiveArtifacts 'trusted-firmware-m/build/docs/**'
+      }
+    } catch (Exception e) {
+      manager.buildFailure()
+      verify = -1
+    } finally {
+      g = new Gerrit()
+      g.verifyStatusInWorkspace(verify, 'tf-m-build-docs', 'build')
+      def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
+      //g.commentInWorkspace("Build docs ${buildStatus}: ${env.RUN_DISPLAY_URL}")
+      cleanWs()
     }
-    dir("mbedtls") {
-      checkout(
-        changelog: false,
-        poll: false,
-        scm: [
-          $class: 'GitSCM',
-          branches: [[name: 'FETCH_HEAD']],
-          userRemoteConfigs: [[
-            refspec: 'refs/tags/$MBEDTLS_VERSION',
-            url: params.MBEDTLS_URL
-          ]]
-        ]
-      )
-    }
-    dir("mcuboot") {
-      checkout(
-        changelog: false,
-        poll: false,
-        scm: [
-          $class: 'GitSCM',
-          branches: [[name: 'FETCH_HEAD']],
-          userRemoteConfigs: [[
-            refspec: '$MCUBOOT_REFSPEC',
-            url: params.MCUBOOT_URL
-          ]]
-        ]
-      )
-    }
-    dir("tf-m-tests") {
-      checkout(
-        changelog: false,
-        poll: false,
-        scm: [
-          $class: 'GitSCM',
-          branches: [[name: 'FETCH_HEAD']],
-          userRemoteConfigs: [[
-            refspec: '$TFM_TESTS_REFSPEC',
-            url: params.TFM_TESTS_URL
-          ]]
-        ]
-      )
-    }
-  }
-  try {
-    verify = 1
-    stage("Build") {
-      sh "tf-m-ci-scripts/build-docs.sh"
-    }
-    stage("Post") {
-      archiveArtifacts 'trusted-firmware-m/build/docs/**'
-    }
-  } catch (Exception e) {
-    manager.buildFailure()
-    verify = -1
-  } finally {
-    g = new Gerrit()
-    g.verifyStatusInWorkspace(verify, 'tf-m-build-docs', 'build')
-    def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
-    //g.commentInWorkspace("Build docs ${buildStatus}: ${env.RUN_DISPLAY_URL}")
-    cleanWs()
   }
 }