blob: 891e57a7b0bbf7e03dc5e0601541096f36fe3126 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/bash
# Copyright (c) 2022 Cisco and/or its affiliates.
# 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.
echo "---> publish_docs.sh"
set -exuo pipefail
if [[ "${SILO}" != "production" ]] ; then
echo "WARNING: Doc upload not supported on Jenkins '${SILO}'..."
exit 0
fi
CDN_URL="s3-docs.fd.io"
if [[ ${JOB_NAME} == *merge* ]]; then
case "${JOB_NAME}" in
*"csit-trending"*)
workspace_dir="${WORKSPACE}/resources/tools/presentation/_build"
bucket_path="/csit/${GERRIT_BRANCH}/trending/"
;;
*"csit-report"*)
workspace_dir="${WORKSPACE}/resources/tools/presentation/_build"
bucket_path="/csit/${GERRIT_BRANCH}/report/"
;;
*"csit-docs"*)
workspace_dir="${WORKSPACE}/resources/tools/doc_gen/_build"
bucket_path="/csit/${GERRIT_BRANCH}/docs/"
;;
*"hicn-docs"*)
hicn_release="$(git describe --long --match "v*" | cut -d- -f1 | sed -e 's/^v//')"
workspace_dir="${WORKSPACE}/build/doc/deploy-site"
bucket_path="/hicn/${hicn_release}/"
;;
*"vpp-docs"*)
vpp_release="$(${WORKSPACE}/build-root/scripts/version rpm-version)"
workspace_dir="${WORKSPACE}/build-root/docs/html"
bucket_path="/vpp/${vpp_release}/"
;;
*)
die "Unknown job: ${JOB_NAME}"
esac
export TF_VAR_workspace_dir=$workspace_dir
export TF_VAR_bucket_path=$bucket_path
export AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials
export AWS_DEFAULT_REGION="us-east-1"
echo "INFO: archiving docs to S3"
pushd ..
terraform init -no-color
terraform apply -no-color -auto-approve
popd
echo "S3 docs: <a href=\"https://${CDN_URL}${bucket_path}\">https://${CDN_URL}${bucket_path}</a>"
fi
|