Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Hansen, Tony (th1395) | 663df2c | 2023-05-23 21:27:17 +0000 | [diff] [blame] | 3 | # ===========LICENSE_START======================================================== |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 4 | # ================================================================================ |
| 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 | |
| 22 | set -ex |
| 23 | |
| 24 | |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 25 | echo "running script: [$0] for module [$1] at stage [$2]" |
| 26 | |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 27 | MVN_PROJECT_MODULEID="$1" |
| 28 | MVN_PHASE="$2" |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 29 | PROJECT_ROOT=$(dirname $0) |
| 30 | |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 31 | # expected environment variables |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 32 | if [ -z "${MVN_NEXUSPROXY}" ]; then |
| 33 | echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed" |
Lusheng Ji | eab1675 | 2017-09-19 18:39:04 +0000 | [diff] [blame] | 34 | exit 1 |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 35 | fi |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 36 | if [ -z "$SETTINGS_FILE" ]; then |
| 37 | echo "SETTINGS_FILE environment variable not set. Cannot proceed" |
Lusheng Ji | eab1675 | 2017-09-19 18:39:04 +0000 | [diff] [blame] | 38 | exit 2 |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 39 | fi |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 40 | |
| 41 | |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 42 | |
| 43 | |
| 44 | source "${PROJECT_ROOT}"/mvn-phase-lib.sh |
| 45 | |
| 46 | |
| 47 | # Customize the section below for each project |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 48 | case $MVN_PHASE in |
| 49 | clean) |
| 50 | echo "==> clean phase script" |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 51 | clean_templated_files |
| 52 | clean_tox_files |
| 53 | rm -rf ./venv-* ./*.wgn ./site |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 54 | ;; |
| 55 | generate-sources) |
| 56 | echo "==> generate-sources phase script" |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 57 | expand_templates |
Lusheng Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 58 | ;; |
| 59 | compile) |
| 60 | echo "==> compile phase script" |
| 61 | ;; |
| 62 | test) |
| 63 | echo "==> test phase script" |
| 64 | ;; |
| 65 | package) |
| 66 | echo "==> package phase script" |
| 67 | ;; |
| 68 | install) |
| 69 | echo "==> install phase script" |
| 70 | ;; |
| 71 | deploy) |
| 72 | echo "==> deploy phase script" |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 73 | case $MVN_PROJECT_MODULEID in |
| 74 | platformdoc) |
| 75 | set -x |
| 76 | CURDIR=$(pwd) |
| 77 | virtualenv ./venv-doc |
| 78 | source ./venv-doc/bin/activate |
Pratik Raj | 9dc682d | 2020-06-06 21:59:50 +0530 | [diff] [blame] | 79 | pip install --no-cache-dir --upgrade pip |
| 80 | pip install --no-cache-dir --upgrade 'mkdocs==0.16.3' mkdocs-material |
Lusheng Ji | 1694802 | 2017-09-11 23:38:09 +0000 | [diff] [blame] | 81 | 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 Ji | 487c0cc | 2017-08-22 21:44:29 -0700 | [diff] [blame] | 95 | ;; |
| 96 | *) |
| 97 | echo "==> unprocessed phase" |
| 98 | ;; |
| 99 | esac |
| 100 | |