Merge "Switch constraints files over to the new opendev infrastructure"

This commit is contained in:
Zuul 2019-05-28 15:09:19 +00:00 committed by Gerrit Code Review
commit e730389605
4 changed files with 28 additions and 15 deletions

View File

@ -1,6 +1,6 @@
redirect 301 /teams/shade.html /teams/openstacksdk.html
redirect 301 /constraints/upper/master http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
redirect 301 /constraints/upper/master https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt
{%- for redirection in redirections %}
redirect {{ redirection.code }} /constraints/upper/{{ redirection.src }} http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h={{ redirection.dst }}
redirect {{ redirection.code }} /constraints/upper/{{ redirection.src }} https://opendev.org/openstack/requirements/raw/{{ redirection.ref_type }}/{{ redirection.dst }}/upper-constraints.txt
{%- endfor %}

View File

@ -1,5 +1,5 @@
/teams/shade.html 301 /teams/openstacksdk.html
/constraints/upper/master 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
/constraints/upper/master 301 https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt
{%- for redirection in redirections %}
/constraints/upper/{{ redirection.src }} {{ redirection.code }} http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h={{ redirection.dst }}
/constraints/upper/{{ redirection.src }} {{ redirection.code }} https://opendev.org/openstack/requirements/raw/{{ redirection.ref_type }}/{{ redirection.dst }}/upper-constraints.txt
{%- endfor %}

View File

@ -24,6 +24,7 @@ def generate_constraints_redirections(_deliverables, future_releases=[]):
for deliv in _deliverables.get_deliverable_history('requirements'):
# Any open deliverables should point to master
target = 'master'
ref_type = 'branch'
# Unless there is a specific stable branch
for branch in deliv.branches:
@ -35,13 +36,16 @@ def generate_constraints_redirections(_deliverables, future_releases=[]):
for release in deliv.releases:
if release.is_eol:
target = str(release.version)
ref_type = 'tag'
break
# Insert into the begining of the list so that redirections are
# master -> juno
redirections.insert(0, dict(code=301, src=deliv.series, dst=target))
redirections.insert(0, dict(code=301, src=deliv.series,
ref_type=ref_type, dst=target))
for series in future_releases:
redirections.insert(0, dict(code=302, src=series, dst='master'))
redirections.insert(0, dict(code=302, src=series,
ref_type='branch', dst='master'))
return redirections

View File

@ -122,42 +122,48 @@ class TestRedirections(base.BaseTestCase):
deliverables = FakeDeliverables([
self.OPEN_DEVELOPMENT,
])
self.assertEqual([dict(code=301, src='stein', dst='master')],
self.assertEqual([dict(code=301, src='stein', ref_type='branch',
dst='master')],
generate_constraints_redirections(deliverables))
def test_development_release(self):
deliverables = FakeDeliverables([
self.DEVELOPMENT_RELEASE,
])
self.assertEqual([dict(code=301, src='stein', dst='master')],
self.assertEqual([dict(code=301, src='stein', ref_type='branch',
dst='master')],
generate_constraints_redirections(deliverables))
def test_open_stable(self):
deliverables = FakeDeliverables([
self.OPEN_STABLE,
])
self.assertEqual([dict(code=301, src='rocky', dst='stable/rocky')],
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
dst='stable/rocky')],
generate_constraints_redirections(deliverables))
def test_open_unstable(self):
deliverables = FakeDeliverables([
self.OPEN_UNSTABLE,
])
self.assertEqual([dict(code=301, src='rocky', dst='stable/rocky')],
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
dst='stable/rocky')],
generate_constraints_redirections(deliverables))
def test_stable_release(self):
deliverables = FakeDeliverables([
self.STABLE_RELEASE,
])
self.assertEqual([dict(code=301, src='rocky', dst='stable/rocky')],
self.assertEqual([dict(code=301, src='rocky', ref_type='branch',
dst='stable/rocky')],
generate_constraints_redirections(deliverables))
def test_stable_eol(self):
deliverables = FakeDeliverables([
self.STABLE_EOL,
])
self.assertEqual([dict(code=301, src='mitaka', dst='mitaka-eol')],
self.assertEqual([dict(code=301, src='mitaka', ref_type='tag',
dst='mitaka-eol')],
generate_constraints_redirections(deliverables))
def test_all(self):
@ -166,9 +172,12 @@ class TestRedirections(base.BaseTestCase):
self.STABLE_RELEASE,
self.DEVELOPMENT_RELEASE,
])
self.assertEqual([dict(code=301, src='stein', dst='master'),
dict(code=301, src='rocky', dst='stable/rocky'),
dict(code=301, src='mitaka', dst='mitaka-eol')],
self.assertEqual([dict(code=301, src='stein', ref_type='branch',
dst='master'),
dict(code=301, src='rocky', ref_type='branch',
dst='stable/rocky'),
dict(code=301, src='mitaka', ref_type='tag',
dst='mitaka-eol')],
generate_constraints_redirections(deliverables))
def test_empty(self):