Fixes to documentation rsync copy job

Change-Id: I1644624a2ef950d9c9f92258bd8dda074c37de16
diff --git a/jjb/charts.yaml b/jjb/charts.yaml
index b4f0590..63444cd 100644
--- a/jjb/charts.yaml
+++ b/jjb/charts.yaml
@@ -50,7 +50,17 @@
 
     builders:
       - shell: |
+          #!/usr/bin/env bash
+
+          # Set up the ssh host keys for the docs host
+          mkdir -p ~/.ssh
+          echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
+
+          # Setup and build the helm repo
           helm init --client-only
           helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
           ./scripts/helmrepo.sh
+
+          # Copy repo to host
           rsync -rvzh --delete chart_repo/ {docs-ssh-host}:/var/www/charts/$GERRIT_BRANCH
+
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index bebda2a..294050b 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -50,3 +50,5 @@
 
     # Jenkins SSH host doc publisher
     docs-ssh-host: 'guide.opencord.org'
+    docs-ssh-host-key: 'guide.opencord.org,52.9.82.207 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFHwOY3/8GucdKzBngH/FC08nHac/RJ/OheZp2+5EpOPXZG9zQW2YUbXH5A9pO76lI5CG3z3+huG62xEGo99UQU='
+
diff --git a/jjb/docs-legacy.yaml b/jjb/docs-legacy.yaml
index c8875ca..0884557 100644
--- a/jjb/docs-legacy.yaml
+++ b/jjb/docs-legacy.yaml
@@ -93,7 +93,17 @@
 
     builders:
       - shell: |
-          cd cord/build/docs
+          #!/usr/bin/env bash
+
+          # Set up the ssh host keys for the docs host
+          mkdir -p ~/.ssh
+          echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
+
+          # build the docs
+          cd cord/docs
           make build
-          rsync -rvzh --delete cord/docs/_book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
-          rsync -rvzh --delete cord/docs/xos/swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
+
+          # copy swagger REST API docs first, then exclude deleting them when copying rest of guide
+          rsync -rvzh --delete _book/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH
+          rsync -rvzh --delete xos/swagger/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH/swagger
+
diff --git a/jjb/docs.yaml b/jjb/docs.yaml
index 4cbe987..6fa17bd 100644
--- a/jjb/docs.yaml
+++ b/jjb/docs.yaml
@@ -51,7 +51,6 @@
               file-paths:
                 - compare-type: REG_EXP
                   pattern: '{doc-files-regexp}'
-              file-paths:
                 - compare-type: REG_EXP
                   pattern: '.*\.md'
 
@@ -113,6 +112,8 @@
               file-paths:
                 - compare-type: REG_EXP
                   pattern: '{doc-files-regexp}'
+                - compare-type: REG_EXP
+                  pattern: '.*\.md'
 
     properties:
       - cord-infra-properties:
@@ -136,7 +137,17 @@
 
     builders:
       - shell: |
+          #!/usr/bin/env bash
+
+          # Set up the ssh host keys for the docs host
+          mkdir -p ~/.ssh
+          echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
+
+          # build the docs
           cd cord/docs
           make build
-          rsync -rvzh --delete cord/docs/_book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
-          rsync -rvzh --delete cord/docs/xos/swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
+
+          # copy swagger REST API docs first, then exclude deleting them when copying rest of guide
+          rsync -rvzh --delete _book/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH
+          rsync -rvzh --delete xos/swagger/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH/swagger
+