Fix upper-constraints redirect for new release naming
The new release identification / naming schema [1] (like: 2023.1 Antelope) broke the redirection rules for branch specific upper constraint files as the stable branch names are from now on based on the new release identification (like: stable/2023.1). This patch fixes the redirections by introducing the release ID field to series status, to translate a release name to 'stable/<release-id>' where this ID exists. [1] https://governance.openstack.org/tc/reference/release-naming.html Change-Id: Iab885d4e36f64903b323e16c74d8315c759584de
This commit is contained in:
parent
7bdcec84c3
commit
2b8ee3aaec
@ -1,5 +1,6 @@
|
||||
---
|
||||
- name: antelope
|
||||
release-id: 2023.1
|
||||
status: development
|
||||
slurp: yes
|
||||
initial-release: 2023-03-22
|
||||
|
@ -515,6 +515,7 @@ def build_finished(app, exception):
|
||||
if series.status == 'future']
|
||||
params = dict(
|
||||
redirections=generate_constraints_redirections(_deliverables,
|
||||
_series_status_data,
|
||||
future_releases)
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,8 @@ from sphinx.util import logging
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def generate_constraints_redirections(_deliverables, future_releases=[]):
|
||||
def generate_constraints_redirections(_deliverables, _series_status_data,
|
||||
future_releases=[]):
|
||||
redirections = []
|
||||
# Loop through all the releases for requirements
|
||||
for deliv in _deliverables.get_deliverable_history('requirements'):
|
||||
@ -26,9 +27,12 @@ def generate_constraints_redirections(_deliverables, future_releases=[]):
|
||||
target = 'master'
|
||||
ref_type = 'branch'
|
||||
|
||||
release_id = _series_status_data[deliv.series].release_id
|
||||
if not release_id:
|
||||
release_id = deliv.series
|
||||
# Unless there is a specific stable branch
|
||||
for branch in deliv.branches:
|
||||
if branch.name == 'stable/%s' % (deliv.series):
|
||||
if branch.name == 'stable/%s' % (release_id):
|
||||
target = branch.name
|
||||
break
|
||||
|
||||
@ -42,7 +46,7 @@ def generate_constraints_redirections(_deliverables, future_releases=[]):
|
||||
# Insert into the beginning of the list so that redirections are
|
||||
# master -> juno
|
||||
status = 302 if target == 'master' else 301
|
||||
redirections.insert(0, dict(code=status, src=deliv.series,
|
||||
redirections.insert(0, dict(code=status, src=release_id,
|
||||
ref_type=ref_type, dst=target))
|
||||
|
||||
for series in future_releases:
|
||||
|
@ -43,6 +43,10 @@ class Series(object):
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
@property
|
||||
def release_id(self):
|
||||
return self._data.get('release-id', None)
|
||||
|
||||
@property
|
||||
def eol_date(self):
|
||||
return self._data.get('eol-date', None)
|
||||
|
@ -16,6 +16,8 @@ items:
|
||||
properties:
|
||||
name:
|
||||
type: "string"
|
||||
release-id:
|
||||
type: "number"
|
||||
status:
|
||||
type: "string"
|
||||
enum:
|
||||
|
@ -18,6 +18,7 @@ from oslotest import base
|
||||
|
||||
from openstack_releases._redirections import generate_constraints_redirections
|
||||
from openstack_releases import deliverable
|
||||
from openstack_releases import series_status
|
||||
from openstack_releases import yamlutils
|
||||
|
||||
|
||||
@ -115,6 +116,49 @@ class TestRedirections(base.BaseTestCase):
|
||||
'''))
|
||||
)
|
||||
|
||||
# Series status data
|
||||
SERIES_STATUS_DATA = series_status.SeriesStatus(
|
||||
yamlutils.loads(textwrap.dedent('''
|
||||
- name: stein
|
||||
status: future
|
||||
initial-release: 2019-04-11
|
||||
- name: rocky
|
||||
status: development
|
||||
initial-release: 2018-08-30
|
||||
- name: mitaka
|
||||
status: maintained
|
||||
initial-release: 2018-02-28
|
||||
'''))
|
||||
)
|
||||
|
||||
# Deliverable that looks like an open stable series with branch name
|
||||
# matching the new stable branch naming
|
||||
OPEN_STABLE_WITH_RELEASE_ID = deliverable.Deliverable(
|
||||
team='requirements',
|
||||
series='rocky',
|
||||
name='requirements',
|
||||
data=yamlutils.loads(textwrap.dedent('''
|
||||
branches:
|
||||
- name: stable/2018.2
|
||||
location:
|
||||
openstack/requirements: not_used
|
||||
'''))
|
||||
)
|
||||
|
||||
# Series status data with 'release-id'
|
||||
SERIES_STATUS_DATA_WITH_RELEASE_ID = series_status.SeriesStatus(
|
||||
yamlutils.loads(textwrap.dedent('''
|
||||
- name: stein
|
||||
release-id: 2019.1
|
||||
status: development
|
||||
initial-release: 2019-04-11
|
||||
- name: rocky
|
||||
release-id: 2018.2
|
||||
status: maintained
|
||||
initial-release: 2018-08-30
|
||||
'''))
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
@ -124,7 +168,8 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=302, src='stein', ref_type='branch',
|
||||
dst='master')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_development_release(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -132,7 +177,8 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=302, src='stein', ref_type='branch',
|
||||
dst='master')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_open_stable(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -140,7 +186,8 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
|
||||
dst='stable/rocky')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_open_unstable(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -148,7 +195,8 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
|
||||
dst='stable/rocky')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_stable_release(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -156,7 +204,26 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
|
||||
dst='stable/rocky')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_release_id_master(self):
|
||||
deliverables = FakeDeliverables([
|
||||
self.OPEN_DEVELOPMENT,
|
||||
])
|
||||
self.assertEqual([dict(code=302, src=2019.1, ref_type='branch',
|
||||
dst='master')],
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA_WITH_RELEASE_ID))
|
||||
|
||||
def test_release_id_stable(self):
|
||||
deliverables = FakeDeliverables([
|
||||
self.OPEN_STABLE_WITH_RELEASE_ID,
|
||||
])
|
||||
self.assertEqual([dict(code=301, src=2018.2, ref_type='branch',
|
||||
dst='stable/2018.2')],
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA_WITH_RELEASE_ID))
|
||||
|
||||
def test_stable_eol(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -164,7 +231,8 @@ class TestRedirections(base.BaseTestCase):
|
||||
])
|
||||
self.assertEqual([dict(code=301, src='mitaka', ref_type='tag',
|
||||
dst='mitaka-eol')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_all(self):
|
||||
deliverables = FakeDeliverables([
|
||||
@ -178,9 +246,11 @@ class TestRedirections(base.BaseTestCase):
|
||||
dst='stable/rocky'),
|
||||
dict(code=301, src='mitaka', ref_type='tag',
|
||||
dst='mitaka-eol')],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
||||
def test_empty(self):
|
||||
deliverables = FakeDeliverables([])
|
||||
self.assertEqual([],
|
||||
generate_constraints_redirections(deliverables))
|
||||
generate_constraints_redirections(
|
||||
deliverables, self.SERIES_STATUS_DATA))
|
||||
|
Loading…
Reference in New Issue
Block a user