Add a 'generic' release-type.

We use release-types as a way to verify that versions are compatible and
if needed reflected accurately in the code (puppet, xstatic).  If one
isn't set explicitly then we assume python-service.

In certain circumstances (anything other than the first release in a
series) we also perform python specific requirements checking on all
'python' types.

Add a new 'generic' type that uses the same rules to validate version
numbers but wont run any python specific checks.

We need this a projects (like monasca-thresh) will fail the requirements
check for 2nd or greater releases[1].

An alternate would be to have the requirements code check if
exists before calling it but that seems like the wrong layer to me.

Change-Id: I3fcde5eb266f954fddb6871ce8690b93b8fd7a8d
This commit is contained in:
Tony Breeds 2019-04-17 14:33:41 +10:00
parent 8f474f5837
commit 828e285701
4 changed files with 35 additions and 2 deletions

View File

@ -54,7 +54,7 @@ properties:
type: "string"
enum: [ "python-service", "python-pypi", "xstatic", "fuel",
"nodejs", "puppet", "neutron", "horizon", "openstack-manuals",
"manila-image-elements" ]
"manila-image-elements", "generic" ]
type: "string"
enum: [ "std", "tagless", "upstream" ]

View File

@ -1134,6 +1134,34 @@ class TestValidateVersionNumbers(base.BaseTestCase):
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_generic_model(self, mock_lower_bound):
deliv = deliverable.Deliverable(
'release-type': 'generic',
'releases': [
{'version': '0.9.0',
'projects': [
{'repo': 'openstack/release-test',
'hash': '04ee20f0bfe8774935de33b75e87fb3b858d0733'},
{'version': '0.9.1',
'projects': [
{'repo': 'openstack/release-test',
'hash': 'a26e6a2e8a5e321b2e3517dbb01a7b9a56a8bfd5'},
validate.validate_version_numbers(deliv, self.ctx)
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(0, len(self.ctx.errors))
def test_valid_version(self):
deliv = deliverable.Deliverable(

View File

@ -40,6 +40,10 @@ _VALIDATORS['nodejs'] = _VALIDATORS['python-service']
_VALIDATORS['neutron'] = _VALIDATORS['python-service']
_VALIDATORS['horizon'] = _VALIDATORS['python-service']
_VALIDATORS['python-pypi'] = _VALIDATORS['python-service']
# This release-type uses the same version validation as python-service and
# has no language specific validation like nodejs or xstatic.
# It's used to bypass and python specific checks (like requirements validation)
_VALIDATORS['generic'] = _VALIDATORS['python-service']
def validate_version(versionstr, release_type='python-service', pre_ok=True):

View File

@ -1,7 +1,8 @@
minversion = 1.6
minversion = 3.1.0
envlist = py35,validate,pep8,bashate,docs
skipdist = True