From 116a47fff82b8c77036d07094cb71151d13bfe7f Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Fri, 24 May 2024 16:01:36 +0800 Subject: [PATCH] Upgrade the latest clients of O2IMS The O2IMS request O-Cloud (StarlingX) depends on the clients from StarlingX community. This commit will upgrade the fault client and cgts client to the latest to support the latest StarlingX version. And update the local test Dockerfile, to make sure the local test with the latest image and latest clients. Test Plan: 1. Image build succeeded with the local test Dockerfile. 2. O2 watcher service queried the O-Cloud resource and alarm successfully. Issue-ID: INF-451 Change-Id: I84236678fcef262dcd20f6bf2265b86f905d6989 Signed-off-by: Zhang Rong(Jon) --- Dockerfile.localtest | 98 ++++++++++++++++++++++++++++++++++------------------ docker-compose.yml | 3 -- requirements-stx.txt | 5 +-- 3 files changed, 68 insertions(+), 38 deletions(-) diff --git a/Dockerfile.localtest b/Dockerfile.localtest index 33fcaa8..7ced03b 100644 --- a/Dockerfile.localtest +++ b/Dockerfile.localtest @@ -1,7 +1,27 @@ -FROM python:3.11-slim-buster - -RUN apt-get update && apt-get install -y git gcc \ - vim curl procps ssh +FROM nexus3.onap.org:10001/onap/integration-python:12.0.0 +# https://nexus3.onap.org/#browse/search=keyword%3Dintegration-python:d406d405e4cfbf1186265b01088caf9a +# https://git.onap.org/integration/docker/onap-python/tree/Dockerfile + +USER root + +ARG user=orano2 +ARG group=orano2 + +# Create a group and user +RUN addgroup -S $group && adduser -S -D -h /home/$user $user $group && \ + chown -R $user:$group /home/$user && \ + mkdir /var/log/$user && \ + mkdir -p /src && \ + mkdir -p /configs/ && \ + mkdir -p /src/o2app/ && \ + mkdir -p /src/helm_sdk/ && \ + mkdir -p /etc/o2/ && \ + chown -R $user:$group /var/log/$user && \ + chown -R $user:$group /src && \ + chown -R $user:$group /configs && \ + chown -R $user:$group /etc/o2/ + +COPY requirements.txt requirements-test.txt requirements-stx.txt constraints.txt /tmp/ # in case git repo is not accessable RUN mkdir -p /cgtsclient && mkdir -p /distcloud-client @@ -9,49 +29,61 @@ COPY temp/config /cgtsclient/ COPY temp/distcloud-client /distcloud-client/ COPY temp/fault /faultclient/ -RUN pip install -e cgtsclient/sysinv/cgts-client/cgts-client/ \ - && pip install -e /distcloud-client/distributedcloud-client \ - && pip install -e /faultclient/python-fmclient/fmclient/ -# in case git repo is not accessable - -COPY requirements.txt constraints.txt requirements-test.txt /tmp/ - -RUN pip install -r /tmp/requirements.txt -c /tmp/constraints.txt \ - && pip install -r /tmp/requirements-test.txt - - -RUN mkdir -p /src COPY o2ims/ /src/o2ims/ COPY o2dms/ /src/o2dms/ COPY o2common/ /src/o2common/ - -RUN mkdir -p /src/o2app/ COPY o2app/ /src/o2app/ +COPY setup.py /src/ -RUN mkdir -p /src/helm_sdk/ COPY helm_sdk/ /src/helm_sdk/ -COPY setup.py /src/ - COPY configs/ /etc/o2/ +COPY configs/ /configs/ + +RUN apk add --no-cache \ + git \ + curl \ + bluez-dev \ + bzip2-dev \ + dpkg-dev dpkg \ + expat-dev \ + gcc \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + openssl-dev \ + pax-utils \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev + +RUN set -ex \ + && apk add --no-cache bash \ + && apk add --no-cache --virtual .fetch2-deps \ + && pip install -r /tmp/requirements.txt -c /tmp/constraints.txt \ + && pip install -r /tmp/requirements-test.txt \ + && pip install -e /cgtsclient/sysinv/cgts-client/cgts-client/ \ + && pip install -e /distcloud-client/distributedcloud-client \ + && pip install -e /faultclient/python-fmclient/fmclient/ \ + && pip install -e /src \ + && apk del --no-network .fetch2-deps -# RUN mkdir -p /helmsdk -# COPY temp/helmsdk /helmsdk/ -# # RUN git clone --depth 1 --branch master https://github.com/cloudify-incubator/cloudify-helm-plugin.git helmsdk -# COPY /helmsdk/helm_sdk /src/helm_sdk - -# RUN pip install -e /src COPY tests/ /tests/ -#RUN apt-get install -y procps vim - -#RUN apt-get install -y curl -RUN curl -O https://get.helm.sh/helm-v3.3.1-linux-amd64.tar.gz; -RUN tar -zxvf helm-v3.3.1-linux-amd64.tar.gz; cp linux-amd64/helm /usr/local/bin - RUN mkdir -p /etc/kubeconfig/ # COPY temp/kubeconfig/config /etc/kubeconfig/ RUN mkdir -p /var/log/orano2 WORKDIR /src + +# USER $user +ENV PYTHONHASHSEED=0 diff --git a/docker-compose.yml b/docker-compose.yml index 3d5b5e8..a624b56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,9 +85,6 @@ services: - "5005:80" watcher: - build: - context: . - dockerfile: Dockerfile.localtest image: o2imsdms depends_on: - redis_pubsub diff --git a/requirements-stx.txt b/requirements-stx.txt index d057d79..9f4f9f6 100644 --- a/requirements-stx.txt +++ b/requirements-stx.txt @@ -3,5 +3,6 @@ # -e git+https://opendev.org/starlingx/fault.git@master#egg=fmclient&subdirectory=python-fmclient/fmclient -e git+https://opendev.org/starlingx/distcloud-client.git@b4a8ec19dc6078952a3762d7eee8d426d520a1f0#egg=distributedcloud-client&subdirectory=distributedcloud-client --e git+https://opendev.org/starlingx/config.git@r/stx.7.0#egg=cgtsclient&subdirectory=sysinv/cgts-client/cgts-client --e git+https://opendev.org/starlingx/fault.git@r/stx.7.0#egg=fmclient&subdirectory=python-fmclient/fmclient +# Updated to lastest commit at May 24th 2024 +-e git+https://opendev.org/starlingx/config.git@04271215320b8ab9824be837ac5aae07883d363b#egg=cgtsclient&subdirectory=sysinv/cgts-client/cgts-client +-e git+https://opendev.org/starlingx/fault.git@b213c9155b2323831143977447f41efc2f84b76a#egg=fmclient&subdirectory=python-fmclient/fmclient \ No newline at end of file -- 2.16.6