Build and upload VOLTHA docs to docs.voltha.org
Change-Id: I5d9304e9a828f6c6dbdf1667f4d1ab6960401638
diff --git a/jjb/cord-macros.yaml b/jjb/cord-macros.yaml
index 668c2f7..2410b3c 100644
--- a/jjb/cord-macros.yaml
+++ b/jjb/cord-macros.yaml
@@ -160,3 +160,23 @@
- file-id: pipconf
target: '$HOME/.config/pip/pip.conf'
+# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
+# Name matches macro in ONOS JJB, for future unification
+- wrapper:
+ name: onf-infra-rsync-wrappers
+ wrappers:
+ - mask-passwords
+ - timeout:
+ type: absolute
+ timeout: '{build-timeout}'
+ timeout-var: 'BUILD_TIMEOUT'
+ fail: true
+ - timestamps
+ - ssh-agent-credentials:
+ users:
+ - '{jenkins-ssh-credential}'
+ - config-file-provider:
+ files:
+ - file-id: known_hosts
+ target: '$HOME/.ssh/known_hosts'
+
diff --git a/jjb/shell/sync-dir.sh b/jjb/shell/sync-dir.sh
new file mode 100644
index 0000000..d7f4218
--- /dev/null
+++ b/jjb/shell/sync-dir.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# sync-dir.sh - run build step then sync a directory to a remote server
+set -eu -o pipefail
+
+# when not running under Jenkins, use current dir as workspace, a blank project
+# name
+WORKSPACE=${WORKSPACE:-.}
+
+# run the build command
+$BUILD_COMMAND
+
+# sync the files to the target
+rsync -rvzh --delete-after --exclude=.git "$WORKSPACE/$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH"
diff --git a/jjb/templates/sync-dir.yaml b/jjb/templates/sync-dir.yaml
new file mode 100644
index 0000000..ef4db6a
--- /dev/null
+++ b/jjb/templates/sync-dir.yaml
@@ -0,0 +1,65 @@
+---
+# sync built directory to a remote server
+
+- job-template:
+ id: sync-dir
+ name: "sync-dir_{project}"
+ description: |
+ Created by {id} job-template from ci-management/jjb/templates/sync-dir.yaml
+ After merge run a build step then upload files to a directory remote server.
+
+ parameters:
+ - string:
+ name: BUILD_COMMAND
+ default: '{build-command}'
+ description: 'Name of the command to run to generate artifacts'
+
+ - string:
+ name: BUILD_OUTPUT_PATH
+ default: '{build-output-path}'
+ description: 'Path of files where build output is created by build command, relative to code checkout location'
+
+ - string:
+ name: SYNC_TARGET_SERVER
+ default: '{sync-target-server}'
+ description: 'Name of server where built files will be synced'
+
+ - string:
+ name: SYNC_TARGET_PATH
+ default: '{sync-target-path}'
+ description: 'Directory path on target server where the files will be synced'
+
+ triggers:
+ - cord-infra-gerrit-trigger-merge:
+ gerrit-server-name: '{gerrit-server-name}'
+ project-regexp: '^{project}$'
+ branch-regexp: '{branch-regexp}'
+ file-include-regexp: '{all-files-regexp}'
+ dependency-jobs: '{dependency-jobs}'
+
+ properties:
+ - cord-infra-properties:
+ build-days-to-keep: '{build-days-to-keep}'
+ artifact-num-to-keep: '{artifact-num-to-keep}'
+
+ wrappers:
+ - onf-infra-rsync-wrappers:
+ build-timeout: '{build-timeout}'
+ jenkins-ssh-credential: '{gerrit-ssh-credential}'
+
+ scm:
+ - lf-infra-gerrit-scm:
+ git-url: '$GIT_URL/$GERRIT_PROJECT'
+ refspec: '$GERRIT_REFSPEC'
+ branch: '$GERRIT_BRANCH'
+ submodule-recursive: 'false'
+ choosing-strategy: gerrit
+ jenkins-ssh-credential: '{gerrit-ssh-credential}'
+
+ node: '{build-node}'
+ project-type: freestyle
+ concurrent: true
+
+ builders:
+ - shell: !include-raw-escape: ../shell/sync-dir.sh
+
diff --git a/jjb/verify/voltha-docs.yaml b/jjb/verify/voltha-docs.yaml
new file mode 100644
index 0000000..cf3d4ac
--- /dev/null
+++ b/jjb/verify/voltha-docs.yaml
@@ -0,0 +1,32 @@
+---
+# verification jobs for 'voltha-docs' repo
+
+- project:
+ name: voltha-docs
+ project: '{name}'
+
+ jobs:
+ - 'verify-voltha-docs-jobs':
+ branch-regexp: '{supported-branches-regexp}'
+ - 'post-submit-voltha-docs-jobs':
+ branch-regexp: '{supported-branches-regexp}'
+
+- job-group:
+ name: 'verify-voltha-docs-jobs'
+ jobs:
+ - 'verify-licensed'
+ - 'tag-collision-reject'
+ - 'make-unit-test':
+ unit-test-targets: 'test'
+ unit-test-keep-going: 'true'
+ junit-allow-empty-results: true
+
+- job-group:
+ name: 'post-submit-voltha-docs-jobs'
+ jobs:
+ - 'sync-dir':
+ dependency-jobs: 'version-tag'
+ build-command: 'make html'
+ build-output-path: '_build/html/'
+ sync-target-server: 'guide.opencord.org'
+ sync-target-path: '/var/www/voltha-docs/'