Fix propose-final-releases command 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 the propose-final-releases command as
it still uses the release name. This patch fixes this by reading the
'release-id' field from series_status.yaml and if present then uses it
as stable/<release-id> for the branch creation.

[1] https://governance.openstack.org/tc/reference/release-naming.html

Change-Id: Ie8ba3e9bfa01148e93f5920050703e998248db11
This commit is contained in:
Hervé Beraud 2023-03-17 16:50:38 +01:00
parent 06e3ca86bc
commit 14484c5055
1 changed files with 16 additions and 1 deletions

View File

@ -24,11 +24,26 @@ import tempfile
import openstack_releases
from openstack_releases import deliverable
from openstack_releases import gitutils
from openstack_releases import series_status
from openstack_releases import yamlutils
PRE_RELEASE = re.compile('(a|b|rc)')
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 get_prior_branch_point(workdir, repo, branch):
"""Return the tag of the base of the branch.
@ -180,7 +195,7 @@ def main():
(latest_release.version.split('.')[:-1] + ['0'])[:3]
)
branch = 'stable/{}'.format(args.prior_series)
branch = 'stable/{}'.format(get_stable_branch_id(args.prior_series))
diff_start = get_prior_branch_point(
workdir, projects[0].repo.name, branch,
)