add import-eol-tag subcommand to edit-deliverable

Add a subcommand to look for an eol tag for a deliverable and update
the deliverable data file.

Change-Id: I8e75418a218d0f24ebb76b1302939d20240d41f2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-06-15 09:34:39 -04:00
parent bc60ae345f
commit e7cf7f6681

View File

@ -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.