From 3eb6eee21c82a0661886a75bc1ca694e447192f6 Mon Sep 17 00:00:00 2001 From: Nidhi Shivashankara Belur Date: Wed, 21 Sep 2022 23:36:32 -0700 Subject: [PATCH] Add Debian packaging for app-sriov-fec-operator Create Debian packages for python-k8sapp-sriov-fec-operator and stx-sriov-fec-operator-helm. Test Status: - PASS: build-pkgs. - app upload, apply, remove, delete on STX simplex node. - Apply SRIOV FEC cluster config. Story: 2009749 Task: 46341 Signed-off-by: Nidhi Shivashankara Belur Change-Id: I329bd92d6afccae76f327c88591c2e8cc2f235de --- debian_build_layer.cfg | 1 + debian_pkg_dirs | 2 + debian_stable_docker_images.inc | 1 + .../debian/deb_folder/changelog | 5 ++ .../debian/deb_folder/control | 26 ++++++ .../debian/deb_folder/copyright | 41 +++++++++ ...3-k8sapp-sriov-fec-operator-wheels.install | 1 + .../python3-k8sapp-sriov-fec-operator.install | 2 + .../debian/deb_folder/rules | 26 ++++++ .../debian/deb_folder/source/format | 1 + .../debian/meta_data.yaml | 7 ++ .../debian/build-sriov-fec-operator-image.sh | 90 +++++++++++++++++++ .../sriov-fec-daemon.stable_docker_image | 8 ++ .../sriov-fec-labeler.stable_docker_image | 8 ++ .../sriov-fec-operator.stable_docker_image | 8 ++ .../debian/deb_folder/changelog | 5 ++ .../debian/deb_folder/control | 19 ++++ .../debian/deb_folder/copyright | 41 +++++++++ .../debian/deb_folder/rules | 51 +++++++++++ .../debian/deb_folder/source/format | 1 + .../stx-sriov-fec-operator-helm.install | 1 + .../debian/meta_data.yaml | 7 ++ 22 files changed, 352 insertions(+) create mode 100644 debian_build_layer.cfg create mode 100644 debian_pkg_dirs create mode 100644 debian_stable_docker_images.inc create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/changelog create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/control create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/copyright create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator-wheels.install create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator.install create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/rules create mode 100644 python-k8sapp-sriov-fec-operator/debian/deb_folder/source/format create mode 100644 python-k8sapp-sriov-fec-operator/debian/meta_data.yaml create mode 100644 sriov-fec-operator-images/debian/build-sriov-fec-operator-image.sh create mode 100644 sriov-fec-operator-images/debian/sriov-fec-daemon.stable_docker_image create mode 100644 sriov-fec-operator-images/debian/sriov-fec-labeler.stable_docker_image create mode 100644 sriov-fec-operator-images/debian/sriov-fec-operator.stable_docker_image create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/changelog create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/control create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/copyright create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/rules create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/source/format create mode 100644 stx-sriov-fec-operator-helm/debian/deb_folder/stx-sriov-fec-operator-helm.install create mode 100644 stx-sriov-fec-operator-helm/debian/meta_data.yaml diff --git a/debian_build_layer.cfg b/debian_build_layer.cfg new file mode 100644 index 0000000..c581999 --- /dev/null +++ b/debian_build_layer.cfg @@ -0,0 +1 @@ +flock diff --git a/debian_pkg_dirs b/debian_pkg_dirs new file mode 100644 index 0000000..77c1d5f --- /dev/null +++ b/debian_pkg_dirs @@ -0,0 +1,2 @@ +python-k8sapp-sriov-fec-operator +stx-sriov-fec-operator-helm diff --git a/debian_stable_docker_images.inc b/debian_stable_docker_images.inc new file mode 100644 index 0000000..9aec99a --- /dev/null +++ b/debian_stable_docker_images.inc @@ -0,0 +1 @@ +sriov-fec-operator-images diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/changelog b/python-k8sapp-sriov-fec-operator/debian/deb_folder/changelog new file mode 100644 index 0000000..b6eeb0e --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +python3-k8sapp-sriov-fec-operator (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Nidhi Shivashankara Belur Sun, 18 Sep 2022 08:52:11 +0000 diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/control b/python-k8sapp-sriov-fec-operator/debian/deb_folder/control new file mode 100644 index 0000000..7aa70fc --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/control @@ -0,0 +1,26 @@ +Source: python3-k8sapp-sriov-fec-operator +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-all, + python3-pbr, + python3-setuptools, + python3-wheel +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: python3-k8sapp-sriov-fec-operator +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends} +Description: StarlingX Sysinv Sriov Fec Operator Extensions + This package contains sysinv plugins for the sriov fec operator K8S app. + +Package: python3-k8sapp-sriov-fec-operator-wheels +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel +Description: StarlingX Sysinv Sriov Fec Operator Extension Wheels + This package contains python wheels for the sriov fec operator K8S app plugins. diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/copyright b/python-k8sapp-sriov-fec-operator/debian/deb_folder/copyright new file mode 100644 index 0000000..3711597 --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python3-k8sapp-sriov-fec-operator +Source: https://opendev.org/starlingx/app-sriov-fec-operator/ + +Files: * +Copyright: (c) 2022 Intel Corporation +License: Apache-2 + 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 + . + https://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. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2022 Intel Corporation +License: Apache-2 + 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 + . + https://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. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator-wheels.install b/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator-wheels.install new file mode 100644 index 0000000..91ba0c3 --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator-wheels.install @@ -0,0 +1 @@ +plugins/sriov-fec-operator/*.whl diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator.install b/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator.install new file mode 100644 index 0000000..a20354f --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/python3-k8sapp-sriov-fec-operator.install @@ -0,0 +1,2 @@ +usr/lib/python3/dist-packages/k8sapp_sriov_fec_operator-1.0.0.egg-info/* +usr/lib/python3/dist-packages/k8sapp_sriov_fec_operator/* diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/rules b/python-k8sapp-sriov-fec-operator/debian/deb_folder/rules new file mode 100644 index 0000000..18e361e --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export APP_NAME=sriov-fec-operator +export PBR_VERSION=1.0.0 +export PYBUILD_NAME=k8sapp-sriov-fec-operator +export ROOT=$(CURDIR)/debian/tmp +export SKIP_PIP_INSTALL=1 + +%: + dh $@ --with=python3 --buildsystem=pybuild + +override_dh_auto_build: + python3 setup.py build + +override_dh_auto_install: + python3 setup.py install --install-layout=deb --skip-build --root $(ROOT) + python3 setup.py bdist_wheel \ + --universal \ + -d $(ROOT)/plugins/$(APP_NAME) + +ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) +override_dh_auto_test: + # (tbogue) FIXME + PYTHONDIR=$(CURDIR) stestr run || true +endif diff --git a/python-k8sapp-sriov-fec-operator/debian/deb_folder/source/format b/python-k8sapp-sriov-fec-operator/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/python-k8sapp-sriov-fec-operator/debian/meta_data.yaml b/python-k8sapp-sriov-fec-operator/debian/meta_data.yaml new file mode 100644 index 0000000..1193b93 --- /dev/null +++ b/python-k8sapp-sriov-fec-operator/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: python3-k8sapp-sriov-fec-operator +debver: 1.0-1 +src_path: k8sapp_sriov_fec_operator +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/sriov-fec-operator-images/debian/build-sriov-fec-operator-image.sh b/sriov-fec-operator-images/debian/build-sriov-fec-operator-image.sh new file mode 100644 index 0000000..6a76b5a --- /dev/null +++ b/sriov-fec-operator-images/debian/build-sriov-fec-operator-image.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# +# Copyright (c) 2022 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +IMAGE=$1 +IMAGE_TAG=$2 +export CONTAINER_TOOL=docker +export BASE_IMAGE="centos:7.9.2009" + +echo "=============== build script ================" +echo image: "${IMAGE}" +echo image_tag: "${IMAGE_TAG}" +pwd + +if [ -z "${IMAGE_TAG}" ]; then + echo "Image tag must be specified. build ${IMAGE} Aborting..." >&2 + exit 1 +fi + +build_labeler_image() { + export LABELER_IMAGE=$1 + + sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" labeler/Dockerfile + + echo "labeler_image: ${LABELER_IMAGE}" + + pwd + make -C labeler image + + echo "Labeler image build done" + + return 0 +} + +build_daemon_image() { + export SRIOV_FEC_DAEMON_IMAGE=$1 + + sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" \ + sriov-fec/Dockerfile.daemon + + echo "daemon_image: ${SRIOV_FEC_DAEMON_IMAGE}" + + pwd + make -C sriov-fec image-sriov-fec-daemon + + echo "Daemon image build done" + + return 0 +} + +build_operator_image() { + + export SRIOV_FEC_OPERATOR_IMAGE=$1 + + sed -i "/FROM.*registry.*/c\FROM ${BASE_IMAGE}" \ + sriov-fec/Dockerfile + + echo "operator_image: ${SRIOV_FEC_OPERATOR_IMAGE}" + + pwd + make -C sriov-fec image-sriov-fec-operator + + echo "Operator image build done" + + return 0 +} + +case ${IMAGE} in + labeler) + echo "Build image: labeler" + build_labeler_image "${IMAGE_TAG}" + ;; + daemon) + echo "build image: daemon" + build_daemon_image "${IMAGE_TAG}" + ;; + operator) + echo "build image: Operator" + build_operator_image "${IMAGE_TAG}" + ;; + *) + echo "Unsupported ARGS in ${image_build_file}: ${IMAGE}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/sriov-fec-operator-images/debian/sriov-fec-daemon.stable_docker_image b/sriov-fec-operator-images/debian/sriov-fec-daemon.stable_docker_image new file mode 100644 index 0000000..d6406f5 --- /dev/null +++ b/sriov-fec-operator-images/debian/sriov-fec-daemon.stable_docker_image @@ -0,0 +1,8 @@ +BUILDER=script +LABEL=sriov-fec-daemon +SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git +SOURCE_REF=0293536cd6712d8f650e18191f3a4d1579f8f633 +COMMAND=bash +SCRIPT=build-sriov-fec-operator-image.sh +ARGS=daemon + diff --git a/sriov-fec-operator-images/debian/sriov-fec-labeler.stable_docker_image b/sriov-fec-operator-images/debian/sriov-fec-labeler.stable_docker_image new file mode 100644 index 0000000..ad8dda8 --- /dev/null +++ b/sriov-fec-operator-images/debian/sriov-fec-labeler.stable_docker_image @@ -0,0 +1,8 @@ +BUILDER=script +LABEL=sriov-fec-labeler +SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git +SOURCE_REF=0293536cd6712d8f650e18191f3a4d1579f8f633 +COMMAND=bash +SCRIPT=build-sriov-fec-operator-image.sh +ARGS=labeler + diff --git a/sriov-fec-operator-images/debian/sriov-fec-operator.stable_docker_image b/sriov-fec-operator-images/debian/sriov-fec-operator.stable_docker_image new file mode 100644 index 0000000..20266d3 --- /dev/null +++ b/sriov-fec-operator-images/debian/sriov-fec-operator.stable_docker_image @@ -0,0 +1,8 @@ +BUILDER=script +LABEL=sriov-fec-operator +SOURCE_REPO=https://github.com/smart-edge-open/sriov-fec-operator.git +SOURCE_REF=0293536cd6712d8f650e18191f3a4d1579f8f633 +COMMAND=bash +SCRIPT=build-sriov-fec-operator-image.sh +ARGS=operator + diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/changelog b/stx-sriov-fec-operator-helm/debian/deb_folder/changelog new file mode 100644 index 0000000..7d77e53 --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +stx-sriov-fec-operator-helm (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Nidhi Shivashankara Belur Sun, 18 Sep 2022 08:52:11 +0000 diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/control b/stx-sriov-fec-operator-helm/debian/deb_folder/control new file mode 100644 index 0000000..593fde3 --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/control @@ -0,0 +1,19 @@ +Source: stx-sriov-fec-operator-helm +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + chartmuseum, + helm, + procps, + python3-k8sapp-sriov-fec-operator, + python3-k8sapp-sriov-fec-operator-wheels +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: stx-sriov-fec-operator-helm +Section: libs +Architecture: any +Depends: ${misc:Depends} +Description: StarlingX Sriov Fec Operator Helm Charts + This package contains helm charts for the Sriov Fec Operator application. diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/copyright b/stx-sriov-fec-operator-helm/debian/deb_folder/copyright new file mode 100644 index 0000000..ea841c6 --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: stx-sriov-fec-operator-helm +Source: https://opendev.org/starlingx/app-sriov-fec-operator/ + +Files: * +Copyright: (c) 2022 Intel Corporation +License: Apache-2 + 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 + . + https://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. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2022 Intel Corporation +License: Apache-2 + 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 + . + https://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. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/rules b/stx-sriov-fec-operator-helm/debian/deb_folder/rules new file mode 100644 index 0000000..3fdbe8d --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/rules @@ -0,0 +1,51 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export ROOT = debian/tmp +export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm + +export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '.') +export MINOR_PATCH = $(shell echo $(DEB_VERSION) | cut -f 2 -d '.') + +export APP_NAME = sriov-fec-operator +export APP_VERSION = $(MAJOR).$(MINOR_PATCH) +export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz +export HELM_REPO = stx-platform +export STAGING = staging + +%: + dh $@ + +override_dh_auto_build: + + # Create the helm-chart TGZ file. + cd helm-charts && make + + # Setup the staging directory. + mkdir -p $(STAGING) + cp files/metadata.yaml $(STAGING) + cp -R fluxcd-manifests $(STAGING) + mkdir -p $(STAGING)/charts + cp helm-charts/*.tgz $(STAGING)/charts + # Populate metadata. + sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml + sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml + sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml + # Copy the plugins: installed in the buildroot + mkdir -p $(STAGING)/plugins + cp /plugins/$(APP_NAME)/*.whl $(STAGING)/plugins + # Create the app package. + cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 + tar cfz $(APP_TARBALL) -C $(STAGING)/ . + # Cleanup staging + rm -rf $(STAGING) + +override_dh_auto_install: + # Install the app tar file. + install -d -m 755 $(APP_FOLDER) + install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER) + +override_dh_auto_test: + +override_dh_usrlocal: diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/source/format b/stx-sriov-fec-operator-helm/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/stx-sriov-fec-operator-helm/debian/deb_folder/stx-sriov-fec-operator-helm.install b/stx-sriov-fec-operator-helm/debian/deb_folder/stx-sriov-fec-operator-helm.install new file mode 100644 index 0000000..1b47c6e --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/deb_folder/stx-sriov-fec-operator-helm.install @@ -0,0 +1 @@ +usr/local/share/applications/helm/* diff --git a/stx-sriov-fec-operator-helm/debian/meta_data.yaml b/stx-sriov-fec-operator-helm/debian/meta_data.yaml new file mode 100644 index 0000000..608e47c --- /dev/null +++ b/stx-sriov-fec-operator-helm/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: stx-sriov-fec-operator-helm +debver: 1.0-1 +src_path: stx-sriov-fec-operator-helm +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true