Fix gitutils to use release-id
With the new release identification / naming schema [1] (like: 2023.1 Antelope) new stable branch naming was introduced (like: stable/2023.1). This was not handled in check_branch_sha method in validate.py, as the method still searches stable/$series. This patch fixes this by reading the 'release-id' field from series_status.yaml if present and uses it as stable/<release-id> for the branch search. [1] https://governance.openstack.org/tc/reference/release-naming.html Change-Id: I014b1d6dc561be4db0fc8faa85fb3133e851acfc
This commit is contained in:
parent
c957de2246
commit
fb08afc1fa
@ -19,6 +19,7 @@ import subprocess
|
|||||||
|
|
||||||
from openstack_releases import links
|
from openstack_releases import links
|
||||||
from openstack_releases import processutils
|
from openstack_releases import processutils
|
||||||
|
from openstack_releases import series_status
|
||||||
|
|
||||||
# Disable warnings about insecure connections.
|
# Disable warnings about insecure connections.
|
||||||
from requests.packages import urllib3
|
from requests.packages import urllib3
|
||||||
@ -29,6 +30,20 @@ LOG = logging.getLogger(__name__)
|
|||||||
GIT_TAG_TEMPLATE = 'https://opendev.org/%s/src/tag/%s'
|
GIT_TAG_TEMPLATE = 'https://opendev.org/%s/src/tag/%s'
|
||||||
|
|
||||||
|
|
||||||
|
def get_stable_branch_id(series):
|
||||||
|
"""Retrieve the stable branch ID of the series.
|
||||||
|
|
||||||
|
Returns the release-id if the series has such field, otherwise
|
||||||
|
returns the series name. This is needed for the new stable branch
|
||||||
|
naming style: stable/2023.1 (versus the old style: stable/zed).
|
||||||
|
"""
|
||||||
|
series_status_data = series_status.SeriesStatus.default()
|
||||||
|
release_id = series_status_data[series].release_id
|
||||||
|
if release_id is None:
|
||||||
|
release_id = series
|
||||||
|
return str(release_id)
|
||||||
|
|
||||||
|
|
||||||
def find_modified_deliverable_files():
|
def find_modified_deliverable_files():
|
||||||
"Return a list of files modified by the most recent commit."
|
"Return a list of files modified by the most recent commit."
|
||||||
results = processutils.check_output(
|
results = processutils.check_output(
|
||||||
@ -248,7 +263,7 @@ def check_branch_sha(workdir, repo, series, sha):
|
|||||||
if stable/N exists we could not create stable/N-1).
|
if stable/N exists we could not create stable/N-1).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
remote_match = 'remotes/origin/stable/%s' % series
|
remote_match = 'remotes/origin/stable/%s' % get_stable_branch_id(series)
|
||||||
try:
|
try:
|
||||||
containing_branches = _filter_branches(
|
containing_branches = _filter_branches(
|
||||||
processutils.check_output(
|
processutils.check_output(
|
||||||
|
@ -875,7 +875,11 @@ class TestValidateReleaseBranchMembership(base.BaseTestCase):
|
|||||||
self.assertEqual(0, len(self.ctx.warnings))
|
self.assertEqual(0, len(self.ctx.warnings))
|
||||||
self.assertEqual(0, len(self.ctx.errors))
|
self.assertEqual(0, len(self.ctx.errors))
|
||||||
|
|
||||||
def test_not_descendent(self):
|
@mock.patch('openstack_releases.gitutils.get_stable_branch_id')
|
||||||
|
def test_not_descendent(self, get_stable_branch_id):
|
||||||
|
get_stable_branch_id.configure_mock(
|
||||||
|
return_value='meiji',
|
||||||
|
)
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
series='meiji',
|
series='meiji',
|
||||||
|
Loading…
Reference in New Issue
Block a user