2b8ee3aaec
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
57 lines
2.0 KiB
Python
57 lines
2.0 KiB
Python
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from sphinx.util import logging
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
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'):
|
|
# Any open deliverables should point to master
|
|
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' % (release_id):
|
|
target = branch.name
|
|
break
|
|
|
|
# Or we have a ${series}-eol tag
|
|
for release in deliv.releases:
|
|
if release.is_eol:
|
|
target = str(release.version)
|
|
ref_type = 'tag'
|
|
break
|
|
|
|
# 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=release_id,
|
|
ref_type=ref_type, dst=target))
|
|
|
|
for series in future_releases:
|
|
redirections.insert(0, dict(code=302, src=series,
|
|
ref_type='branch', dst='master'))
|
|
|
|
return redirections
|