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