Change build-e2mgr-ubuntu.sh shell script to skip installing NNG
(already in the base image) and to use sudo when invoking dpkg to
install RMR libraries. This allows the same steps to be run in a
docker build AND sonar analysis job without duplication.
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I88f230bb0b54ad3e28042341ea351b3bd217c109
FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:3-u16.04-nng as ubuntu
WORKDIR /opt/E2Manager
FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:3-u16.04-nng as ubuntu
WORKDIR /opt/E2Manager
# Install dependencies, compile and test the module
# Install dependencies, compile and test the module
+RUN apt-get update && apt-get install -y sudo
RUN bash build-e2mgr-ubuntu.sh
# Build deployable container
RUN bash build-e2mgr-ubuntu.sh
# Build deployable container
iputils-ping \
curl \
tcpdump
iputils-ping \
curl \
tcpdump
COPY --from=ubuntu /opt/E2Manager/router.txt /opt/E2Manager/router.txt
COPY --from=ubuntu /opt/E2Manager/main /opt/E2Manager/main
COPY --from=ubuntu /opt/E2Manager/resources/configuration.yaml /opt/E2Manager/resources/configuration.yaml
COPY --from=ubuntu /opt/E2Manager/router.txt /opt/E2Manager/router.txt
COPY --from=ubuntu /opt/E2Manager/main /opt/E2Manager/main
COPY --from=ubuntu /opt/E2Manager/resources/configuration.yaml /opt/E2Manager/resources/configuration.yaml
COPY --from=ubuntu /usr/local/lib/libnng.so.1 /usr/local/lib/libnng.so.1
WORKDIR /opt/E2Manager
ENV LD_LIBRARY_PATH=/usr/local/lib \
COPY --from=ubuntu /usr/local/lib/libnng.so.1 /usr/local/lib/libnng.so.1
WORKDIR /opt/E2Manager
ENV LD_LIBRARY_PATH=/usr/local/lib \
ENV RMR_SEED_RT=router.txt
ENV RMR_VCTL_FILE=/tmp/rmr.verbose
EXPOSE 3800
ENV RMR_SEED_RT=router.txt
ENV RMR_VCTL_FILE=/tmp/rmr.verbose
EXPOSE 3800
# Installs libraries and builds E2 manager
# Prerequisites:
# Debian distro; e.g., Ubuntu
# Installs libraries and builds E2 manager
# Prerequisites:
# Debian distro; e.g., Ubuntu
-# cmake (version?)
-# gcc/g++ compiler (version?)
-# golang (go), tested with version 1.12.0
+# NNG shared library
+# golang (go); tested with version 1.12
# current working directory is E2Manager
# running with sudo privs, which is default in Docker
# current working directory is E2Manager
# running with sudo privs, which is default in Docker
-# TODO:
-# 1) drop go from $PATH when build minion is extended
-# 2) drop rewrite of path prefix when SonarScanner is extended
-
# Stop at first error and be verbose
set -eux
echo "--> e2mgr-build-ubuntu.sh"
# Stop at first error and be verbose
set -eux
echo "--> e2mgr-build-ubuntu.sh"
-# Build and install NNG, which requires ninja
-apt-get install ninja-build
-git clone https://github.com/nanomsg/nng.git \
- && cd nng \
- && git checkout e618abf8f3db2a94269a79c8901a51148d48fcc2 \
- && mkdir build \
- && cd build \
- && cmake -DBUILD_SHARED_LIBS=1 -G Ninja .. \
- && ninja \
- && ninja install \
- && cd ../.. \
- && rm -r nng
-
# Install RMR from deb packages at packagecloud.io
rmr=rmr_1.13.0_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmr/download.deb
# Install RMR from deb packages at packagecloud.io
rmr=rmr_1.13.0_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmr/download.deb
rm $rmr
rmrdev=rmr-dev_1.13.0_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmrdev/download.deb
rm $rmr
rmrdev=rmr-dev_1.13.0_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmrdev/download.deb
rm $rmrdev
# required to find nng and rmr libs
rm $rmrdev
# required to find nng and rmr libs
go build -v app/main.go
# Execute UT and measure coverage
go build -v app/main.go
# Execute UT and measure coverage
-# cgocheck=2 enables expensive checks that should not miss any errors, but will cause your program to run slower.
-# clobberfree=1 causes the garbage collector to clobber the memory content of an object with bad content when it frees the object.
-# gcstoptheworld=1 disables concurrent garbage collection, making every garbage collection a stop-the-world event.
-# Setting gcstoptheworld=2 also disables concurrent sweeping after the garbage collection finishes.
-# Setting allocfreetrace=1 causes every allocation to be profiled and a stack trace printed on each object's allocation and free.
+# cgocheck=2 enables expensive checks that should not miss any errors,
+# but will cause your program to run slower.
+# clobberfree=1 causes the garbage collector to clobber the memory content
+# of an object with bad content when it frees the object.
+# gcstoptheworld=1 disables concurrent garbage collection, making every
+# garbage collection a stop-the-world event.
+# Setting gcstoptheworld=2 also disables concurrent sweeping after the
+# garbage collection finishes.
+# Setting allocfreetrace=1 causes every allocation to be profiled and a
+# stack trace printed on each object's allocation and free.
export GODEBUG=cgocheck=2,clobberfree=1,gcstoptheworld=2,allocfreetrace=0
export RIC_ID="bbbccc-abcd0e/20"
# Static route table is provided in git repo
export GODEBUG=cgocheck=2,clobberfree=1,gcstoptheworld=2,allocfreetrace=0
export RIC_ID="bbbccc-abcd0e/20"
# Static route table is provided in git repo
# SonarCloud accepts the text format
go-acc $(go list ./... | grep -vE '(/mocks|/tests|/e2managererrors|/enums)' )
# SonarCloud accepts the text format
go-acc $(go list ./... | grep -vE '(/mocks|/tests|/e2managererrors|/enums)' )
+# TODO: drop rewrite of path prefix when SonarScanner is extended
# rewrite the module name to a directory name in the coverage report
# https://jira.sonarsource.com/browse/SONARSLANG-450
sed -i -e 's/^e2mgr/E2Manager/' coverage.txt
# rewrite the module name to a directory name in the coverage report
# https://jira.sonarsource.com/browse/SONARSLANG-450
sed -i -e 's/^e2mgr/E2Manager/' coverage.txt