aboutsummaryrefslogtreecommitdiffstats
path: root/htmlize/push-doc-artifact.sh
blob: 5e8e10e34c7354d874128b273f331e634e74a7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
##############################################################################
# Copyright (c) 2019 opnfv.
#
# 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/

project=$PROJECT
workspace=$WORKSPACE
artifact_dir="$project/docs"

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 document to artifact $artifact_dir"
        gsutil cp "$workspace"/index.html gs://artifacts.opnfv.org/"$artifact_dir"/testapi.html >/dev/null 2>&1
        echo "Document can be found at http://artifacts.opnfv.org/releng/docs/testapi.html"
    fi
fi