Fix validation when tags are missing and a branch is requested

For further details see
https://review.opendev.org/c/openstack/releases/+/818445

Change-Id: I291ee6e28cc6dcc901295336dd1251b9d28dc0b4
This commit is contained in:
Hervé Beraud 2021-11-19 16:15:59 +01:00
parent f5b9cee950
commit 5d5c666e9f

View File

@ -1595,12 +1595,22 @@ def validate_stable_branches(deliv, context):
'to independent repositories or bugfix ' 'to independent repositories or bugfix '
'branches, skipping') 'branches, skipping')
else: else:
latest_release = deliv.releases[-1] try:
if location != latest_release.version: latest_release = deliv.releases[-1]
if location != latest_release.version:
context.error(
('stable branches must be created from the '
'latest tagged release, and %s for %s does not '
'match %s' % (
location, branch.name,
latest_release.version))
)
except IndexError:
context.error( context.error(
('stable branches must be created from the latest ' 'No tags found for deliverable within this '
'tagged release, and %s for %s does not match %s' % ( 'series. Creating a tag is mandatory before '
location, branch.name, latest_release.version)) 'creating a branch or stable-branch-type needs '
'to be set as tagless.'
) )
elif branch_mode == 'tagless': elif branch_mode == 'tagless':