From cd0f5c38c202fe0ab30e21d662dce511e4d8611c Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Mon, 24 Oct 2022 12:06:45 -0300 Subject: [PATCH] Add stx-fm-rest-api loci image This change reorganizes the source directories of the stx-fm-rest-api container to be reused by both CentOS and Debian Dockerfiles in order to build the images having the corresponding OS-specic base. As part of this, the fm-api, fm-rest-api, fm-common and python-fmclient packages have been ported in order to generate deb files that contain .whl. Test plan: PASS: Build debian iso and perform fresh install. Verify fm commands are working as expected. PASS: Build python3 wheels tarball on Debian. Verify fm, fm_api, fm_core and fmclient .whl files are added. PASS: Build Debian-based container and push it to a public registry. Apply openstack application and update the fm-rest-api url to pull this new image. Verify that: - pods are up and running with the new image/tag specified. - the container is running on Debian. - from inside the container, fm querys are working as expected. Story: 2009831 Task: 46634 Depends-On: https://review.opendev.org/c/starlingx/config/+/862498 Signed-off-by: Enzo Candotti Change-Id: I2b35139f8775141e39f97a5a6037c5de2b4d5d76 --- debian_stable_docker_images.inc | 1 + debian_stable_wheels.inc | 4 +++ fm-api/debian/deb_folder/control | 7 ++++- .../debian/deb_folder/python3-fm-api.install | 1 + fm-api/debian/deb_folder/rules | 8 ++++++ fm-common/debian/deb_folder/control | 23 +++++++++------- fm-common/debian/deb_folder/rules | 6 ++++- fm-rest-api/debian/deb_folder/control | 6 +++++ .../debian/deb_folder/fm-rest-api.install | 2 ++ fm-rest-api/debian/deb_folder/rules | 3 +++ .../stx-fm-rest-api.stable_docker_image | 26 +++++++++++++++++++ python-fmclient/debian/deb_folder/control | 7 ++++- python-fmclient/debian/deb_folder/rules | 9 ++++++- 13 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 debian_stable_docker_images.inc create mode 100644 debian_stable_wheels.inc create mode 100644 fm-api/debian/deb_folder/python3-fm-api.install create mode 100644 fm-rest-api/debian/stx-fm-rest-api.stable_docker_image diff --git a/debian_stable_docker_images.inc b/debian_stable_docker_images.inc new file mode 100644 index 00000000..c131931b --- /dev/null +++ b/debian_stable_docker_images.inc @@ -0,0 +1 @@ +fm-rest-api diff --git a/debian_stable_wheels.inc b/debian_stable_wheels.inc new file mode 100644 index 00000000..41beb0c0 --- /dev/null +++ b/debian_stable_wheels.inc @@ -0,0 +1,4 @@ +fm-api-wheel +fm-common-wheel +fm-rest-api-wheel +python-fmclient-wheel diff --git a/fm-api/debian/deb_folder/control b/fm-api/debian/deb_folder/control index 6cb4d250..8ea893b9 100644 --- a/fm-api/debian/deb_folder/control +++ b/fm-api/debian/deb_folder/control @@ -2,7 +2,7 @@ Source: fm-api Section: admin Priority: optional Maintainer: Starlingx Developers -Build-Depends: debhelper-compat (= 13), dh-python, python3-setuptools, python3-all +Build-Depends: debhelper-compat (= 13), dh-python, python3-setuptools, python3-all, python3-wheel Standards-Version: 4.4.1 Homepage: https://www.starlingx.io @@ -14,3 +14,8 @@ Description: Starlingx fault management api active alarms. . This package installs the library for Python 3. + +Package: fm-api-wheel +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends} +Description: Contains python wheels for fm-api diff --git a/fm-api/debian/deb_folder/python3-fm-api.install b/fm-api/debian/deb_folder/python3-fm-api.install new file mode 100644 index 00000000..036c6b9d --- /dev/null +++ b/fm-api/debian/deb_folder/python3-fm-api.install @@ -0,0 +1 @@ +usr/lib/python*/dist-packages/* diff --git a/fm-api/debian/deb_folder/rules b/fm-api/debian/deb_folder/rules index 085e19ab..91c36fd2 100755 --- a/fm-api/debian/deb_folder/rules +++ b/fm-api/debian/deb_folder/rules @@ -2,6 +2,14 @@ #export DH_VERBOSE = 1 export PYBUILD_NAME=fm-api +DEBIAN_DESTDIR := $(CURDIR)/debian/tmp %: dh $@ --with python3 --buildsystem=pybuild + +override_dh_install: + python3 setup.py install -f --install-layout=deb --root=${DEBIAN_DESTDIR} + python3 setup.py bdist_wheel \ + --universal \ + -d ${CURDIR}/debian/fm-api-wheel/usr/share/python-wheels + dh_install diff --git a/fm-common/debian/deb_folder/control b/fm-common/debian/deb_folder/control index f2de3569..60148b1f 100644 --- a/fm-common/debian/deb_folder/control +++ b/fm-common/debian/deb_folder/control @@ -9,6 +9,7 @@ Build-Depends: debhelper-compat (= 13), python3, python3-dev, python3-setuptools, + python3-wheel, uuid-dev Standards-Version: 4.5.1 Rules-Requires-Root: no @@ -26,15 +27,6 @@ Description: StarlingX fault management client library - header files . This package contains the header files -Package: fm-common -Architecture: any -Multi-Arch: same -Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends} -Description: StarlingX fault management client library - StarlingX Fault Management Client Library that provides APIs for applications - to raise/clear/update active alarms. This package contains symbolic links, - header files, and related items necessary for software development. - Package: fm-common-doc Architecture: all Section: doc @@ -46,3 +38,16 @@ Description: StarlingX fault management client library - documentation . This package contains the documentation for fm-common +Package: fm-common +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends} +Description: StarlingX fault management client library + StarlingX Fault Management Client Library that provides APIs for applications + to raise/clear/update active alarms. This package contains symbolic links, + header files, and related items necessary for software development. + +Package: fm-common-wheel +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends} +Description: Contains python wheels for fm-common diff --git a/fm-common/debian/deb_folder/rules b/fm-common/debian/deb_folder/rules index 85417b81..8de68d7f 100755 --- a/fm-common/debian/deb_folder/rules +++ b/fm-common/debian/deb_folder/rules @@ -15,7 +15,11 @@ override_dh_auto_install: LIBDIR=/usr/lib \ INCDIR=/usr/include \ CGCS_DOC_DEPLOY=/opt/deploy/cgcs_doc install - python3 setup.py install --install-layout=deb --root $(ROOT) + python3 setup.py install --install-layout=deb --skip-build --root $(ROOT) + + python3 setup.py bdist_wheel \ + --universal \ + -d $(CURDIR)/debian/fm-common-wheel/usr/share/python-wheels override_dh_fixperms: dh_fixperms -XfmClientCli diff --git a/fm-rest-api/debian/deb_folder/control b/fm-rest-api/debian/deb_folder/control index 0f5028df..e0b0e205 100644 --- a/fm-rest-api/debian/deb_folder/control +++ b/fm-rest-api/debian/deb_folder/control @@ -20,6 +20,7 @@ Build-Depends: debhelper-compat (= 13), python3-setuptools, python3-sqlalchemy, python3-wsme, + python3-wheel, tsconfig Standards-Version: 4.5.1 Rules-Requires-Root: no @@ -34,3 +35,8 @@ Depends: ${python3:Depends}, python3-paste Description: Fault Management Openstack REST API This package contains the Openstack REST API for fault management. + +Package: fm-rest-api-wheel +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends} +Description: Contains python wheels for fm-rest-api diff --git a/fm-rest-api/debian/deb_folder/fm-rest-api.install b/fm-rest-api/debian/deb_folder/fm-rest-api.install index d7bae91a..e6022eb5 100644 --- a/fm-rest-api/debian/deb_folder/fm-rest-api.install +++ b/fm-rest-api/debian/deb_folder/fm-rest-api.install @@ -1,4 +1,6 @@ etc/fm/fm.conf etc/fm/policy.yaml etc/init.d +usr/bin/ +usr/lib/python*/dist-packages/* usr/share/starlingx/pmon.d/fm-api.conf diff --git a/fm-rest-api/debian/deb_folder/rules b/fm-rest-api/debian/deb_folder/rules index 5f56d906..3d2bc5cb 100755 --- a/fm-rest-api/debian/deb_folder/rules +++ b/fm-rest-api/debian/deb_folder/rules @@ -11,6 +11,9 @@ export INITDIR=$(ROOT)/etc/init.d dh $@ --with=python3 --buildsystem=pybuild override_dh_auto_install: + python3 setup.py install -f --install-layout=deb --root=$(CURDIR)/$(ROOT) + python3 setup.py bdist_wheel --universal \ + -d $(CURDIR)/debian/fm-rest-api-wheel/usr/share/python-wheels install -d -m 755 $(INITDIR) install -p -D -m 755 scripts/fm-api $(INITDIR)/fm-api install -d -m 755 $(PMONDIR) diff --git a/fm-rest-api/debian/stx-fm-rest-api.stable_docker_image b/fm-rest-api/debian/stx-fm-rest-api.stable_docker_image new file mode 100644 index 00000000..0f91ebc7 --- /dev/null +++ b/fm-rest-api/debian/stx-fm-rest-api.stable_docker_image @@ -0,0 +1,26 @@ +BUILDER=loci +LABEL=stx-fm-rest-api +# Set PROJECT=infra and PROJECT_REPO=nil because we are not cloning a repo +PROJECT=infra +PROJECT_REPO=nil +DIST_PACKAGES="postgresql fm-common" +DIST_REPOS="OS" + +PIP_PACKAGES=" + cgtsclient \ + httplib2 \ + keystone \ + keystonemiddleware \ + oslo.db \ + oslo.log \ + oslo.middleware \ + oslo.policy \ + oslo.versionedobjects \ + PyMySQL \ + python_neutronclient \ + tsconfig \ + pecan \ + fm \ + fm_api \ + fm_core \ + WSME" diff --git a/python-fmclient/debian/deb_folder/control b/python-fmclient/debian/deb_folder/control index f63c84f9..951c12f5 100644 --- a/python-fmclient/debian/deb_folder/control +++ b/python-fmclient/debian/deb_folder/control @@ -2,7 +2,7 @@ Source: python-fmclient Section: admin Priority: optional Maintainer: StarlingX Developers -Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-all, python3-pbr +Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-all, python3-pbr, python3-wheel Build-Depends-Indep: python3-oslo.utils, python3-prettytable, @@ -23,3 +23,8 @@ Depends: ${python3:Depends}, bash-completion Description: Client library for fault management A python client library for Fault Management + +Package: python-fmclient-wheel +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends} +Description: Contains python wheels for python-fmclient diff --git a/python-fmclient/debian/deb_folder/rules b/python-fmclient/debian/deb_folder/rules index 9dda88bb..a13d829b 100755 --- a/python-fmclient/debian/deb_folder/rules +++ b/python-fmclient/debian/deb_folder/rules @@ -1,7 +1,14 @@ #!/usr/bin/make -f #export DH_VERBOSE = 1 -export PYBUILD_NAME=python-fmclient +export PYBUILD_NAME=fmclient +export PBR_VERSION=1.0.0 +export ROOT=$(CURDIR)/debian/tmp %: dh $@ --with python3 --buildsystem=pybuild + +override_dh_install: + python3 setup.py install -f --install-layout=deb --root=$(ROOT) + python3 setup.py bdist_wheel --universal -d ${CURDIR}/debian/python-fmclient-wheel/usr/share/python-wheels + dh_install