Copy build-docs artifacts to build-and-test job

Copy the built documentation from the build-docs job into the upstream
build-and-test job.

Change-Id: Iefee59a3654d97a7748ea060aa849af74f000790
diff --git a/jenkins/ci.jpl b/jenkins/ci.jpl
index 8744842..cb5f990 100644
--- a/jenkins/ci.jpl
+++ b/jenkins/ci.jpl
@@ -74,7 +74,7 @@
   }
 }
 
-def buildDocs() {
+def buildDocs(results) {
   def params = []
   params += string(name: 'GERRIT_BRANCH', value: env.GERRIT_BRANCH)
   params += string(name: 'GERRIT_HOST', value: env.GERRIT_HOST)
@@ -84,9 +84,10 @@
   params += string(name: 'CMSIS_VERSION', value: env.CMSIS_VERSION)
   params += string(name: 'MBEDCRYPTO_VERSION', value: env.MBEDCRYPTO_VERSION)
   params += string(name: 'CODE_REPO', value: env.CODE_REPO)
-  return {
+  return { -> results
     def res = build(job: 'tf-m-build-docs', parameters: params, propagate:false)
     print("${res.number}: Docs ${res.result} ${res.getAbsoluteUrl()}")
+    results['docs'] = [res.number, res.result, params]
     if (res.result in ["FAILURE", "ABORTED", "UNSTABLE", "NOT_BUILT"]) {
       error("Build failed at ${res.getAbsoluteUrl()}")
     }
@@ -160,7 +161,7 @@
     for (config in configs) {
       builds[config] = buildConfig("tf-m-ci-scripts", config, env.FILTER_GROUP, results)
     }
-    builds["docs"] = buildDocs()
+    builds["docs"] = buildDocs(results)
   }
 }
 stage("Builds") {
@@ -180,7 +181,14 @@
     writeSummary(results['builds'])
   }
 }
+
 node("docker-amd64-xenial") {
+  stage("Copy Docs") {
+    step([$class: 'CopyArtifact', projectName: 'tf-m-build-docs',
+    selector: specific("${results['docs'][0]}"), target: './docs/',
+    optional: true])
+    archiveArtifacts artifacts: 'docs/**', allowEmptyArchive: true
+  }
   stage("Tests") {
     dir("tf-m-ci-scripts") {
       git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY'