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
1 changed files with 15 additions and 5 deletions

View File

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