blob: 09db3b5782c53ee3cd8c3ac014b42e2c8679f501 [file] [log] [blame]
Andrew Gauldb34cbd02017-08-24 16:46:17 -04001#!/bin/bash
Lusheng Jic38ca2f2017-09-11 20:11:29 +00002
3# ================================================================================
Lusheng Ji6d381a52018-03-22 14:27:41 -04004# Copyright (c) 2017-2018 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 Jic38ca2f2017-09-11 20:11:29 +000029
Lusheng Ji937f02f2018-03-23 13:30:20 -040030echo "MVN_RELEASE_TAG is set to [$MVN_RELEASE_TAG]"
Vijay Venkatesh Kumar50368e12019-09-30 20:27:09 +000031RELEASE_TAG=${MVN_RELEASE_TAG:-R6}
Lusheng Ji937f02f2018-03-23 13:30:20 -040032if [ "$RELEASE_TAG" != "R1" ]; then
33 RELEASE_TAGGED_DIR="${RELEASE_TAG}/"
34else
35 RELEASE_TAGGED_DIR=""
36fi
Lusheng Ji6d381a52018-03-22 14:27:41 -040037if ! wget -O ${PROJECT_ROOT}/mvn-phase-lib.sh \
Lusheng Ji937f02f2018-03-23 13:30:20 -040038 "$MVN_RAWREPO_BASEURL_DOWNLOAD"/org.onap.dcaegen2.utils/${RELEASE_TAGGED_DIR}scripts/mvn-phase-lib.sh; then
39 echo "Fail to download mvn-phase-lib.sh"
40 exit 1
Lusheng Ji6d381a52018-03-22 14:27:41 -040041fi
Lusheng Ji5e111842017-09-11 23:01:37 +000042source "${PROJECT_ROOT}"/mvn-phase-lib.sh
Lusheng Jic38ca2f2017-09-11 20:11:29 +000043
Lusheng Jid92d4482017-09-21 05:42:28 +000044
45TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
46export BUILD_NUMBER="${TIMESTAMP}"
Lusheng Jid92d4482017-09-21 05:42:28 +000047shift 2
48
Andrew Gauldb34cbd02017-08-24 16:46:17 -040049case $MVN_PHASE in
50clean)
51 echo "==> clean phase script"
Lusheng Jic38ca2f2017-09-11 20:11:29 +000052 clean_templated_files
Lusheng Ji5e111842017-09-11 23:01:37 +000053 clean_tox_files
Lusheng Jid92d4482017-09-21 05:42:28 +000054 rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
Andrew Gauldb34cbd02017-08-24 16:46:17 -040055 ;;
56generate-sources)
57 echo "==> generate-sources phase script"
Lusheng Jic38ca2f2017-09-11 20:11:29 +000058 expand_templates
Andrew Gauldb34cbd02017-08-24 16:46:17 -040059 ;;
60compile)
61 echo "==> compile phase script"
Andrew Gauldb34cbd02017-08-24 16:46:17 -040062 ;;
63test)
64 echo "==> test phase script"
Andrew Gauldb34cbd02017-08-24 16:46:17 -040065 ;;
66package)
67 echo "==> package phase script"
Andrew Gauldb34cbd02017-08-24 16:46:17 -040068 ;;
69install)
70 echo "==> install phase script"
Lusheng Jif7e64762017-10-12 05:16:59 +000071 case $MVN_PROJECT_MODULEID in
72 bootstrap)
73 upload_files_of_extension sh
74 ;;
75 esac
Andrew Gauldb34cbd02017-08-24 16:46:17 -040076 ;;
77deploy)
78 echo "==> deploy phase script"
Lusheng Ji5e111842017-09-11 23:01:37 +000079
Lusheng Jic38ca2f2017-09-11 20:11:29 +000080 case $MVN_PROJECT_MODULEID in
81 bootstrap)
Lusheng Ji5e111842017-09-11 23:01:37 +000082 # build docker image from Docker file (under module dir) and push to registry
Lusheng Jif7e64762017-10-12 05:16:59 +000083 upload_files_of_extension sh
Lusheng Jic38ca2f2017-09-11 20:11:29 +000084 build_and_push_docker
85 ;;
Jack Lucasa1647b22019-08-13 09:51:16 -040086 k8s-bootstrap-container|tca-cdap-container|cm-container|redis-cluster-container|healthcheck-container|pnda-mirror-container|pnda-bootstrap-container|tls-init-container|consul-loader-container|multisite-init-container|dcae-k8s-cleanup-container)
Lusheng Ji6d381a52018-03-22 14:27:41 -040087 build_and_push_docker
88 ;;
Lusheng Ji6c117932018-04-03 15:07:58 -040089 scripts|cloud_init|heat)
Julien Barbotbfa1bbe2018-08-20 18:42:48 +020090 # upload all sh file under the root of module
Lusheng Ji6c117932018-04-03 15:07:58 -040091 upload_files_of_extension_recursively sh $MVN_PROJECT_MODULEID
92 upload_files_of_extension_recursively py $MVN_PROJECT_MODULEID
93 upload_files_of_extension_recursively yaml $MVN_PROJECT_MODULEID
Lusheng Jic38ca2f2017-09-11 20:11:29 +000094 ;;
95 *)
96 echo "====> unknown mvn project module"
97 ;;
98 esac
Andrew Gauldb34cbd02017-08-24 16:46:17 -040099 ;;
100*)
101 echo "==> unprocessed phase"
102 ;;
103esac
104