Add the branch to the release metadata

In [1] we saw that releases on antelope are proposed as constraint
updates on master.  This is another case where series != release-id.
Add meta:branch to the release metadata and use that when updating
constraints

[1] https://review.opendev.org/q/I369b2140ff3203d069530dcbabffb79cd29d859b

Change-Id: Ic4ea185d54a7e82bcb9fae3c1291a4c3bb456f22
This commit is contained in:
Tony Breeds 2023-06-15 13:17:02 -07:00
parent a952de8752
commit 9522729809
3 changed files with 21 additions and 6 deletions

View File

@ -61,13 +61,13 @@ def find_modified_deliverable_files(reporoot):
def tag_release(repo, series_name, version, diff_start, hash,
include_pypi_link, first_full_release, meta_data):
include_pypi_link, first_full_release, meta_data, branch_name):
print('Tagging {} in {}'.format(version, repo))
try:
subprocess.check_call(
[RELEASE_SCRIPT, repo, series_name, version,
diff_start, hash, include_pypi_link,
first_full_release, meta_data]
first_full_release, meta_data, branch_name]
)
except subprocess.CalledProcessError:
# The error output from the script will be printed to
@ -106,6 +106,17 @@ def load_series_status(reporoot):
return series_status
def get_branch(series_status, series_name):
branch = None
for series in series_status:
if series.get("status") == "development":
branch = "master"
elif series.get("name") == series_name:
# Grab the release-id; then fall back to the supplied name
branch = "stable/" + series.get("release-id", series_name)
return branch
def process_release_requests(reporoot, filenames, meta_data):
"""Return a sequence of tuples containing the new versions.
@ -147,6 +158,8 @@ def process_release_requests(reporoot, filenames, meta_data):
os.path.dirname(os.path.abspath(filename))
).lstrip('_')
branch_name = get_branch(series_status, series_name)
# If the series is closed, do not process the file. We're
# likely updating old data in the releases repo and we do not
# want to reprocess any old branches or tags.
@ -204,7 +217,7 @@ def process_release_requests(reporoot, filenames, meta_data):
error_count += tag_release(
project['repo'], series_name, version,
diff_start, project['hash'], include_pypi_link,
first_full_release, meta_data,
first_full_release, meta_data, branch_name,
)
# Create branches and adapt master

View File

@ -42,6 +42,7 @@ SHA=$5
INCLUDE_PYPI=${6:-no}
FIRST_FULL=${7:-no}
EXTRA_METADATA="$8"
BRANCH="${9:-master}"
SHORTNAME=`basename $REPO`
@ -77,6 +78,7 @@ else
meta:version: $VERSION
meta:diff-start: $DIFF_START
meta:series: $SERIES
meta:branch: $BRANCH
meta:release-type: $RELEASETYPE
meta:pypi: $INCLUDE_PYPI
meta:first: $FIRST_FULL

View File

@ -68,8 +68,8 @@ function get_tag_meta {
echo "$TAG_META" | grep "^meta:$fieldname:" | cut -f2 -d' '
}
# Find the series information from the tag metadata in the comment.
SERIES=$(get_tag_meta series)
# Find the branch information from the tag metadata in the comment.
BRANCH=$(get_tag_meta branch)
# Pick up the repository name from the git URL.
SHORTNAME=$(basename $(git config --local remote.origin.url))
@ -105,7 +105,7 @@ else
setup_temp_space update-constraints-$SHORTNAME
# NOTE(dhellmann): clone_repo defaults to checking out master if
# the named branch doesn't exist.
clone_repo openstack/requirements stable/$SERIES
clone_repo openstack/requirements $BRANCH
cd openstack/requirements
git checkout -b "$dist_name-$VERSION"
# First try to update specific python_version entries