summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakala Venkata Krishna Rohit <rohitsakala@gmail.com>2017-07-05 13:47:24 +0530
committerMorgan Richomme <morgan.richomme@orange.com>2017-07-06 10:50:51 +0200
commit784093e7ff4bf2d85a5889e2ab1e9950ea859896 (patch)
tree4f619af26e3907f45ed6df71ddbf7cc78c9e376d
parent8f010075926791f8adf1e8a998c99d2718e9f0e4 (diff)
Push Functest API doc to artifact
Note that it is not the final goal The final goal is to integrate api doc into Functest developer guide This will be triggered from opnfvdocs and replace the current developer guide: http://docs.opnfv.org/en/stable-danube/submodules/functest/docs/testing/developer/devguide/index.html This patch allows to have an up-to-date api docs on the artifact after functest merge http://artifacts.opnfv.org/functest/docs/ Change-Id: I91256add29ce9eadd66764c2234da1d60981dd31 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com> Signed-off-by: Sakala Venkata Krishna Rohit <rohitsakala@gmail.com> Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--jjb/functest/functest-project-jobs.yml43
-rw-r--r--utils/upload-artifact.sh48
2 files changed, 91 insertions, 0 deletions
diff --git a/jjb/functest/functest-project-jobs.yml b/jjb/functest/functest-project-jobs.yml
index 7036f20c0..d9e94f056 100644
--- a/jjb/functest/functest-project-jobs.yml
+++ b/jjb/functest/functest-project-jobs.yml
@@ -9,6 +9,7 @@
jobs:
- 'functest-verify-{stream}'
+ - 'functest-docs-upload-{stream}'
stream:
- master:
@@ -80,6 +81,41 @@
unhealthy: 40
failing: 30
+- job-template:
+ name: 'functest-docs-upload-{stream}'
+
+ disabled: '{obj:disabled}'
+
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ branch: '{branch}'
+ - 'opnfv-build-ubuntu-defaults'
+
+ scm:
+ - git-scm
+
+ triggers:
+ - gerrit:
+ server-name: 'gerrit.opnfv.org'
+ trigger-on:
+ - change-merged-event
+ - comment-added-contains-event:
+ comment-contains-value: 'remerge'
+ projects:
+ - project-compare-type: 'ANT'
+ project-pattern: '{project}'
+ branches:
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**/{branch}'
+ disable-strict-forbidden-file-verification: 'true'
+ forbidden-file-paths:
+ - compare-type: ANT
+ pattern: 'docs/**|.gitignore'
+
+ builders:
+ - functest-upload-doc-artifact
+
################################
# job builders
################################
@@ -89,3 +125,10 @@
builders:
- shell: |
cd $WORKSPACE && tox
+
+- builder:
+ name: functest-upload-doc-artifact
+ builders:
+ - shell: |
+ cd $WORKSPACE && tox -edocs
+ wget -O - https://git.opnfv.org/releng/plain/utils/upload-artifact.sh | bash -s "functest/api/_build" "docs"
diff --git a/utils/upload-artifact.sh b/utils/upload-artifact.sh
new file mode 100644
index 000000000..b66cdb7e1
--- /dev/null
+++ b/utils/upload-artifact.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Orange and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -e
+set -o pipefail
+
+export PATH=$PATH:/usr/local/bin/
+
+# 2 paramters
+# - $1: the source directory where the files to be uploaded are located
+# - $2: the target on artifact http://artifact.opnfv.org/<project>/$2
+# if not set, default value is <project>/docs
+project=$PROJECT
+if [ -z "$2" ]
+ then
+ artifact_dir="$project/docs"
+ else
+ artifact_dir="$project/$2"
+fi
+DIRECTORY="$1"
+
+
+# check that the API doc directory does exist before pushing it to artifact
+if [ ! -d "$DIRECTORY" ]; then
+ echo "Directory to be uploaded "$DIRECTORY" does not exist"
+ exit 1
+fi
+set +e
+gsutil&>/dev/null
+if [ $? != 0 ]; then
+ echo "Not possible to push results to artifact: gsutil not installed"
+ exit 1
+else
+ gsutil ls gs://artifacts.opnfv.org/"$project"/ &>/dev/null
+ if [ $? != 0 ]; then
+ echo "Not possible to push results to artifact: gsutil not installed."
+ exit 1
+ else
+ echo "Uploading file(s) to artifact $artifact_dir"
+ gsutil -m cp -r "$DIRECTORY"/* gs://artifacts.opnfv.org/"$artifact_dir"/ >/dev/null 2>&1
+ fi
+fi