blob: 02709b438b1079d1f6a3b38ffb7c0b392192097d [file] [log] [blame]
Andrew Gauldb34cbd02017-08-24 16:46:17 -04001#!/bin/bash
Lusheng Jic38ca2f2017-09-11 20:11:29 +00002
3# ================================================================================
vv770d3bf1d822022-04-25 21:10:39 +00004# Copyright (c) 2017-2022 AT&T Intellectual Property. All rights reserved.
Lusheng Jic38ca2f2017-09-11 20:11:29 +00005# ================================================================================
Andrew Gauldb34cbd02017-08-24 16:46:17 -04006# 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#
Lusheng Jic38ca2f2017-09-11 20:11:29 +000010# http://www.apache.org/licenses/LICENSE-2.0
Andrew Gauldb34cbd02017-08-24 16:46:17 -040011#
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.
Lusheng Jic38ca2f2017-09-11 20:11:29 +000017# ============LICENSE_END=========================================================
18#
Lusheng Jic38ca2f2017-09-11 20:11:29 +000019
Lusheng Jid92d4482017-09-21 05:42:28 +000020
Lusheng Jic38ca2f2017-09-11 20:11:29 +000021set -ex
22
Andrew Gauldb34cbd02017-08-24 16:46:17 -040023echo "running script: [$0] for module [$1] at stage [$2]"
24
Lusheng Jic38ca2f2017-09-11 20:11:29 +000025MVN_PROJECT_MODULEID="$1"
26MVN_PHASE="$2"
Lusheng Ji5e111842017-09-11 23:01:37 +000027PROJECT_ROOT=$(dirname $0)
Lusheng Jic38ca2f2017-09-11 20:11:29 +000028
Lusheng Ji5e111842017-09-11 23:01:37 +000029source "${PROJECT_ROOT}"/mvn-phase-lib.sh
Lusheng Jic38ca2f2017-09-11 20:11:29 +000030
Lusheng Jid92d4482017-09-21 05:42:28 +000031TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
32export BUILD_NUMBER="${TIMESTAMP}"
Lusheng Jid92d4482017-09-21 05:42:28 +000033shift 2
34
Andrew Gauldb34cbd02017-08-24 16:46:17 -040035case $MVN_PHASE in
36clean)
37 echo "==> clean phase script"
Lusheng Jic38ca2f2017-09-11 20:11:29 +000038 clean_templated_files
Lusheng Ji5e111842017-09-11 23:01:37 +000039 clean_tox_files
Lusheng Jid92d4482017-09-21 05:42:28 +000040 rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
Andrew Gauldb34cbd02017-08-24 16:46:17 -040041 ;;
42generate-sources)
43 echo "==> generate-sources phase script"
Lusheng Jic38ca2f2017-09-11 20:11:29 +000044 expand_templates
Andrew Gauldb34cbd02017-08-24 16:46:17 -040045 ;;
46compile)
47 echo "==> compile phase script"
Andrew Gauldb34cbd02017-08-24 16:46:17 -040048 ;;
49test)
50 echo "==> test phase script"
cluckenbaughfffe41c2021-02-11 18:26:30 -050051 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
Andrew Gauldb34cbd02017-08-24 16:46:17 -040072 ;;
73package)
74 echo "==> package phase script"
Andrew Gauldb34cbd02017-08-24 16:46:17 -040075 ;;
76install)
77 echo "==> install phase script"
Lusheng Jif7e64762017-10-12 05:16:59 +000078 case $MVN_PROJECT_MODULEID in
79 bootstrap)
80 upload_files_of_extension sh
81 ;;
82 esac
Andrew Gauldb34cbd02017-08-24 16:46:17 -040083 ;;
84deploy)
85 echo "==> deploy phase script"
Lusheng Ji5e111842017-09-11 23:01:37 +000086
Lusheng Jic38ca2f2017-09-11 20:11:29 +000087 case $MVN_PROJECT_MODULEID in
vv770d9d9a7f22021-02-20 01:08:58 +000088 cm-container|healthcheck-container|tls-init-container|consul-loader-container|multisite-init-container|dcae-k8s-cleanup-container|dcae-services-policy-sync)
vv770dcfef2602021-02-20 02:46:28 +000089 build_and_push_docker
Lusheng Jic38ca2f2017-09-11 20:11:29 +000090 ;;
91 *)
92 echo "====> unknown mvn project module"
93 ;;
94 esac
Andrew Gauldb34cbd02017-08-24 16:46:17 -040095 ;;
96*)
97 echo "==> unprocessed phase"
98 ;;
99esac
100