Add Tox Metadata Verification Check.

This change adds a new Zuul Job/Check to verify the app
metadata.yaml file in this repo.  The check is performed
by a console script belonging to the sysinv/config repo.

The existing metadata.yaml used the at '@' symbol to
serve as a template for logic in the Rules file to find
and replace for debian packaging purposes. This needed
to be changed so the verification software could read
the file without throwing an error.

Test Plan:
PASS - Verify that the appropriate Zuul Job has run
       and passes.

Story: 2010929
Task: 49230

Change-Id: I0b53dda13ed92eee66f0e71d609fbc6b5e563bd6
Signed-off-by: Reed, Joshua <Joshua.Reed@windriver.com>
This commit is contained in:
Reed, Joshua 2023-12-11 12:45:59 -07:00
parent 89ee77c730
commit bad6dacfe2
7 changed files with 43 additions and 9 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.tox
.tox
venv/

View File

@ -5,11 +5,13 @@
- openstack-tox-linters
- k8sapp-dell-storage-tox-py39
- k8sapp-dell-storage-tox-pylint
- k8sapp-dell-storage-tox-metadata
gate:
jobs:
- openstack-tox-linters
- k8sapp-dell-storage-tox-py39
- k8sapp-dell-storage-tox-pylint
- k8sapp-dell-storage-tox-metadata
- job:
name: k8sapp-dell-storage-tox-py39
@ -29,6 +31,25 @@
tox_extra_args: -c python3-k8sapp-dell-storage/k8sapp_dell_storage/tox.ini
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt'
- job:
name: k8sapp-dell-storage-tox-metadata
parent: tox
description: |
Run metadata test for k8sapp_dell_storage
nodeset: debian-bullseye
required-projects:
- starlingx/config
- starlingx/fault
- starlingx/update
- starlingx/utilities
- starlingx/root
files:
- python3-k8sapp-dell-storage/*
vars:
tox_envlist: metadata
tox_extra_args: -c python3-k8sapp-dell-storage/k8sapp_dell_storage/tox.ini
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt'
- job:
name: k8sapp-dell-storage-tox-pylint
parent: tox

View File

@ -1,4 +1,3 @@
[DEFAULT]
test_path=./k8sapp_dell_storage/tests
top_dir=./k8sapp_dell_storage
#parallel_class=True

View File

@ -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} \
@ -179,3 +180,11 @@ commands =
deps = pip_missing_reqs
-rrequirements.txt
commands=pip-missing-reqs -d --ignore-file=/k8sapp_dell_storage/tests k8sapp_dell_storage
[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"

View File

@ -27,9 +27,9 @@ override_dh_auto_build:
cp $(HELM_FOLDER)/*.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
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

View File

@ -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

View File

@ -29,6 +29,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 pylint to be run in subdir tox
[testenv:bandit]
basepython = python3
description = Dummy environment to allow bandit to be run in subdir tox