blob: bae4b015ed8d3c599d57fb8ff38252e56ced60d4 [file] [log] [blame]
Lusheng Ji487c0cc2017-08-22 21:44:29 -07001#!/bin/bash
2
Hansen, Tony (th1395)663df2c2023-05-23 21:27:17 +00003# ===========LICENSE_START========================================================
Lusheng Ji16948022017-09-11 23:38:09 +00004# ================================================================================
5# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
6# ================================================================================
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ============LICENSE_END=========================================================
19#
20# ECOMP is a trademark and service mark of AT&T Intellectual Property.
21
22set -ex
23
24
Lusheng Ji487c0cc2017-08-22 21:44:29 -070025echo "running script: [$0] for module [$1] at stage [$2]"
26
Lusheng Ji16948022017-09-11 23:38:09 +000027MVN_PROJECT_MODULEID="$1"
28MVN_PHASE="$2"
Lusheng Ji16948022017-09-11 23:38:09 +000029PROJECT_ROOT=$(dirname $0)
30
Lusheng Ji16948022017-09-11 23:38:09 +000031# expected environment variables
Lusheng Ji487c0cc2017-08-22 21:44:29 -070032if [ -z "${MVN_NEXUSPROXY}" ]; then
33 echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
Lusheng Jieab16752017-09-19 18:39:04 +000034 exit 1
Lusheng Ji487c0cc2017-08-22 21:44:29 -070035fi
Lusheng Ji16948022017-09-11 23:38:09 +000036if [ -z "$SETTINGS_FILE" ]; then
37 echo "SETTINGS_FILE environment variable not set. Cannot proceed"
Lusheng Jieab16752017-09-19 18:39:04 +000038 exit 2
Lusheng Ji16948022017-09-11 23:38:09 +000039fi
Lusheng Ji487c0cc2017-08-22 21:44:29 -070040
41
Lusheng Ji16948022017-09-11 23:38:09 +000042
43
44source "${PROJECT_ROOT}"/mvn-phase-lib.sh
45
46
47# Customize the section below for each project
Lusheng Ji487c0cc2017-08-22 21:44:29 -070048case $MVN_PHASE in
49clean)
50 echo "==> clean phase script"
Lusheng Ji16948022017-09-11 23:38:09 +000051 clean_templated_files
52 clean_tox_files
53 rm -rf ./venv-* ./*.wgn ./site
Lusheng Ji487c0cc2017-08-22 21:44:29 -070054 ;;
55generate-sources)
56 echo "==> generate-sources phase script"
Lusheng Ji16948022017-09-11 23:38:09 +000057 expand_templates
Lusheng Ji487c0cc2017-08-22 21:44:29 -070058 ;;
59compile)
60 echo "==> compile phase script"
61 ;;
62test)
63 echo "==> test phase script"
64 ;;
65package)
66 echo "==> package phase script"
67 ;;
68install)
69 echo "==> install phase script"
70 ;;
71deploy)
72 echo "==> deploy phase script"
Lusheng Ji16948022017-09-11 23:38:09 +000073 case $MVN_PROJECT_MODULEID in
74 platformdoc)
75 set -x
76 CURDIR=$(pwd)
77 virtualenv ./venv-doc
78 source ./venv-doc/bin/activate
Pratik Raj9dc682d2020-06-06 21:59:50 +053079 pip install --no-cache-dir --upgrade pip
80 pip install --no-cache-dir --upgrade 'mkdocs==0.16.3' mkdocs-material
Lusheng Ji16948022017-09-11 23:38:09 +000081 pip freeze
82
83 mkdocs build
84 build_and_push_docker
85 deactivate
86 rm -rf ./venv-doc
87
88 # build docker image from Docker file (under module dir) and push to registry
89 build_and_push_docker
90 ;;
91 *)
92 echo "====> unknown mvn project module"
93 ;;
94 esac
Lusheng Ji487c0cc2017-08-22 21:44:29 -070095 ;;
96*)
97 echo "==> unprocessed phase"
98 ;;
99esac
100