Generate sphinx docs and print info about stack

Change-Id: Id76d54e345500573ee512cb5259f02e7c317410c
diff --git a/cicd-lab-pipeline.groovy b/cicd-lab-pipeline.groovy
index b4f4c75..6d72978 100644
--- a/cicd-lab-pipeline.groovy
+++ b/cicd-lab-pipeline.groovy
@@ -163,6 +163,38 @@
                 salt.enforceState(saltMaster, 'I@docker:swarm:role:master', 'jenkins', true)
             }
         }
+
+        stage("Finalize") {
+            //
+            // Generate docs
+            //
+            try {
+                retry(3) {
+                    salt.runSaltProcessStep(saltMaster, '*', 'state.orchestrate', ['sphinx.orch.generate_doc'])
+                }
+            } catch (Throwable e) {
+                // We don't want sphinx docs to ruin whole build, so possible
+                // errors are just ignored here
+                true
+            }
+            salt.enforceState(saltMaster, 'I@nginx:server', 'nginx')
+
+            if (HEAT_STACK_DELETE != 'true') {
+                println "============================================================"
+                println "Your CI/CD lab has been deployed and you can enjoy it:"
+                println "   Use sshuttle -r ubuntu@${saltMasterHost} 172.16.10.0/24"
+                println "   to connect to your private subnet and visit services
+                println "   running at 172.16.10.254 (vip address):
+                println "       9600    haproxy stats"
+                println "       8080    gerrit"
+                println "       8081    jenkins"
+                println "       8091    Docker swarm visualizer"
+                println "       8090    Reclass-generated documentation"
+                println ""
+                println "Don't forget to terminate your stack when you don't needed!"
+                println "============================================================"
+            }
+        }
     } catch (Throwable e) {
         // If there was an error or exception thrown, the build failed
         currentBuild.result = "FAILURE"