summaryrefslogtreecommitdiffstats
path: root/policy-management/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'policy-management/src/main')
-rw-r--r--policy-management/src/main/server-gen/bin/deploy-artifact53
1 files changed, 47 insertions, 6 deletions
diff --git a/policy-management/src/main/server-gen/bin/deploy-artifact b/policy-management/src/main/server-gen/bin/deploy-artifact
index 2fc101bd..dab945a8 100644
--- a/policy-management/src/main/server-gen/bin/deploy-artifact
+++ b/policy-management/src/main/server-gen/bin/deploy-artifact
@@ -5,6 +5,7 @@
# ONAP
# ================================================================================
# Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2020 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -205,6 +206,40 @@ function getPomAttributes
}
##############################################################################
+# Usage: setMavenProxyArgs
+#
+# This function performs parsing of http proxy environment variable if provided,
+# extracting the attributes such as proxy host, port, username and password.
+# These proxy attributes are set into the global variable for maven proxy
+# settings to be used as build arguments with maven commands.
+##############################################################################
+
+function setMavenProxyArgs
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ if [[ -z ${http_proxy} ]]; then
+ return 0
+ fi
+
+ local proxy_creds=${http_proxy#*//}
+ local proxy=${proxy_creds#*@}
+ local host=${proxy%:*}
+ local port=${proxy#*:}
+ MVN_PROXY_SETTINGS="-DproxyHost=${host} -DproxyPort=${port}"
+
+ if [[ "$proxy_creds" == *"@"* ]]; then
+ local creds=${proxy_creds%%@*}
+ local username=${creds%:*}
+ local password=${creds#*:}
+ MVN_PROXY_SETTINGS+=" -DproxyUsername=${username} -DproxyPassword=${password}"
+ fi
+}
+
+##############################################################################
# Usage: deployJar <jar-file>
#
# This function deploys a JAR file in a repository, as well as
@@ -241,7 +276,7 @@ function deployJar
echo "${file}: deploying jar artifact to repository ${repoId}: ${repoUrl}"
echo "${file}: coordinates ${groupId} ${artifactId} ${version}"
- mvn ${CUSTOM_SETTINGS} deploy:deploy-file \
+ mvn ${CUSTOM_SETTINGS} ${MVN_PROXY_SETTINGS} deploy:deploy-file \
-Dfile="${file}" \
-Dversion="${version}" \
-Dpackaging=jar \
@@ -290,7 +325,7 @@ function deployPom
echo "${file}: deploying pom artifact to repository ${repoId}: ${repoUrl}"
echo "${file}: coordinates ${groupId} ${artifactId} ${version}"
- mvn ${CUSTOM_SETTINGS} deploy:deploy-file \
+ mvn ${CUSTOM_SETTINGS} ${MVN_PROXY_SETTINGS} deploy:deploy-file \
-Dfile="${file}" \
-Dpackaging=pom \
-DgeneratePom=false \
@@ -362,8 +397,8 @@ function installJar
return 1
fi
- mvn ${CUSTOM_SETTINGS} org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \
- -Dfile="${file}"
+ mvn ${CUSTOM_SETTINGS} ${MVN_PROXY_SETTINGS} \
+ org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile="${file}"
return $?
}
@@ -387,7 +422,8 @@ function installPom
return 1
fi
- mvn ${CUSTOM_SETTINGS} org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \
+ mvn ${CUSTOM_SETTINGS} ${MVN_PROXY_SETTINGS} \
+ org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \
-Dpackaging=pom \
-Dfile="${file}" \
-DpomFile="${file}"
@@ -462,7 +498,8 @@ function installDependencies
echo "${file}: deploying dependencies from repository ${DEPENDENCY_REPO_URL}"
echo "${file}: coordinates ${groupId} ${artifactId} ${version}"
- mvn ${CUSTOM_SETTINGS} org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get \
+ mvn ${CUSTOM_SETTINGS} ${MVN_PROXY_SETTINGS} \
+ org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get \
-DartifactId="${artifactId}" \
-DgroupId="${groupId}" \
-Dversion="${version}" \
@@ -492,6 +529,7 @@ unset WORKING_POM_PROPERTIES
unset DEPENDENCY_REPO_URL
unset SETTINGS_FILE
unset CUSTOM_SETTINGS
+unset MVN_PROXY_SETTINGS
# process input
@@ -526,6 +564,9 @@ if [[ -n ${SETTINGS_FILE} ]]; then
CUSTOM_SETTINGS="--settings=${SETTINGS_FILE}"
fi
+# Set proxy attributes into MVN_PROXY_SETTINGS variable
+setMavenProxyArgs
+
# retval has the count of failed operations
retval=0