From 9a8fb7e3f4dca36ebadfa5c9b55057472baf939b Mon Sep 17 00:00:00 2001 From: "Reed, Joshua" Date: Wed, 13 Dec 2023 11:25:24 -0700 Subject: [PATCH] Update app Zuul Check Jobs. Modify code to conform to flake8 and pylint. Jobs are now flake8, pylint, py39 and metadata. Test Plan PASS - All zuul jobs pass as expected. Story: 2010929 Task: 49248 Change-Id: I780f94e54a3b24f22dc1065ec9446294c85fcfc6 Signed-off-by: Reed, Joshua --- .gitignore | 1 + .zuul.yaml | 21 +++++++++++++++++++ .../tox.ini | 13 ++++++++++-- .../debian/deb_folder/rules | 6 +++--- .../files/metadata.yaml | 6 +++--- tox.ini | 4 ++++ 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 78c457c..cae52d0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ cover AUTHORS ChangeLog *.sqlite +venv/ \ No newline at end of file diff --git a/.zuul.yaml b/.zuul.yaml index 720f55a..4c785f2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -6,12 +6,14 @@ - k8sapp-intel-device-plugins-operator-tox-py39 - k8sapp-intel-device-plugins-operator-tox-pylint - k8sapp-intel-device-plugins-operator-tox-flake8 + - k8sapp-intel-device-plugins-operator-tox-metadata gate: jobs: - openstack-tox-linters - k8sapp-intel-device-plugins-operator-tox-py39 - k8sapp-intel-device-plugins-operator-tox-pylint - k8sapp-intel-device-plugins-operator-tox-flake8 + - k8sapp-intel-device-plugins-operator-tox-metadata - job: name: k8sapp-intel-device-plugins-operator-tox-py39 @@ -32,6 +34,25 @@ tox_extra_args: -c python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' +- job: + name: k8sapp-intel-device-plugins-operator-tox-metadata + parent: tox + description: | + Run metadata test for k8sapp_intel_device_plugins_operator + required-projects: + - starlingx/config + - starlingx/fault + - starlingx/update + - starlingx/utilities + - starlingx/root + nodeset: debian-bullseye + files: + - python3-k8sapp-intel-device-plugins-operator/* + vars: + tox_envlist: metadata + tox_extra_args: -c python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini + tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' + - job: name: k8sapp-intel-device-plugins-operator-tox-pylint parent: tox diff --git a/python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini b/python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini index df505c3..2d6e7ed 100644 --- a/python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini +++ b/python3-k8sapp-intel-device-plugins-operator/k8sapp_intel_device_plugins_operator/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = flake8,py39,pylint +envlist = flake8,py39,pylint,metadata minversion = 1.6 skipsdist = True @@ -16,6 +16,7 @@ usedevelop = True # tox is silly... these need to be separated by a newline.... allowlist_externals = bash find + echo install_command = pip install -v -v -v \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ @@ -178,4 +179,12 @@ commands = # of the requirements.txt files deps = pip_missing_reqs -rrequirements.txt -commands=pip-missing-reqs -d --ignore-file=/k8sapp_intel_device_plugins_operator/tests k8sapp_intel_device_plugins_operator \ No newline at end of file +commands=pip-missing-reqs -d --ignore-file=/k8sapp_intel_device_plugins_operator/tests k8sapp_intel_device_plugins_operator + +[testenv:metadata] +install_command = pip install -v -v -v \ + -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ + {opts} {packages} +# Pass top level app folder to 'sysinv-app tox' command. +commands = + bash -c "echo $(dirname $(dirname $(pwd))) | xargs -n 1 sysinv-app tox" \ No newline at end of file diff --git a/stx-intel-device-plugins-operator-helm/debian/deb_folder/rules b/stx-intel-device-plugins-operator-helm/debian/deb_folder/rules index 3810036..1fb92a6 100755 --- a/stx-intel-device-plugins-operator-helm/debian/deb_folder/rules +++ b/stx-intel-device-plugins-operator-helm/debian/deb_folder/rules @@ -28,9 +28,9 @@ override_dh_auto_build: cp $(HELM_FOLDER)/*.tgz $(STAGING)/charts # Modify 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 + sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING)/metadata.yaml + sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING)/metadata.yaml + sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING)/metadata.yaml # Copy the plugins: installed in the buildroot mkdir -p $(STAGING)/plugins diff --git a/stx-intel-device-plugins-operator-helm/stx-intel-device-plugins-operator-helm/files/metadata.yaml b/stx-intel-device-plugins-operator-helm/stx-intel-device-plugins-operator-helm/files/metadata.yaml index 001b8d8..176fc64 100644 --- a/stx-intel-device-plugins-operator-helm/stx-intel-device-plugins-operator-helm/files/metadata.yaml +++ b/stx-intel-device-plugins-operator-helm/stx-intel-device-plugins-operator-helm/files/metadata.yaml @@ -1,6 +1,6 @@ -app_name: @APP_NAME@ -app_version: @APP_VERSION@ -helm_repo: @HELM_REPO@ +app_name: APP_REPLACE_NAME +app_version: APP_REPLACE_VERSION +helm_repo: HELM_REPLACE_REPO maintain_user_overrides: true maintain_attributes: true diff --git a/tox.ini b/tox.ini index 62fa02f..06b90bb 100644 --- a/tox.ini +++ b/tox.ini @@ -49,6 +49,10 @@ description = Dummy environment to allow flake8 to be run in subdir tox basepython = python3 description = Dummy environment to allow pylint to be run in subdir tox +[testenv:metadata] +basepython = python3 +description = Dummy environment to allow sysinv-app to be run in subdir tox + [testenv:bandit] basepython = python3 description = Dummy environment to allow bandit to be run in subdir tox