diff --git a/openstack_releases/cmds/edit_deliverable.py b/openstack_releases/cmds/edit_deliverable.py index b7d3813ecf..7db3dfe4fe 100644 --- a/openstack_releases/cmds/edit_deliverable.py +++ b/openstack_releases/cmds/edit_deliverable.py @@ -15,7 +15,11 @@ from __future__ import print_function import argparse +import atexit +import shutil +import tempfile +from openstack_releases import gitutils from openstack_releases import yamlutils @@ -35,6 +39,37 @@ def stable_branch(args, series, deliverable_info): deliverable_info.setdefault('branches', []).append(new_branch) +def eol_tag(args, series, deliverable_info): + + workdir = tempfile.mkdtemp(prefix='releases-') + print('creating temporary files in %s' % workdir) + + def cleanup_workdir(): + shutil.rmtree(workdir, True) + atexit.register(cleanup_workdir) + + tag = '{}-eol'.format(series) + projects = [] + release = { + 'version': tag, + 'projects': projects, + } + + for repo in deliverable_info['repository-settings'].keys(): + if not gitutils.tag_exists(repo, tag): + print('No {} tag for {}'.format(tag, repo)) + continue + gitutils.clone_repo(workdir, repo) + sha = gitutils.sha_for_tag(workdir, repo, tag) + projects.append({ + 'repo': repo, + 'hash': sha, + }) + + if projects: + deliverable_info['releases'].append(release) + + def get_deliverable_data(series, deliverable): deliverable_filename = 'deliverables/%s/%s.yaml' % ( series, deliverable) @@ -74,6 +109,12 @@ def main(): ) stable_branch_parser.set_defaults(func=stable_branch) + eol_tag_parser = subparsers.add_parser( + 'import-eol-tag', + help='find the series EOL tag and add it', + ) + eol_tag_parser.set_defaults(func=eol_tag) + args = parser.parse_args() # Allow for independent projects.