summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-07-07 08:44:15 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-07 08:44:15 +0000
commit26f55bef14c2fec7a0422bc757517b115b7870c8 (patch)
tree5a131c26b46e31bf5705657b4b853667a5818379 /utils
parent7da23259c30038ff2f69c36b2c7117e2d69820f1 (diff)
parent784093e7ff4bf2d85a5889e2ab1e9950ea859896 (diff)
Merge "Push Functest API doc to artifact"
Diffstat (limited to 'utils')
-rw-r--r--utils/upload-artifact.sh48
1 files changed, 48 insertions, 0 deletions
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