Fixes #3573 -- archive the built docs in that builder (#3580)

* Fixes #3573 -- archive the built docs in that builder

* syntax

* try it without this

* I am an idiot

* this is unused

* uhh, let's try this

* maybe this?

* eh, html is the only thing

* ffffuuuu

* Ignore doctree

* broader exclude

* This works now
diff --git a/Jenkinsfile b/Jenkinsfile
index 3710b4c..7693d1a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -61,7 +61,14 @@
     [
         label: 'docker',
         imageName: 'pyca/cryptography-runner-ubuntu-rolling',
-        toxenvs: ['py27', 'py35', 'docs', 'pep8', 'py3pep8', 'randomorder'],
+        toxenvs: ['py27', 'py35', 'pep8', 'py3pep8', 'randomorder'],
+    ],
+    [
+        label: 'docker',
+        imageName: 'pyca/cryptography-runner-ubuntu-rolling',
+        toxenvs: ['docs'],
+        artifacts: 'cryptography/docs/_build/html/**',
+        artifactExcludes: '**/*.doctree',
     ],
     [
         label: 'docker',
@@ -156,7 +163,7 @@
         """
     }
 }
-def build(toxenv, label, imageName) {
+def build(toxenv, label, imageName, artifacts, artifactExcludes) {
     try {
         timeout(time: 30, unit: 'MINUTES') {
 
@@ -248,6 +255,9 @@
                                 bash <(curl -s https://codecov.io/bash) -e JOB_BASE_NAME,LABEL
                             """
                         }
+                        if (artifacts) {
+                            archiveArtifacts artifacts: artifacts, excludes: artifactExcludes
+                        }
                     }
                 }
             }
@@ -262,6 +272,8 @@
 for (config in configs) {
     def label = config["label"]
     def toxenvs = config["toxenvs"]
+    def artifacts = config["artifacts"]
+    def artifactExcludes = config["artifactExcludes"]
 
     for (_toxenv in toxenvs) {
         def toxenv = _toxenv
@@ -273,7 +285,7 @@
                 node(label) {
                     stage(combinedName) {
                         docker.image(imageName).inside {
-                            build(toxenv, label, imageName)
+                            build(toxenv, label, imageName, artifacts, artifactExcludes)
                         }
                     }
                 }
@@ -283,7 +295,7 @@
             builders[combinedName] = {
                 node(label) {
                     stage(combinedName) {
-                        build(toxenv, label, '')
+                        build(toxenv, label, '', null, null)
                     }
                 }
             }