summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap/installer-docker.sh-template4
-rw-r--r--bootstrap/pom.xml2
-rwxr-xr-xmvn-phase-lib.sh118
-rwxr-xr-xmvn-phase-script.sh62
-rw-r--r--pom.xml18
-rw-r--r--scripts/pom.xml2
6 files changed, 139 insertions, 67 deletions
diff --git a/bootstrap/installer-docker.sh-template b/bootstrap/installer-docker.sh-template
index 672f397..455561b 100755
--- a/bootstrap/installer-docker.sh-template
+++ b/bootstrap/installer-docker.sh-template
@@ -27,6 +27,8 @@ DESIGPLUG={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}
SSHKEYTYPES={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/sshkeyshare/sshkey_types.yaml
SSHKEYPLUG={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/sshkeyshare-1.0.0-py27-none-any.wgn
OSPLUGINZIP=https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/1.4.zip
+OSPLUGINWGN=https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases/download/2.2.0/cloudify_openstack_plugin-2.2.0-py27-none-linux_x86_64-centos-Core.wgn
+
# Make sure ssh doesn't prompt for new host or choke on a new host with an IP it's seen before
SSHOPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
@@ -36,7 +38,7 @@ SSHUSER=centos
PVTKEY=./config/key
INPUTS=./config/inputs.yaml
-if ["$LOCATION" = "" ]
+if [ "$LOCATION" = "" ]
then
echo 'Environment variable LOCATION not set. Should be set to location ID for this installation.'
exit 1
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 5a41b6b..3155704 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -21,7 +21,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.dcaegen2</groupId>
+ <groupId>org.onap.dcaegen2.deployments</groupId>
<artifactId>deployments</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
diff --git a/mvn-phase-lib.sh b/mvn-phase-lib.sh
index 6eb4b38..b9e764c 100755
--- a/mvn-phase-lib.sh
+++ b/mvn-phase-lib.sh
@@ -19,6 +19,70 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#MVN_PROJECT_MODULEID="$1"
+#MVN_PHASE="$2"
+#PROJECT_ROOT=$(dirname $0)
+
+FQDN="${MVN_PROJECT_GROUPID}"
+if [ "$MVN_PROJECT_MODULEID" == "__" ]; then
+ MVN_PROJECT_MODULEID=""
+fi
+
+if [[ "$MVN_PROJECT_VERSION" == *SNAPSHOT ]]; then
+ echo "=> for SNAPSHOT artifact build"
+ MVN_DEPLOYMENT_TYPE='SNAPSHOT'
+else
+ echo "=> for STAGING/RELEASE artifact build"
+ MVN_DEPLOYMENT_TYPE='STAGING'
+fi
+echo "MVN_DEPLOYMENT_TYPE is [$MVN_DEPLOYMENT_TYPE]"
+
+
+TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
+
+# expected environment variables
+if [ -z "${MVN_NEXUSPROXY}" ]; then
+ echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
+ exit
+fi
+MVN_NEXUSPROXY_HOST=$(echo "$MVN_NEXUSPROXY" |cut -f3 -d'/' | cut -f1 -d':')
+echo "=> Nexus Proxy at $MVN_NEXUSPROXY_HOST, $MVN_NEXUSPROXY"
+
+if [ -z "$WORKSPACE" ]; then
+ WORKSPACE=$(pwd)
+fi
+
+if [ -z "$SETTINGS_FILE" ]; then
+ echo "SETTINGS_FILE environment variable not set. Cannot proceed"
+ exit
+fi
+
+
+
+# mvn phase in life cycle
+MVN_PHASE="$2"
+
+echo "MVN_PROJECT_MODULEID is [$MVN_PROJECT_MODULEID]"
+echo "MVN_PHASE is [$MVN_PHASE]"
+echo "MVN_PROJECT_GROUPID is [$MVN_PROJECT_GROUPID]"
+echo "MVN_PROJECT_ARTIFACTID is [$MVN_PROJECT_ARTIFACTID]"
+echo "MVN_PROJECT_VERSION is [$MVN_PROJECT_VERSION]"
+echo "MVN_NEXUSPROXY is [$MVN_NEXUSPROXY]"
+echo "MVN_RAWREPO_BASEURL_UPLOAD is [$MVN_RAWREPO_BASEURL_UPLOAD]"
+echo "MVN_RAWREPO_BASEURL_DOWNLOAD is [$MVN_RAWREPO_BASEURL_DOWNLOAD]"
+MVN_RAWREPO_HOST=$(echo "$MVN_RAWREPO_BASEURL_UPLOAD" | cut -f3 -d'/' |cut -f1 -d':')
+echo "MVN_RAWREPO_HOST is [$MVN_RAWREPO_HOST]"
+echo "MVN_RAWREPO_SERVERID is [$MVN_RAWREPO_SERVERID]"
+echo "MVN_DOCKERREGISTRY_SNAOSHOT is [$MVN_DOCKERREGISTRY_SNAPSHOT]"
+echo "MVN_DOCKERREGISTRY_RELEASE is [$MVN_DOCKERREGISTRY_RELEASE]"
+echo "MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID is [$MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID]"
+echo "MVN_DOCKERREGISTRY_RELEASE_SERVERID is [$MVN_DOCKERREGISTRY_RELEASE_SERVERID]"
+
+echo "MVN_PYPISERVER_SERVERID [$MVN_PYPISERVER_SERVERID]"
+echo "MVN_PYPISERVER_BASEURL is [$MVN_PYPISERVER_BASEURL]"
+
+
+
clean_templated_files()
{
TEMPLATE_FILES=$(find . -name "*-template")
@@ -52,7 +116,7 @@ expand_templates()
export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.blueprints/releases"
export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.blueprints/snapshots"
- export ONAPTEMPLATE_PYPIURL_org_onap_dcaegen2="${MVN_NEXUSPROXY}/content/sites/pypi"
+ export ONAPTEMPLATE_PYPIURL_org_onap_dcaegen2="$MVN_PYPISERVER_BASEURL"
export ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases="$MVN_DOCKERREGISTRY_DAILY"
export ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_snapshots="$MVN_DOCKERREGISTRY_DAILY/snapshots"
@@ -169,10 +233,12 @@ upload_raw_file()
REPO="$MVN_RAWREPO_BASEURL_UPLOAD"
- OUTPUT_FILE=$1
+ OUTPUT_FILE=$(echo "$1" | sed -e "s/^.\///")
EXT=$(echo "$OUTPUT_FILE" | rev |cut -f1 -d '.' |rev)
if [ "$EXT" == 'yaml' ]; then
OUTPUT_FILE_TYPE='text/x-yaml'
+ elif [ "$EXT" == 'json' ]; then
+ OUTPUT_FILE_TYPE='application/json'
elif [ "$EXT" == 'sh' ]; then
OUTPUT_FILE_TYPE='text/x-shellscript'
elif [ "$EXT" == 'gz' ]; then
@@ -185,9 +251,9 @@ upload_raw_file()
if [ "$MVN_DEPLOYMENT_TYPE" == 'SNAPSHOT' ]; then
- SEND_TO="${REPO}/${FQDN}/snapshots"
+ SEND_TO="${REPO}/${MVN_PROJECT_GROUPID}/snapshots"
elif [ "$MVN_DEPLOYMENT_TYPE" == 'STAGING' ]; then
- SEND_TO="${REPO}/${FQDN}/releases"
+ SEND_TO="${REPO}/{$MVN_PROJECT_GROUPID}/releases"
else
echo "Unreconfnized deployment type, quit"
exit
@@ -226,11 +292,40 @@ upload_files_of_extension()
}
+generate_pypirc_then_publish()
+{
+ set +x
+ USER=$(xpath -e "//servers/server[id='$MVN_PYPISERVER_SERVERID']/username/text()" "$SETTINGS_FILE")
+ PASS=$(xpath -e "//servers/server[id='$MVN_PYPISERVER_SERVERID']/password/text()" "$SETTINGS_FILE")
+
+ if [[ "$MVN_PYPISERVER_BASEURL" != */ ]]; then
+ MVN_PYPISERVER_BASEURL="${MVN_PYPISERVER_BASEURL}/"
+ fi
+
+
+ cat > ~/.pypirc <<EOL
+[distutils]
+index-servers =
+ $MVN_PYPISERVER_SERVERID
+
+[$MVN_PYPISERVER_SERVERID]
+repository: $MVN_PYPISERVER_BASEURL
+username: $USER
+password: $PASS
+EOL
+
+ # this may fail if a package of same version exists
+ python setup.py sdist register -r "$MVN_PYPISERVER_SERVERID" upload -r "$MVN_PYPISERVER_SERVERID"
+ set -x
+}
+
+
build_and_push_docker()
{
- IMAGENAME="onap/${FQDN}.${MVN_PROJECT_MODULEID}"
+ IMAGENAME="onap/${MVN_PROJECT_GROUPID}.${MVN_PROJECT_MODULEID}"
IMAGENAME=$(echo "$IMAGENAME" | sed -e 's/_*$//g' -e 's/\.*$//g')
+ IMAGENAME=$(echo "$IMAGENAME" | tr '[:upper:]' '[:lower:]')
# use the major and minor version of the MVN artifact version as docker image version
VERSION="${MVN_PROJECT_VERSION//[^0-9.]/}"
@@ -242,20 +337,23 @@ build_and_push_docker()
REPO=""
if [ $MVN_DEPLOYMENT_TYPE == "SNAPSHOT" ]; then
- REPO=$MVN_DOCKERREGISTRY_DAILY
+ REPO=$MVN_DOCKERREGISTRY_SNAPSHOT
+ SERVERID=$MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID
elif [ $MVN_DEPLOYMENT_TYPE == "STAGING" ]; then
# there seems to be no staging docker registry? set to use SNAPSHOT also
#REPO=$MVN_DOCKERREGISTRY_RELEASE
- REPO=$MVN_DOCKERREGISTRY_DAILY
+ REPO=$MVN_DOCKERREGISTRY_SNAPSHOT
+ SERVERID=$MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID
else
echo "Fail to determine DEPLOYMENT_TYPE"
- REPO=$MVN_DOCKERREGISTRY_DAILY
+ REPO=$MVN_DOCKERREGISTRY_SNAPSHOT
+ SERVERID=$MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID
fi
echo "DEPLOYMENT_TYPE is: $MVN_DEPLOYMENT_TYPE, repo is $REPO"
if [ ! -z "$REPO" ]; then
- USER=$(xpath -e "//servers/server[id='$REPO']/username/text()" "$SETTINGS_FILE")
- PASS=$(xpath -e "//servers/server[id='$REPO']/password/text()" "$SETTINGS_FILE")
+ USER=$(xpath -e "//servers/server[id='$SERVERID']/username/text()" "$SETTINGS_FILE")
+ PASS=$(xpath -e "//servers/server[id='$SERVERID']/password/text()" "$SETTINGS_FILE")
if [ -z "$USER" ]; then
echo "Error: no user provided"
fi
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
index 5b183e2..14b1124 100755
--- a/mvn-phase-script.sh
+++ b/mvn-phase-script.sh
@@ -18,6 +18,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
set -ex
@@ -25,73 +26,38 @@ echo "running script: [$0] for module [$1] at stage [$2]"
MVN_PROJECT_MODULEID="$1"
MVN_PHASE="$2"
-
PROJECT_ROOT=$(dirname $0)
-FQDN="${MVN_PROJECT_GROUPID}.${MVN_PROJECT_ARTIFACTID}"
-if [ "$MVN_PROJECT_MODULEID" == "__" ]; then
- MVN_PROJECT_MODULEID=""
-fi
-
-if [[ "$MVN_PROJECT_VERSION" == *SNAPSHOT ]]; then
- echo "=> for SNAPSHOT artifact build"
- MVN_DEPLOYMENT_TYPE='SNAPSHOT'
-else
- echo "=> for STAGING/RELEASE artifact build"
- MVN_DEPLOYMENT_TYPE='STAGING'
-fi
-echo "MVN_DEPLOYMENT_TYPE is [$MVN_DEPLOYMENT_TYPE]"
-
-
-TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
-
# expected environment variables
if [ -z "${MVN_NEXUSPROXY}" ]; then
echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
- exit
+ exit 1
fi
-MVN_NEXUSPROXY_HOST=$(echo "$MVN_NEXUSPROXY" |cut -f3 -d'/' | cut -f1 -d':')
-echo "=> Nexus Proxy at $MVN_NEXUSPROXY_HOST, $MVN_NEXUSPROXY"
-
-if [ -z "$WORKSPACE" ]; then
- WORKSPACE=$(pwd)
-fi
-
if [ -z "$SETTINGS_FILE" ]; then
echo "SETTINGS_FILE environment variable not set. Cannot proceed"
- exit
+ exit 2
fi
-
-# mvn phase in life cycle
-MVN_PHASE="$2"
+source "${PROJECT_ROOT}"/mvn-phase-lib.sh
-echo "MVN_PROJECT_MODULEID is [$MVN_PROJECT_MODULEID]"
-echo "MVN_PHASE is [$MVN_PHASE]"
-echo "MVN_PROJECT_GROUPID is [$MVN_PROJECT_GROUPID]"
-echo "MVN_PROJECT_ARTIFACTID is [$MVN_PROJECT_ARTIFACTID]"
-echo "MVN_PROJECT_VERSION is [$MVN_PROJECT_VERSION]"
-echo "MVN_NEXUSPROXY is [$MVN_NEXUSPROXY]"
-echo "MVN_RAWREPO_BASEURL_UPLOAD is [$MVN_RAWREPO_BASEURL_UPLOAD]"
-echo "MVN_RAWREPO_BASEURL_DOWNLOAD is [$MVN_RAWREPO_BASEURL_DOWNLOAD]"
-MVN_RAWREPO_HOST=$(echo "$MVN_RAWREPO_BASEURL_UPLOAD" | cut -f3 -d'/' |cut -f1 -d':')
-echo "MVN_RAWREPO_HOST is [$MVN_RAWREPO_HOST]"
-echo "MVN_RAWREPO_SERVERID is [$MVN_RAWREPO_SERVERID]"
-echo "MVN_DOCKERREGISTRY_DAILY is [$MVN_DOCKERREGISTRY_DAILY]"
-echo "MVN_DOCKERREGISTRY_RELEASE is [$MVN_DOCKERREGISTRY_RELEASE]"
+# This is the base for where "deploy" will upload
+# MVN_NEXUSPROXY is set in the pom.xml
+REPO=$MVN_NEXUSPROXY/content/sites/raw/$MVN_PROJECT_GROUPID
+TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
+export BUILD_NUMBER="${TIMESTAMP}"
-source "${PROJECT_ROOT}"/mvn-phase-lib.sh
-# Customize the section below for each project
+shift 2
+
case $MVN_PHASE in
clean)
echo "==> clean phase script"
clean_templated_files
clean_tox_files
- rm -rf ./venv-* ./*.wgn
+ rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
;;
generate-sources)
echo "==> generate-sources phase script"
@@ -102,6 +68,9 @@ compile)
;;
test)
echo "==> test phase script"
+ set +e
+ run_tox_test
+ set -e
;;
package)
echo "==> package phase script"
@@ -125,7 +94,6 @@ deploy)
echo "====> unknown mvn project module"
;;
esac
-
;;
*)
echo "==> unprocessed phase"
diff --git a/pom.xml b/pom.xml
index ffaf597..5329205 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,13 +21,13 @@ limitations under the License.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
+ <groupId>org.onap.dcaegen2</groupId>
+ <artifactId>root</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<!--- CHANGE THE FOLLOWING 3 OBJECTS for your own repo -->
- <groupId>org.onap.dcaegen2</groupId>
+ <groupId>org.onap.dcaegen2.deployments</groupId>
<artifactId>deployments</artifactId>
<name>dcaegen2-deployments</name>
@@ -141,15 +141,19 @@ limitations under the License.
<executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable>
<environmentVariables>
<!-- make mvn properties as env for our script -->
- <MVN_PROJECT_GROUPID>${project.parent.groupId}</MVN_PROJECT_GROUPID>
- <MVN_PROJECT_ARTIFACTID>${project.parent.artifactId}</MVN_PROJECT_ARTIFACTID>
- <MVN_PROJECT_VERSION>${project.parent.version}</MVN_PROJECT_VERSION>
+ <MVN_PROJECT_GROUPID>${project.groupId}</MVN_PROJECT_GROUPID>
+ <MVN_PROJECT_ARTIFACTID>${project.artifactId}</MVN_PROJECT_ARTIFACTID>
+ <MVN_PROJECT_VERSION>${project.version}</MVN_PROJECT_VERSION>
<MVN_NEXUSPROXY>${onap.nexus.url}</MVN_NEXUSPROXY>
<MVN_RAWREPO_BASEURL_UPLOAD>${onap.nexus.rawrepo.baseurl.upload}</MVN_RAWREPO_BASEURL_UPLOAD>
<MVN_RAWREPO_BASEURL_DOWNLOAD>${onap.nexus.rawrepo.baseurl.download}</MVN_RAWREPO_BASEURL_DOWNLOAD>
<MVN_RAWREPO_SERVERID>${onap.nexus.rawrepo.serverid}</MVN_RAWREPO_SERVERID>
- <MVN_DOCKERREGISTRY_DAILY>${onap.nexus.dockerregistry.daily}</MVN_DOCKERREGISTRY_DAILY>
+ <MVN_DOCKERREGISTRY_SNAPSHOT>${onap.nexus.dockerregistry.snapshot}</MVN_DOCKERREGISTRY_SNAPSHOT>
<MVN_DOCKERREGISTRY_RELEASE>${onap.nexus.dockerregistry.release}</MVN_DOCKERREGISTRY_RELEASE>
+ <MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID>${onap.nexus.dockerregistry.snapshot.serverid}</MVN_DOCKERREGISTRY_SNAPSHOT_SERVERID>
+ <MVN_DOCKERREGISTRY_RELEASE_SERVERID>${onap.nexus.dockerregistry.release.serverid}</MVN_DOCKERREGISTRY_RELEASE_SERVERID>
+ <MVN_PYPISERVER_BASEURL>${onap.nexus.pypiserver.baseurl}</MVN_PYPISERVER_BASEURL>
+ <MVN_PYPISERVER_SERVERID>${onap.nexus.pypiserver.serverid}</MVN_PYPISERVER_SERVERID>
</environmentVariables>
</configuration>
</plugin>
diff --git a/scripts/pom.xml b/scripts/pom.xml
index c46a573..f72a9a0 100644
--- a/scripts/pom.xml
+++ b/scripts/pom.xml
@@ -21,7 +21,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.dcaegen2</groupId>
+ <groupId>org.onap.dcaegen2.deployments</groupId>
<artifactId>deployments</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>