diff --git a/doc/source/_templates/htaccess b/doc/source/_templates/htaccess index 573ce5ef2e..d0ebafc75a 100644 --- a/doc/source/_templates/htaccess +++ b/doc/source/_templates/htaccess @@ -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 %} diff --git a/doc/source/_templates/redirect-tests b/doc/source/_templates/redirect-tests index f7203cc4a8..65901ab274 100644 --- a/doc/source/_templates/redirect-tests +++ b/doc/source/_templates/redirect-tests @@ -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 %} diff --git a/openstack_releases/_redirections.py b/openstack_releases/_redirections.py index a58ad86e5c..a94d4c8cbb 100644 --- a/openstack_releases/_redirections.py +++ b/openstack_releases/_redirections.py @@ -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 diff --git a/openstack_releases/tests/test_redirections.py b/openstack_releases/tests/test_redirections.py index 8a4613a149..b778100e46 100644 --- a/openstack_releases/tests/test_redirections.py +++ b/openstack_releases/tests/test_redirections.py @@ -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):