Add intermediate-branch arg to new-release script
This allows the projects with a cycle-with-intermediary release model to be able to automatically generate the yaml file with the correct new branch. Change-Id: I003e5d3d39cbb8961822b3fd2a384bf3c9f66f5e
This commit is contained in:
parent
b52cec8504
commit
e53454c494
@ -216,6 +216,14 @@ def main():
|
||||
action='store_true',
|
||||
help='create a new stable branch from the release',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--intermediate-branch',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='create a new intermediate branch with the form bugfix/n.n; '
|
||||
'this is usually needed only by projects with a '
|
||||
'cycle-with-intermediary release model'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Set up logging, including making some loggers quiet.
|
||||
@ -283,6 +291,8 @@ def main():
|
||||
|
||||
add_stable_branch = args.stable_branch or is_procedural
|
||||
|
||||
add_intermediate_branch = args.intermediate_branch
|
||||
|
||||
# Validate new tag can be applied
|
||||
if last_version and 'eol' in last_version[0]:
|
||||
raise ValueError('Cannot create new release after EOL tagging.')
|
||||
@ -539,6 +549,26 @@ def main():
|
||||
'location': new_version,
|
||||
})
|
||||
|
||||
if add_intermediate_branch:
|
||||
new_branch = new_version.rsplit('.', 1)[0]
|
||||
branch_name = 'bugfix/{}'.format(new_branch)
|
||||
|
||||
# First check if this branch is already defined
|
||||
if 'branches' in deliverable_info:
|
||||
for branch in deliverable_info['branches']:
|
||||
if branch.get('name') == branch_name:
|
||||
LOG.debug('Branch %s already exists, skipping',
|
||||
branch_name)
|
||||
add_intermediate_branch = False
|
||||
break
|
||||
|
||||
if add_intermediate_branch:
|
||||
LOG.info('adding intermediate branch at %s', new_version)
|
||||
deliverable_info.setdefault('branches', []).append({
|
||||
'name': branch_name,
|
||||
'location': new_version,
|
||||
})
|
||||
|
||||
create_release = changes > 0
|
||||
if create_release and args.interactive:
|
||||
create_release = yes_no_prompt(
|
||||
|
Loading…
x
Reference in New Issue
Block a user