Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 2 | |
| 3 | # ================================================================================ |
vv770d | 3bf1d82 | 2022-04-25 21:10:39 +0000 | [diff] [blame] | 4 | # Copyright (c) 2017-2022 AT&T Intellectual Property. All rights reserved. |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 5 | # ================================================================================ |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 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 | # |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 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. |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 17 | # ============LICENSE_END========================================================= |
| 18 | # |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 19 | |
Lusheng Ji | d92d448 | 2017-09-21 05:42:28 +0000 | [diff] [blame] | 20 | |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 21 | set -ex |
| 22 | |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 23 | echo "running script: [$0] for module [$1] at stage [$2]" |
| 24 | |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 25 | MVN_PROJECT_MODULEID="$1" |
| 26 | MVN_PHASE="$2" |
Lusheng Ji | 5e11184 | 2017-09-11 23:01:37 +0000 | [diff] [blame] | 27 | PROJECT_ROOT=$(dirname $0) |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 28 | |
Lusheng Ji | 5e11184 | 2017-09-11 23:01:37 +0000 | [diff] [blame] | 29 | source "${PROJECT_ROOT}"/mvn-phase-lib.sh |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 30 | |
Lusheng Ji | d92d448 | 2017-09-21 05:42:28 +0000 | [diff] [blame] | 31 | TIMESTAMP=$(date +%C%y%m%dT%H%M%S) |
| 32 | export BUILD_NUMBER="${TIMESTAMP}" |
Lusheng Ji | d92d448 | 2017-09-21 05:42:28 +0000 | [diff] [blame] | 33 | shift 2 |
| 34 | |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 35 | case $MVN_PHASE in |
| 36 | clean) |
| 37 | echo "==> clean phase script" |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 38 | clean_templated_files |
Lusheng Ji | 5e11184 | 2017-09-11 23:01:37 +0000 | [diff] [blame] | 39 | clean_tox_files |
Lusheng Ji | d92d448 | 2017-09-21 05:42:28 +0000 | [diff] [blame] | 40 | rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 41 | ;; |
| 42 | generate-sources) |
| 43 | echo "==> generate-sources phase script" |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 44 | expand_templates |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 45 | ;; |
| 46 | compile) |
| 47 | echo "==> compile phase script" |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 48 | ;; |
| 49 | test) |
| 50 | echo "==> test phase script" |
cluckenbaugh | fffe41c | 2021-02-11 18:26:30 -0500 | [diff] [blame] | 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 |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 72 | ;; |
| 73 | package) |
| 74 | echo "==> package phase script" |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 75 | ;; |
| 76 | install) |
| 77 | echo "==> install phase script" |
Lusheng Ji | f7e6476 | 2017-10-12 05:16:59 +0000 | [diff] [blame] | 78 | case $MVN_PROJECT_MODULEID in |
| 79 | bootstrap) |
| 80 | upload_files_of_extension sh |
| 81 | ;; |
| 82 | esac |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 83 | ;; |
| 84 | deploy) |
| 85 | echo "==> deploy phase script" |
Lusheng Ji | 5e11184 | 2017-09-11 23:01:37 +0000 | [diff] [blame] | 86 | |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 87 | case $MVN_PROJECT_MODULEID in |
vv770d | 9d9a7f2 | 2021-02-20 01:08:58 +0000 | [diff] [blame] | 88 | cm-container|healthcheck-container|tls-init-container|consul-loader-container|multisite-init-container|dcae-k8s-cleanup-container|dcae-services-policy-sync) |
vv770d | cfef260 | 2021-02-20 02:46:28 +0000 | [diff] [blame] | 89 | build_and_push_docker |
Lusheng Ji | c38ca2f | 2017-09-11 20:11:29 +0000 | [diff] [blame] | 90 | ;; |
| 91 | *) |
| 92 | echo "====> unknown mvn project module" |
| 93 | ;; |
| 94 | esac |
Andrew Gauld | b34cbd0 | 2017-08-24 16:46:17 -0400 | [diff] [blame] | 95 | ;; |
| 96 | *) |
| 97 | echo "==> unprocessed phase" |
| 98 | ;; |
| 99 | esac |
| 100 | |