--- /dev/null
+**/__pycache__
# See the License for the specific language governing permissions and
# limitations under the License.
# ==================================================================================
-# TODO: switch to alpine once rmr apk available
-FROM python:3.7
+FROM python:3.7-alpine
-COPY . /tmp
-WORKDIR /tmp
-
-# copy NNG out of the CI builder nng
-COPY --from=nexus3.o-ran-sc.org:10004/bldr-debian-python:3-py3.7-nng1.1.1 /usr/local/lib/libnng.so /usr/local/lib/libnng.so
+# copy NNG and rmr out of the CI builder nng
+COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3:3-a3.9 /usr/local/lib64/libnng.so /usr/local/lib64/libnng.so
+COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3:3-a3.9 /usr/local/lib64/librmr_nng.so /usr/local/lib64/librmr_nng.so
-# Installs RMr using debian package hosted at packagecloud.io
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/master/packages/debian/stretch/rmr_1.0.36_amd64.deb/download.deb
-RUN dpkg -i rmr_1.0.36_amd64.deb
+COPY a1/ /tmp/a1
+COPY tests/ /tmp/tests
+COPY setup.py tox.ini /tmp/
+WORKDIR /tmp
# dir that rmr routing file temp goes into
RUN mkdir -p /opt/route/
-# Install RMr python bindings
-# this writes into /usr/local, need root
-RUN pip install --upgrade pip && pip install rmr==0.10.1 tox
-
-# Run the unit tests
-RUN tox
+# Gevent needs gcc; TODO: this will get fixed
+RUN apk add gcc musl-dev
-# do the actual install
+# do the actual install; this writes into /usr/local, need root
RUN pip install .
# Switch to a non-root user for security reasons.
# a1 does not currently write into any dirs so no chowns are needed at this time.
-# https://stackoverflow.com/questions/27701930/add-user-to-docker-container
-RUN adduser --disabled-password --gecos '' a1user
-USER a1user
+ENV A1USER a1user
+RUN addgroup -S $A1USER && adduser -S -G $A1USER $A1USER
+USER $A1USER
# misc setups
EXPOSE 10000
-ENV LD_LIBRARY_PATH /usr/local/lib
+ENV LD_LIBRARY_PATH /usr/local/lib/:/usr/local/lib64
ENV RMR_SEED_RT /opt/route/local.rt
CMD run.py
--- /dev/null
+# ==================================================================================
+# Copyright (c) 2019 Nokia
+# Copyright (c) 2018-2019 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==================================================================================
+FROM python:3.7-alpine
+
+# copy NNG and rmr out of the CI builder nng
+COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3:3-a3.9 /usr/local/lib64/libnng.so /usr/local/lib64/libnng.so
+COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3:3-a3.9 /usr/local/lib64/librmr_nng.so /usr/local/lib64/librmr_nng.so
+
+COPY a1/ /tmp/a1
+COPY tests/ /tmp/tests
+COPY setup.py tox.ini /tmp/
+WORKDIR /tmp
+
+# dir that rmr routing file temp goes into
+RUN mkdir -p /opt/route/
+
+# Gevent needs gcc; TODO: this will get fixed
+RUN apk add gcc musl-dev
+
+# Upgrade pip, install tox
+RUN pip install --upgrade pip && pip install tox
+
+# Run the unit tests
+RUN tox
# The Jenkins job uses this string for the tag in the image name
# for example nexus3.o-ran-sc.org:10004/my-image-name:my-tag
---
-tag: 0.10.0
+tag: 0.10.1
tox
open htmlcov/index.html
+Alternatively, you can run the unit tests in Docker (this is somewhat less nice because you don't get the pretty HTML)
+
+::
+
+ docker build --no-cache -t a1test:latest -f Dockerfile-Unit-Test
+
Integration testing
===================
This tests A1’s external API with two test receivers. This depends on helm+k8s, meaning you cannot run this if this is not installed.
The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
and this project adheres to `Semantic Versioning <http://semver.org/>`__.
+[0.10.1] - 8/9/2019
+
+::
+
+ * Greatly reduce the size of A1 docker from 1.25GB to ~278MB.
+ * Add a seperate dockerfile for unit testing
+
+
[0.10.0] - 7/30/2019
::
apiVersion: v1
description: A1 Helm chart for Kubernetes
name: a1mediator
-version: 0.10.0
+version: 0.10.1
setup(
name="a1",
- version="0.10.0",
+ version="0.10.1",
packages=find_packages(exclude=["tests.*", "tests"]),
author="Tommy Carpenter",
description="RIC A1 Mediator for policy/intent changes",
url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/a1",
entry_points={"console_scripts": ["run.py=a1.run:main"]},
# we require jsonschema, should be in that list, but connexion already requires a specific version of it
- install_requires=["requests", "Flask", "connexion[swagger-ui]", "gevent", "rmr>=0.10.0"],
+ # rmr 0.10.4 has a bugfix required on alpine
+ install_requires=["requests", "Flask", "connexion[swagger-ui]", "gevent", "rmr>=0.10.4"],
package_data={"a1": ["openapi.yaml"]},
)
commands_pre=
helm install --devel testreceiver -n testreceiver
helm install --devel a1mediator/ -n a1
- sleep 10
+ sleep 20
./portforward.sh
sleep 2
commands=
coverage
pytest-cov
setenv =
- LD_LIBRARY_PATH = /usr/local/lib/
+ LD_LIBRARY_PATH = /usr/local/lib/:/usr/local/lib64
RMR_RCV_RETRY_INTERVAL = 1
RMR_RETRY_TIMES = 2
commands=