blob: b39efbe8f491e3472ed430151e42f6c9385556c7 [file] [log] [blame]
lj14120555df32017-02-20 03:25:58 +00001#!/bin/bash
2#
3#
4# 1 fetch DCAE Controller service manager
5# 2 build the docker imagei with both service manager and ves collector
6# 3 tag and then push to the remote repo
7#
8#
9# !!! make sure the yaml jjb file includes docker-login as a builder
10# before calling this script
11
12
13# io registry DOCKER_REPOSITORIES="nexus3.openecomp.org:10001 \
14# release registry nexus3.openecomp.org:10002 \
15# snapshot registry nexus3.openecomp.org:10003"
16
17
18
19# downloading DCAE Controller service manager for VES collector
20GROUP_ID='org.openecomp.dcae.controller'
21ARTIFACT_ID='dcae-controller-service-standardeventcollector-manager'
22VERSION='0.1.0-SNAPSHOT'
23FORMAT='zip'
24SCOPE='runtime'
25ARTIFACT_FQID="${GROUP_ID}:${ARTIFACT_ID}:${VERSION}:${FORMAT}:${SCOPE}"
26ARTIFACT_FILENAME="${ARTIFACT_ID}-${VERSION}-${SCOPE}.${FORMAT}"
27mvn -s "$SETTINGS_FILE" \
28 org.apache.maven.plugins:maven-dependency-plugin:2.10:copy \
29 -Dartifact="${ARTIFACT_FQID}" -DoutputDirectory=/tmp
30DCM_AR="/tmp/${ARTIFACT_FILENAME}"
31if [ ! -f "${DCM_AR}" ]
32then
33 echo "FATAL error cannot locate ${DCM_AR}"
34 exit 2
35fi
36
37# unarchive the service manager
38TARGET="${WORKSPACE}/target"
39STAGE="${TARGET}/stage"
40DCM_DIR="${STAGE}/opt/app/manager"
41[ ! -d "${DCM_DIR}" ] && mkdir -p "${DCM_DIR}"
42unzip -qo -d "${DCM_DIR}" "${DCM_AR}"
43
44#
45# generate the manager start-up.sh
46#
47[ -f "${DCM_DIR}/start-manager.sh" ] && exit 0
48
49cat <<EOF > "${DCM_DIR}/start-manager.sh"
50#!/bin/bash
51
52MAIN='org.openecomp.dcae.controller.service.standardeventcollector.servers.manager.DcaeControllerServiceStandardeventcollectorManagerServer'
53ACTION='start'
54
55WORKDIR='/opt/app/manager'
56LOGS="${WORKDIR}/logs"
57
58[ ! -d "$LOGS" ] && mkdir -p "$LOGS"
59
60echo 10.0.4.102 $(hostname).dcae.simpledemo.openecomp.org >> /etc/hosts
61
62exec java -cp ./config:./lib:./lib/*:./bin "${MAIN}" "${ACTION}" \
63 > logs/manager.out 2>logs/manager.err
64EOF
65
66chmod 775 "${DCM_DIR}/start-manager.sh"
67
68
69#
70# generate docker file
71#
72cat <<EOF > "${STAGE}/Dockerfile"
73FROM ubuntu:14.04
74
75MAINTAINER dcae@lists.openecomp.org
76
77WORKDIR /opt/app/manager
78
79ENV HOME /opt/app/SEC
80ENV JAVA_HOME /usr
81
82RUN apt-get update && apt-get install -y \
83 bc \
84 curl \
85 telnet \
86 vim \
87 netcat \
88 openjdk-7-jdk
89
90COPY opt /opt
91
92EXPOSE 9999
93
94CMD [ '/opt/app/manager/start-manager.sh' ]
95EOF
96
97#
98# build the docker image. tag and then push to the remote repo
99#
100IMAGE='dcae-controller-common-event'
101TAG='1.0.0'
102LFQI="${IMAGE}:${TAG}"
103BUILD_PATH="${WORKSPACE}/target/stage"
104
105# build a docker image
106docker build --rm -t "${LFQI}" "${BUILD_PATH}"
107
108
109#
110# push the image
111#
112# io registry DOCKER_REPOSITORIES="nexus3.openecomp.org:10001 \
113# release registry nexus3.openecomp.org:10002 \
114# snapshot registry nexus3.openecomp.org:10003"