3 # ================================================================================
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # ============LICENSE_END=========================================================
19 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 echo "running script: [$0] for module [$1] at stage [$2]"
26 MVN_PROJECT_MODULEID="$1"
30 PROJECT_ROOT=$(dirname $0)
32 FQDN="${MVN_PROJECT_GROUPID}.${MVN_PROJECT_ARTIFACTID}"
33 if [ "$MVN_PROJECT_MODULEID" == "__" ]; then
34 MVN_PROJECT_MODULEID=""
37 if [[ "$MVN_PROJECT_VERSION" == *SNAPSHOT ]]; then
38 echo "=> for SNAPSHOT artifact build"
39 MVN_DEPLOYMENT_TYPE='SNAPSHOT'
41 echo "=> for STAGING/RELEASE artifact build"
42 MVN_DEPLOYMENT_TYPE='STAGING'
44 echo "MVN_DEPLOYMENT_TYPE is [$MVN_DEPLOYMENT_TYPE]"
47 TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
49 # expected environment variables
50 if [ -z "${MVN_NEXUSPROXY}" ]; then
51 echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
54 MVN_NEXUSPROXY_HOST=$(echo "$MVN_NEXUSPROXY" |cut -f3 -d'/' | cut -f1 -d':')
55 echo "=> Nexus Proxy at $MVN_NEXUSPROXY_HOST, $MVN_NEXUSPROXY"
57 if [ -z "$WORKSPACE" ]; then
61 if [ -z "$SETTINGS_FILE" ]; then
62 echo "SETTINGS_FILE environment variable not set. Cannot proceed"
68 # mvn phase in life cycle
72 echo "MVN_PROJECT_MODULEID is [$MVN_PROJECT_MODULEID]"
73 echo "MVN_PHASE is [$MVN_PHASE]"
74 echo "MVN_PROJECT_GROUPID is [$MVN_PROJECT_GROUPID]"
75 echo "MVN_PROJECT_ARTIFACTID is [$MVN_PROJECT_ARTIFACTID]"
76 echo "MVN_PROJECT_VERSION is [$MVN_PROJECT_VERSION]"
77 echo "MVN_NEXUSPROXY is [$MVN_NEXUSPROXY]"
78 echo "MVN_RAWREPO_BASEURL_UPLOAD is [$MVN_RAWREPO_BASEURL_UPLOAD]"
79 echo "MVN_RAWREPO_BASEURL_DOWNLOAD is [$MVN_RAWREPO_BASEURL_DOWNLOAD]"
80 MVN_RAWREPO_HOST=$(echo "$MVN_RAWREPO_BASEURL_UPLOAD" | cut -f3 -d'/' |cut -f1 -d':')
81 echo "MVN_RAWREPO_HOST is [$MVN_RAWREPO_HOST]"
82 echo "MVN_RAWREPO_SERVERID is [$MVN_RAWREPO_SERVERID]"
83 echo "MVN_DOCKERREGISTRY_DAILY is [$MVN_DOCKERREGISTRY_DAILY]"
84 echo "MVN_DOCKERREGISTRY_RELEASE is [$MVN_DOCKERREGISTRY_RELEASE]"
87 source "${PROJECT_ROOT}"/mvn-phase-lib.sh
90 # Customize the section below for each project
93 echo "==> clean phase script"
96 rm -rf ./venv-* ./*.wgn ./site
99 echo "==> generate-sources phase script"
103 echo "==> compile phase script"
106 echo "==> test phase script"
109 echo "==> package phase script"
112 echo "==> install phase script"
115 echo "==> deploy phase script"
116 # below segments are example of how to deploy various artifacts
117 # copy the ones suitable for your repo, and remove the "if false" statement
119 # build docker image from Docker file (under root of repo) and push to registry
121 build_and_push_docker
124 # upload all yaml file under the root of repo
126 upload_files_of_extension yaml
130 case $MVN_PROJECT_MODULEID in
132 # build docker image from Docker file (under module dir) and push to registry
133 build_and_push_docker
136 # upload all sh file under the root of module
137 upload_files_of_extension sh
141 virtualenv ./venv-doc
142 source ./venv-doc/bin/activate
143 pip install --upgrade pip
144 pip install --upgrade mkdocs mkdocs-material
148 build_and_push_docker
152 # build docker image from Docker file (under module dir) and push to registry
153 build_and_push_docker
156 echo "====> unknown mvn project module"
162 echo "==> unprocessed phase"