4 DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
5 echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
8 BUILD_ARGS="--no-cache"
12 VERSION="${DOCKER_VER}-SNAPSHOT"
14 IMAGE="wfengine-mgrservice"
15 DOCKER_REPOSITORY="nexus3.onap.org:10003"
16 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
17 TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
19 if [ -z $NEXUS_REPOS_URL ]; then
20 NEXUS_REPOS_URL="https://nexus.onap.org"
26 mvncmd=$(whereis mvn | grep ^mvn |awk '{print $2}')
27 if [[ 1$mvncmd != 1 ]]; then
32 elif [ $M2_HOME ]; then
34 mvncmd=$M2_HOME/bin/mvn
35 elif [ -f "/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn" ]; then
36 echo /w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn
37 mvncmd="/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn"
38 elif [ -f "/usr/share/maven/bin/mvn" ]; then
39 mvncmd="/usr/share/maven/bin/mvn"
41 echo "Maven is not installed, mvncmd=$mvncmd"
44 echo "mvncmd=${mvncmd}"
47 VERSION=$(printf 'VER\t${project.version}'|$mvncmd help:evaluate|grep '^VER'|cut -f2)
48 echo "VERSION=${VERSION}"
50 cd ${DOCKER_BUILD_DIR}
51 if [[ $VERSION != *-SNAPSHOT ]]; then
52 NEXUSREPONAME="releases"
54 NEXUSREPONAME="snapshots"
56 echo "NEXUSREPONAME=${NEXUSREPONAME}"
58 if [ $HTTP_PROXY ]; then
59 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
60 CURLPROXY="-x ${HTTP_PROXY}"
62 if [ $http_proxy ]; then
63 BUILD_ARGS+=" --build-arg HTTP_PROXY=${http_proxy}"
64 CURLPROXY="-x ${http_proxy}"
66 if [ $HTTPS_PROXY ]; then
67 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
68 CURLPROXY="-x ${HTTS_PROXY}"
70 if [ $https_proxy ]; then
71 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${https_proxy}"
72 CURLPROXY="-x ${https_proxy}"
74 echo "CURLPROXY=${CURLPROXY}"
76 rm -f ./bin/workflow-engine-mgr-service*.jar
77 echo "${CURLPROXY}" -m 300 -O -J -L "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}" LATEST
78 #curl "${CURLPROXY}" -m 300 -O -J -L "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
79 #wget -O workflow-engine-mgr-service.jar "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
80 wget -O workflow-engine-mgr-service.jar "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=snapshots&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}-SNAPSHOT"
81 mv workflow-engine-mgr-service*.jar ./bin/workflow-engine-mgr-service.jar
83 function build_image {
84 echo "Start build docker image: ${IMAGE_NAME}"
85 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
88 function push_image_tag {
90 echo "Start push ${TAG_NAME}"
91 docker tag ${IMAGE_NAME}:latest ${TAG_NAME}
92 docker push ${TAG_NAME}
96 echo "Start push ${IMAGE_NAME}:latest"
97 docker push ${IMAGE_NAME}:latest
99 push_image_tag ${IMAGE_NAME}:${DOCKER_VER}-SNAPSHOT-latest
100 push_image_tag ${IMAGE_NAME}:${DOCKER_VER}-STAGING-latest
101 push_image_tag ${IMAGE_NAME}:${DOCKER_VER}-STAGING-${TIMESTAMP}