Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 1 | #!/bin/bash |
Hansen, Tony (th1395) | b39d6e1 | 2021-12-18 17:11:43 +0000 | [diff] [blame] | 2 | # -*- indent-tabs-mode: nil -*- # vi: set expandtab: |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 3 | |
| 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 Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 23 | set -ex |
| 24 | |
| 25 | |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 26 | echo "running script: [$0] for module [$1] at stage [$2]" |
| 27 | |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 28 | MVN_PROJECT_MODULEID="$1" |
| 29 | MVN_PHASE="$2" |
| 30 | PROJECT_ROOT=$(dirname $0) |
| 31 | |
| 32 | # expected environment variables |
| 33 | if [ -z "${MVN_NEXUSPROXY}" ]; then |
| 34 | echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed" |
| 35 | exit 1 |
| 36 | fi |
Andrew Gauld | 373f0f3 | 2018-02-21 11:14:46 -0500 | [diff] [blame] | 37 | export SETTINGS_FILE=${SETTINGS_FILE:-$HOME/.m2/settings.xml} |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 38 | |
Lusheng Ji | 00444ab | 2017-10-13 17:39:45 +0000 | [diff] [blame] | 39 | set +e |
Lusheng Ji | 7ed3376 | 2018-03-05 08:10:18 -0500 | [diff] [blame] | 40 | source "${PROJECT_ROOT}"/scripts/mvn-phase-lib.sh |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 41 | |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 42 | |
Tony Hansen | 4b74774 | 2017-09-19 05:04:05 +0000 | [diff] [blame] | 43 | # This is the base for where "deploy" will upload |
| 44 | # MVN_NEXUSPROXY is set in the pom.xml |
| 45 | REPO=$MVN_NEXUSPROXY/content/sites/raw/$MVN_PROJECT_GROUPID |
| 46 | |
| 47 | TIMESTAMP=$(date +%C%y%m%dT%H%M%S) |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 48 | export BUILD_NUMBER="${TIMESTAMP}" |
| 49 | |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 50 | |
Tony Hansen | 4b74774 | 2017-09-19 05:04:05 +0000 | [diff] [blame] | 51 | shift 2 |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 52 | |
| 53 | case $MVN_PHASE in |
| 54 | clean) |
| 55 | echo "==> clean phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 56 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 57 | *) |
| 58 | clean_templated_files |
| 59 | clean_tox_files |
| 60 | rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml |
| 61 | ;; |
| 62 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 63 | ;; |
| 64 | generate-sources) |
| 65 | echo "==> generate-sources phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 66 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 67 | *) |
| 68 | expand_templates |
| 69 | ;; |
| 70 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 71 | ;; |
| 72 | compile) |
| 73 | echo "==> compile phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 74 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 75 | *) |
| 76 | ;; |
| 77 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 78 | ;; |
| 79 | test) |
| 80 | echo "==> test phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 81 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 82 | *) |
Andrew Gauld | 373f0f3 | 2018-02-21 11:14:46 -0500 | [diff] [blame] | 83 | if [ -f tox.ini ] |
| 84 | then |
| 85 | set -e |
| 86 | run_tox_test |
| 87 | set +e |
| 88 | fi |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 89 | ;; |
| 90 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 91 | ;; |
| 92 | package) |
| 93 | echo "==> package phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 94 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 310c9c1 | 2017-10-13 21:45:18 +0000 | [diff] [blame] | 95 | scripts) |
| 96 | upload_files_of_extension "sh" "$MVN_PROJECT_MODULEID" |
| 97 | ;; |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 98 | *) |
| 99 | ;; |
| 100 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 101 | ;; |
| 102 | install) |
| 103 | echo "==> install phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 104 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 105 | *) |
| 106 | ;; |
| 107 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 108 | ;; |
| 109 | deploy) |
| 110 | echo "==> deploy phase script" |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 111 | case $MVN_PROJECT_MODULEID in |
Lusheng Ji | 00444ab | 2017-10-13 17:39:45 +0000 | [diff] [blame] | 112 | scripts) |
| 113 | upload_files_of_extension "sh" "$MVN_PROJECT_MODULEID" |
| 114 | ;; |
Lusheng Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 115 | *) |
Lusheng Ji | a7a5837 | 2017-09-20 03:57:14 +0000 | [diff] [blame] | 116 | # 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 Ji | 88648fc | 2017-09-20 02:18:20 +0000 | [diff] [blame] | 120 | ;; |
| 121 | esac |
Lusheng Ji | 5bc79f4 | 2017-08-29 14:20:46 +0000 | [diff] [blame] | 122 | ;; |
| 123 | *) |
| 124 | echo "==> unprocessed phase" |
| 125 | ;; |
| 126 | esac |
| 127 | |