must be executable
[ci-management.git] / jjb / dcae / script-collectors-ves-verify.sh
1 #!/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 # DCAE Controller service manager for VES collector
20 DCM_AR="${WORKSPACE}/manager.zip"
21 if [ ! -f "${DCM_AR}" ]
22 then
23     echo "FATAL error cannot locate ${DCM_AR}"
24     exit 2
25 fi
26
27 # unarchive the service manager
28 TARGET="${WORKSPACE}/target"
29 STAGE="${TARGET}/stage"
30 DCM_DIR="${STAGE}/opt/app/manager"
31 [ ! -d "${DCM_DIR}" ] && mkdir -p "${DCM_DIR}"
32 unzip -qo -d "${DCM_DIR}" "${DCM_AR}"
33
34 #
35 # generate the manager start-up.sh
36 #
37 [ -f "${DCM_DIR}/start-manager.sh" ] && exit 0
38
39 cat <<EOF > "${DCM_DIR}/start-manager.sh"
40 #!/bin/bash
41
42 MAIN='org.openecomp.dcae.controller.service.standardeventcollector.servers.manager.DcaeControllerServiceStandardeventcollectorManagerServer'
43 ACTION='start'
44
45 WORKDIR='/opt/app/manager'
46 LOGS="${WORKDIR}/logs"
47
48 [ ! -d "$LOGS" ] && mkdir -p "$LOGS"
49
50 echo 10.0.4.102 $(hostname).dcae.simpledemo.openecomp.org >> /etc/hosts
51
52 exec java -cp ./config:./lib:./lib/*:./bin "${MAIN}" "${ACTION}" \
53     > logs/manager.out 2>logs/manager.err
54 EOF
55
56 chmod 775 "${DCM_DIR}/start-manager.sh"
57
58
59 #
60 # generate docker file
61 #
62 cat <<EOF > "${STAGE}/Dockerfile"
63 FROM ubuntu:14.04
64
65 MAINTAINER dcae@lists.openecomp.org
66
67 WORKDIR /opt/app/manager
68
69 ENV HOME /opt/app/SEC
70 ENV JAVA_HOME /usr
71
72 RUN apt-get update && apt-get install -y \
73         bc \
74         curl \
75         telnet \
76         vim \
77         netcat \
78         openjdk-7-jdk
79
80 COPY opt /opt
81
82 EXPOSE 9999
83
84 CMD [ '/opt/app/manager/start-manager.sh' ]
85 EOF
86
87 #
88 # build the docker image. tag and then push to the remote repo
89 #
90 IMAGE='dcae-controller-common-event'
91 TAG='1.0.0'
92 LFQI="${IMAGE}:${TAG}"
93 BUILD_PATH="${WORKSPACE}/target/stage"
94
95 # build a docker image
96 docker build --rm -t "${LFQI}" "${BUILD_PATH}"
97
98
99 #
100 # push the image
101 #
102 # io registry  DOCKER_REPOSITORIES="nexus3.openecomp.org:10001 \
103 # release registry                   nexus3.openecomp.org:10002 \
104 # snapshot registry                   nexus3.openecomp.org:10003"