diff options
-rw-r--r-- | component-json-schemas/pom.xml | 246 | ||||
-rw-r--r-- | dcae-cli/pom.xml | 67 | ||||
-rwxr-xr-x | mvn-phase-lib.sh | 104 | ||||
-rwxr-xr-x | mvn-phase-script.sh | 88 | ||||
-rw-r--r-- | pom.xml | 26 |
5 files changed, 385 insertions, 146 deletions
diff --git a/component-json-schemas/pom.xml b/component-json-schemas/pom.xml new file mode 100644 index 0000000..81e02da --- /dev/null +++ b/component-json-schemas/pom.xml @@ -0,0 +1,246 @@ +<?xml version="1.0"?> +<!-- +================================================================================ +Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +================================================================================ +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END========================================================= + +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.platform.cli</groupId> + <artifactId>cli</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.dcaegen2.platform.cli</groupId> + <artifactId>component-json-schemas</artifactId> + <name>dcaegen2-platform-cli-component-json-schemas</name> + <version>1.0.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <sonar.sources>.</sonar.sources> + <!-- customize the SONARQUBE URL --> + <!-- sonar.host.url>http://localhost:9000</sonar.host.url --> + <!-- below are language dependent --> + <!-- for Python --> + <sonar.language>py</sonar.language> + <sonar.pluginName>Python</sonar.pluginName> + <sonar.inclusions>**/*.py</sonar.inclusions> + <!-- for JavaScaript --> + <!-- + <sonar.language>js</sonar.language> + <sonar.pluginName>JS</sonar.pluginName> + <sonar.inclusions>**/*.js</sonar.inclusions> + --> + </properties> + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <pluginManagement> + <plugins> + <!-- the following plugins are invoked from oparent, we do not need them --> + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>nexus-staging-maven-plugin</artifactId> + <version>1.6.7</version> + <configuration> + <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <!-- This version supports the "deployAtEnd" parameter --> + <version>2.8</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <!-- first disable the default Java plugins at various stages --> + <!-- maven-resources-plugin is called during "*resource" phases by default behavior. it prepares + the resources dir. we do not need it --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <!-- maven-compiler-plugin is called during "compile" phases by default behavior. we do not need it --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <!-- maven-jar-plugin is called during "compile" phase by default behavior. we do not need it --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.4</version> + <executions> + <execution> + <id>default-jar</id> + <phase/> + </execution> + </executions> + </plugin> + <!-- maven-install-plugin is called during "install" phase by default behavior. it tries to copy stuff under + target dir to ~/.m2. we do not need it --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>2.4</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <!-- maven-surefire-plugin is called during "test" phase by default behavior. it triggers junit test. + we do not need it --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.12.4</version> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <!-- plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.4.1</version> + <configuration> + <descriptors> + <descriptor>assembly/dep.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin --> + <!-- now we configure custom action (calling a script) at various lifecycle phases --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <id>clean phase script</id> + <phase>clean</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>clean</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>generate-sources script</id> + <phase>generate-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>generate-sources</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>compile script</id> + <phase>compile</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>compile</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>package script</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>package</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>test script</id> + <phase>test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>test</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>install script</id> + <phase>install</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>install</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>deploy script</id> + <phase>deploy</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>${project.artifactId}</argument> + <argument>deploy</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/dcae-cli/pom.xml b/dcae-cli/pom.xml index e7f5534..f0f907a 100644 --- a/dcae-cli/pom.xml +++ b/dcae-cli/pom.xml @@ -21,13 +21,13 @@ 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.platform</groupId> + <groupId>org.onap.dcaegen2.platform.cli</groupId> <artifactId>cli</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <groupId>org.onap.dcaegen2.platform.cli</groupId> <artifactId>dcae-cli</artifactId> - <name>dcae-cli</name> + <name>dcaegen2-platform-cli-dcae-cli</name> <version>1.0.0-SNAPSHOT</version> <url>http://maven.apache.org</url> <properties> @@ -155,19 +155,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>clean</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -177,19 +168,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>generate-sources</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -199,19 +181,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>compile</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -221,19 +194,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>package</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -243,19 +207,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>test</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -265,19 +220,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>install</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> <execution> @@ -287,19 +233,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <goal>exec</goal> </goals> <configuration> - <executable>mvn-phase-script.sh</executable> <arguments> <argument>${project.artifactId}</argument> <argument>deploy</argument> </arguments> - <environmentVariables> - <!-- make mvn properties as env for our script --> - <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_DOCKERREG_URL>${docker.push.registry}</MVN_DOCKERREG_URL--> - </environmentVariables> </configuration> </execution> </executions> diff --git a/mvn-phase-lib.sh b/mvn-phase-lib.sh index 2a924f7..5a25896 100755 --- a/mvn-phase-lib.sh +++ b/mvn-phase-lib.sh @@ -19,6 +19,68 @@ # 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}.${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 +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_DAILY is [$MVN_DOCKERREGISTRY_DAILY]" +echo "MVN_DOCKERREGISTRY_RELEASE is [$MVN_DOCKERREGISTRY_RELEASE]" + +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 +114,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 +231,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 +249,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,20 +290,48 @@ 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=$(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.]/}" VERSION2=$(echo "$VERSION" | cut -f1-2 -d'.') LFQI="${IMAGENAME}:${VERSION}-${TIMESTAMP}" - BUILD_PATH="${WORKSPACE}" # build a docker image - docker build --rm -f "${WORKSPACE}"/Dockerfile -t "${LFQI}" "${BUILD_PATH}" + docker build --rm -f ./Dockerfile -t "${LFQI}" ./ REPO="" if [ $MVN_DEPLOYMENT_TYPE == "SNAPSHOT" ]; then diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index 7a74cbe..cbf8dd6 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,75 +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 -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) + exit 1 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 +shift 2 -# Customize the section below for each project 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" @@ -104,6 +68,9 @@ compile) ;; test) echo "==> test phase script" + set +e + run_tox_test + set -e ;; package) echo "==> package phase script" @@ -113,30 +80,19 @@ install) ;; deploy) echo "==> deploy phase script" - case $MVN_PROJECT_MODULEID in - platformdoc) - set -x - CURDIR=$(pwd) - virtualenv ./venv-doc - source ./venv-doc/bin/activate - pip install --upgrade pip - pip install --upgrade mkdocs mkdocs-material - pip freeze - - mkdocs build - build_and_push_docker - deactivate - rm -rf ./venv-doc - - # build docker image from Docker file (under module dir) and push to registry - build_and_push_docker + dcae-cli) + ;; + component-json-schemas) + JSON_FILES_WITH_PATH=$(find . -name *json) + for JSON_FILE in $JSON_FILES_WITH_PATH; do + upload_raw_file "$JSON_FILE" + done ;; *) - echo "====> unknown mvn project module" + #generate_pypirc_then_publish ;; esac - ;; *) echo "==> unprocessed phase" @@ -22,8 +22,8 @@ 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.oparent</groupId> - <artifactId>oparent</artifactId> + <groupId>org.onap.dcaegen2</groupId> + <artifactId>root</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <!-- parent> @@ -31,20 +31,23 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <artifactId>plugins</artifactId> <version>1.0.0</version> </parent --> - <groupId>org.onap.dcaegen2.platform</groupId> + <groupId>org.onap.dcaegen2.platform.cli</groupId> <artifactId>cli</artifactId> - <name>dcaegen2-platform-cli</name> + <name>dcaegen2-platform-cli-cli</name> <version>1.0.0-SNAPSHOT</version> <url>http://maven.apache.org</url> <packaging>pom</packaging> <modules> <module>dcae-cli</module> + <module>component-json-schemas</module> </modules> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.skip>true</sonar.skip> - <sonar.sources>.</sonar.sources> + <sonar.sources>*/</sonar.sources> + <sonar.junit.reportsPath>**/xunit-results.xml</sonar.junit.reportsPath> + <sonar.python.coverage.reportPath>**/coverage.xml</sonar.python.coverage.reportPath> <!-- customize the SONARQUBE URL --> <!-- sonar.host.url>http://localhost:9000</sonar.host.url --> <!-- below are language dependent --> @@ -142,15 +145,20 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable> <environmentVariables> <!-- make mvn properties as env for our script --> - <MVN_PROJECT_GROUPID>${parent.groupId}</MVN_PROJECT_GROUPID> - <MVN_PROJECT_ARTIFACTID>${parent.artifactId}</MVN_PROJECT_ARTIFACTID> - <MVN_PROJECT_VERSION>${parent.version}</MVN_PROJECT_VERSION> + <!-- make mvn properties as env for our script --> + <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> |