[DCAE] INFO.yaml update
[dcaegen2/deployments.git] / mvn-phase-script.sh
1 #!/bin/bash
2
3 # ================================================================================
4 # Copyright (c) 2017-2022 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18 #
19
20
21 set -ex
22
23 echo "running script: [$0] for module [$1] at stage [$2]"
24
25 MVN_PROJECT_MODULEID="$1"
26 MVN_PHASE="$2"
27 PROJECT_ROOT=$(dirname $0)
28
29 source "${PROJECT_ROOT}"/mvn-phase-lib.sh
30
31 TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
32 export BUILD_NUMBER="${TIMESTAMP}"
33 shift 2
34
35 case $MVN_PHASE in
36 clean)
37   echo "==> clean phase script"
38   clean_templated_files
39   clean_tox_files
40   rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
41   ;;
42 generate-sources)
43   echo "==> generate-sources phase script"
44   expand_templates
45   ;;
46 compile)
47   echo "==> compile phase script"
48   ;;
49 test)
50   echo "==> test phase script"
51   case $MVN_PROJECT_MODULEID in
52   dcae-services-policy-sync)
53     set -e -x
54     CURDIR=$(pwd)
55     TOXINIS=$(find . -name "tox.ini")
56     for TOXINI in "${TOXINIS[@]}"; do
57       DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
58       cd "${CURDIR}/${DIR}"
59       rm -rf ./venv-tox ./.tox
60       virtualenv ./venv-tox
61       source ./venv-tox/bin/activate
62       pip install pip==20.3.4
63       pip install --upgrade argparse
64       pip install tox
65       pip freeze
66       tox
67       deactivate
68       rm -rf ./venv-tox ./.tox
69     done 
70     ;;
71   esac
72   ;;
73 package)
74   echo "==> package phase script"
75   ;;
76 install)
77   echo "==> install phase script"
78   case $MVN_PROJECT_MODULEID in
79   bootstrap)
80     upload_files_of_extension sh
81     ;;
82   esac
83   ;;
84 deploy)
85   echo "==> deploy phase script"
86
87   case $MVN_PROJECT_MODULEID in
88   cm-container|healthcheck-container|tls-init-container|consul-loader-container|multisite-init-container|dcae-k8s-cleanup-container|dcae-services-policy-sync)
89     build_and_push_docker
90     ;;
91   *)
92     echo "====> unknown mvn project module"
93     ;;
94   esac
95   ;;
96 *)
97   echo "==> unprocessed phase"
98   ;;
99 esac
100