Fixes to documentation rsync copy job

Change-Id: I1644624a2ef950d9c9f92258bd8dda074c37de16
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
+