efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2019 Nordix Foundation. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | |
| 20 | set -ex |
| 21 | |
| 22 | echo "running script: [$0] for module [$1] at stage [$2]" |
| 23 | |
| 24 | MVN_PROJECT_MODULEID="$1" |
| 25 | MVN_PHASE="$2" |
| 26 | PROJECT_ROOT=$(dirname $0) |
| 27 | |
| 28 | |
| 29 | echo "MVN_RELEASE_TAG is set to [$MVN_RELEASE_TAG]" |
| 30 | RELEASE_TAG=${MVN_RELEASE_TAG:-R6} |
| 31 | if [[ "$RELEASE_TAG" != "R1" ]]; then |
| 32 | RELEASE_TAGGED_DIR="${RELEASE_TAG}/" |
| 33 | else |
| 34 | RELEASE_TAGGED_DIR="" |
| 35 | fi |
| 36 | |
| 37 | |
| 38 | if [[ ! -f "${PROJECT_ROOT}/mvn-phase-lib.sh" ]]; then |
| 39 | if ! wget -O ${PROJECT_ROOT}/mvn-phase-lib.sh \ |
| 40 | "$MVN_RAWREPO_BASEURL_DOWNLOAD"/org.onap.dcaegen2.utils/${RELEASE_TAGGED_DIR}scripts/mvn-phase-lib.sh; then |
| 41 | echo "Fail to download mvn-phase-lib.sh" |
| 42 | exit 1 |
| 43 | fi |
| 44 | fi |
| 45 | |
| 46 | source ./mvn-phase-lib.sh |
| 47 | |
| 48 | # Customize the section below for each project |
| 49 | case ${MVN_PHASE} in |
| 50 | clean) |
| 51 | echo "==> clean phase script" |
| 52 | clean_templated_files |
| 53 | clean_tox_files |
| 54 | rm -rf ./venv-* ./*.wgn |
| 55 | ;; |
| 56 | generate-sources) |
| 57 | echo "==> generate-sources phase script" |
| 58 | ;; |
| 59 | compile) |
| 60 | echo "==> compile phase script" |
| 61 | ;; |
| 62 | test) |
| 63 | echo "==> test phase script" |
| 64 | run_tox_test |
| 65 | ;; |
| 66 | package) |
| 67 | echo "==> package phase script" |
| 68 | ;; |
| 69 | install) |
| 70 | echo "==> install phase script" |
| 71 | ;; |
| 72 | deploy) |
| 73 | echo "==> deploy phase script" |
| 74 | # below segments are example of how to deploy various artifacts |
| 75 | # copy the ones suitable for your repo |
| 76 | |
| 77 | # build docker image from Docker file (under root of repo) and push to registry |
| 78 | build_and_push_docker |
| 79 | ;; |
| 80 | *) |
| 81 | echo "==> unprocessed phase" |
| 82 | ;; |
| 83 | esac |
| 84 | |