Test bugfix branching with release-test

This does a new release with release-test to see if everything is
covered to allow branches to have a bugfix/* prefix.

Change-Id: I7869cf412524d7352249f02f7449b2fddf401d2c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-06-29 14:12:08 -05:00
parent 99afb5fd30
commit d593479b0b
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
4 changed files with 33 additions and 14 deletions

View File

@ -25,6 +25,10 @@ releases:
projects:
- repo: openstack/release-test
hash: 371d36be8f6c72900fd99fcba3b4e1aad0c8eb4e
- version: 3.2.0
projects:
- repo: openstack/release-test
hash: 371d36be8f6c72900fd99fcba3b4e1aad0c8eb4e
branches:
- name: stable/3.1
location: 3.1.0
- name: bugfix/3.2
location: 3.2.0

View File

@ -415,7 +415,7 @@ The top level of a deliverable file is a mapping with keys:
addition that version-based branches can be created as well.
These version-based branches are shorter term stable branches that
are named for the major and minor version number (e.g. stable/3.1).
are named for the major and minor version number (e.g. bugfix/3.1).
This is primarily used for Ironic releases.
``tagless``

View File

@ -79,6 +79,7 @@ _USES_PREVER = set([
_VALID_BRANCH_PREFIXES = set([
'stable',
'feature',
'bugfix',
])
_NO_STABLE_BRANCH_CHECK = set([
@ -1505,8 +1506,8 @@ def validate_stable_branches(deliv, context):
('stable branch name expected to be stable/name '
'but got %s') % (branch.name,))
continue
if prefix != 'stable':
print('{} is not a stable branch, skipping'.format(
if prefix != 'stable' and prefix != 'bugfix':
print('{} is not a stable or bugfix branch, skipping'.format(
branch.name))
continue
@ -1529,9 +1530,10 @@ def validate_stable_branches(deliv, context):
)
return
branch_exists = all(
gitutils.stable_branch_exists(
gitutils.branch_exists(
context.workdir,
repo,
prefix,
series,
)
for repo in deliv.known_repo_names if
@ -1542,9 +1544,10 @@ def validate_stable_branches(deliv, context):
branch.name))
continue
if deliv.is_independent:
if deliv.is_independent or prefix == 'bugfix':
print('"latest release" rule does not apply '
'to independent repositories, skipping')
'to independent repositories or bugfix '
'branches, skipping')
else:
latest_release = deliv.releases[-1]
if location != latest_release.version:
@ -1614,15 +1617,15 @@ def validate_stable_branches(deliv, context):
else:
if series != deliv.series:
if branch_mode == 'std-with-versions':
# Not a normal stable branch, so it must be a version
# branch (stable/3.1)
# Not a normal stable branch, so it must be a versioned
# bugfix branch (bugfix/3.1)
expected_version = '.'.join(location.split('.')[0:2])
if series != expected_version:
context.error(
'cycle-based projects must match series names '
'for stable branches, or branch based on version '
'for short term support. %s should be stable/%s '
'or stable/%s' % (
'or bugfix/%s' % (
branch.name, deliv.series, expected_version))
else:
context.error(

View File

@ -204,9 +204,16 @@ def _filter_branches(output):
]
def stable_branch_exists(workdir, repo, series):
"Does the stable/series branch exist?"
remote_match = 'remotes/origin/stable/%s' % series
def branch_exists(workdir, repo, prefix, identifier):
"""Does the prefix/identifier branch exist.
Checks if a named branch already exists.
:param workdir: The working directory for the local clone.
:param repo: The name of the repo.
:param prefix: The branch prefix (e.g. "stable" or "bugfix").
:param idenifier: The branch identifier (series name or version).
"""
remote_match = 'remotes/origin/{}/{}'.format(prefix, identifier)
try:
containing_branches = _filter_branches(
processutils.check_output(
@ -222,6 +229,11 @@ def stable_branch_exists(workdir, repo, series):
return False
def stable_branch_exists(workdir, repo, series):
"Does the stable/series branch exist?"
return branch_exists(workdir, repo, 'stable', series)
def check_branch_sha(workdir, repo, series, sha):
"""Check if the SHA is in the targeted branch.