blob: c924ebd63251cfbbfb5171a57ea9ca99aab22c04 [file] [log] [blame]
Lusheng Ji5bc79f42017-08-29 14:20:46 +00001#!/bin/bash
Hansen, Tony (th1395)b39d6e12021-12-18 17:11:43 +00002# -*- indent-tabs-mode: nil -*- # vi: set expandtab:
Lusheng Ji5bc79f42017-08-29 14:20:46 +00003
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
Lusheng Ji88648fc2017-09-20 02:18:20 +000023set -ex
24
25
Lusheng Ji5bc79f42017-08-29 14:20:46 +000026echo "running script: [$0] for module [$1] at stage [$2]"
27
Lusheng Ji88648fc2017-09-20 02:18:20 +000028MVN_PROJECT_MODULEID="$1"
29MVN_PHASE="$2"
30PROJECT_ROOT=$(dirname $0)
31
32# expected environment variables
33if [ -z "${MVN_NEXUSPROXY}" ]; then
34 echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
35 exit 1
36fi
Andrew Gauld373f0f32018-02-21 11:14:46 -050037export SETTINGS_FILE=${SETTINGS_FILE:-$HOME/.m2/settings.xml}
Lusheng Ji88648fc2017-09-20 02:18:20 +000038
Lusheng Ji00444ab2017-10-13 17:39:45 +000039set +e
Lusheng Ji7ed33762018-03-05 08:10:18 -050040source "${PROJECT_ROOT}"/scripts/mvn-phase-lib.sh
Lusheng Ji88648fc2017-09-20 02:18:20 +000041
Lusheng Ji5bc79f42017-08-29 14:20:46 +000042
Tony Hansen4b747742017-09-19 05:04:05 +000043# This is the base for where "deploy" will upload
44# MVN_NEXUSPROXY is set in the pom.xml
45REPO=$MVN_NEXUSPROXY/content/sites/raw/$MVN_PROJECT_GROUPID
46
47TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
Lusheng Ji5bc79f42017-08-29 14:20:46 +000048export BUILD_NUMBER="${TIMESTAMP}"
49
Lusheng Ji5bc79f42017-08-29 14:20:46 +000050
Tony Hansen4b747742017-09-19 05:04:05 +000051shift 2
Lusheng Ji5bc79f42017-08-29 14:20:46 +000052
53case $MVN_PHASE in
54clean)
55 echo "==> clean phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +000056 case $MVN_PROJECT_MODULEID in
Lusheng Ji88648fc2017-09-20 02:18:20 +000057 *)
58 clean_templated_files
59 clean_tox_files
60 rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
61 ;;
62 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +000063 ;;
64generate-sources)
65 echo "==> generate-sources phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +000066 case $MVN_PROJECT_MODULEID in
Lusheng Ji88648fc2017-09-20 02:18:20 +000067 *)
68 expand_templates
69 ;;
70 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +000071 ;;
72compile)
73 echo "==> compile phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +000074 case $MVN_PROJECT_MODULEID in
Lusheng Ji88648fc2017-09-20 02:18:20 +000075 *)
76 ;;
77 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +000078 ;;
79test)
80 echo "==> test phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +000081 case $MVN_PROJECT_MODULEID in
Lusheng Ji88648fc2017-09-20 02:18:20 +000082 *)
Andrew Gauld373f0f32018-02-21 11:14:46 -050083 if [ -f tox.ini ]
84 then
85 set -e
86 run_tox_test
87 set +e
88 fi
Lusheng Ji88648fc2017-09-20 02:18:20 +000089 ;;
90 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +000091 ;;
92package)
93 echo "==> package phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +000094 case $MVN_PROJECT_MODULEID in
Lusheng Ji310c9c12017-10-13 21:45:18 +000095 scripts)
96 upload_files_of_extension "sh" "$MVN_PROJECT_MODULEID"
97 ;;
Lusheng Ji88648fc2017-09-20 02:18:20 +000098 *)
99 ;;
100 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +0000101 ;;
102install)
103 echo "==> install phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +0000104 case $MVN_PROJECT_MODULEID in
Lusheng Ji88648fc2017-09-20 02:18:20 +0000105 *)
106 ;;
107 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +0000108 ;;
109deploy)
110 echo "==> deploy phase script"
Lusheng Ji88648fc2017-09-20 02:18:20 +0000111 case $MVN_PROJECT_MODULEID in
Lusheng Ji00444ab2017-10-13 17:39:45 +0000112 scripts)
113 upload_files_of_extension "sh" "$MVN_PROJECT_MODULEID"
114 ;;
Lusheng Ji88648fc2017-09-20 02:18:20 +0000115 *)
Lusheng Jia7a58372017-09-20 03:57:14 +0000116 # uncomment after we figure out how to use pypi. this command expects that the credentials are passed in
117 # settings.xml, and the URL and serverid are passed in from either oparent or dcaegen2's root pom
118 # before this is ready comment below out
119 #generate_pypirc_then_publish
Lusheng Ji88648fc2017-09-20 02:18:20 +0000120 ;;
121 esac
Lusheng Ji5bc79f42017-08-29 14:20:46 +0000122 ;;
123*)
124 echo "==> unprocessed phase"
125 ;;
126esac
127