diff --git a/release-tools/testing/README.md b/release-tools/testing/README.md index 0a1fbf8551..0f859967f6 100644 --- a/release-tools/testing/README.md +++ b/release-tools/testing/README.md @@ -34,7 +34,7 @@ To create a new release version in JIRA, you can run the following command: $ ./test-manager create-version ``` -Note that `` is optional. This command will create new versions in the following JIRA projects: `CORDA`, `ENT`, `ENM`, `CID` and `R3T`. +Note that `` is optional and can either be a short integer representing a release candidate, or an eight digit date (on the format YYYYMMDD) for a release snapshot. This command will create new versions in the following JIRA projects: `CORDA`, `ENT`, `ENM`, `CID` and `R3T`. ## Create Release Tests diff --git a/release-tools/testing/jira_manager.py b/release-tools/testing/jira_manager.py index 5f9e66fa60..a7f5b258cd 100644 --- a/release-tools/testing/jira_manager.py +++ b/release-tools/testing/jira_manager.py @@ -74,6 +74,7 @@ class Jira: if dry_run: return Issue(self, fields=fields) try: + fields['labels'] = filter(lambda x: x is not None, fields['labels']) issue = self.jira.create_issue(fields) return Issue(self, issue=issue) except JIRAError as error: diff --git a/release-tools/testing/test-manager b/release-tools/testing/test-manager index bfea84eb68..f0471bbb1b 100755 --- a/release-tools/testing/test-manager +++ b/release-tools/testing/test-manager @@ -75,15 +75,23 @@ def list_test_cases(args): print() # }}} +# {{{ format_candidate() - Format a candidate number +def format_candidate(candidate): + if candidate > 100: + return '({})'.format(candidate) + else: + return 'RC{:02d}'.format(candidate) +# }}} + # {{{ show_status() - Show the status of all test runs for a specific release or release candidate def show_status(args): user, password = login('jira', args.user) if not user or not password: sys.exit(1) jira = Jira().login(user, password) version = '{} {}'.format(product_map[args.PRODUCT], args.VERSION).replace('.0', '') - candidate = '{} RC{:02d}'.format(version, args.CANDIDATE) if args.CANDIDATE else version + candidate = '{} {}'.format(version, format_candidate(args.CANDIDATE)) if args.CANDIDATE else version if args.CANDIDATE: - print(u'Status of test runs for {} version {} release candidate {}:'.format(yellow(product_map[args.PRODUCT]), yellow(args.VERSION), yellow('RC{:02d}'.format(args.CANDIDATE)))) + print(u'Status of test runs for {} version {} release candidate {}:'.format(yellow(product_map[args.PRODUCT]), yellow(args.VERSION), yellow(format_candidate(args.CANDIDATE)))) else: print(u'Status of test runs for {} version {}:'.format(yellow(product_map[args.PRODUCT]), yellow(args.VERSION))) if args.verbose: @@ -141,7 +149,7 @@ def create_version(args): if not user or not password: sys.exit(1) jira = Jira().login(user, password) version = '{} {}'.format(product_map[args.PRODUCT], args.VERSION).replace('.0', '') - version = '{} RC{:02d}'.format(version, args.CANDIDATE) if args.CANDIDATE else version + version = '{} {}'.format(version, format_candidate(args.CANDIDATE)) if args.CANDIDATE else version confirm(u'Create new version {}?'.format(yellow(version)), auto_yes=args.yes or args.dry_run) print() if not args.dry_run: @@ -229,8 +237,8 @@ def create_release_candidate(args): jira = Jira().login(user, password) version = '{} {}'.format(product_map[args.PRODUCT], args.VERSION).replace('.0', '') CANDIDATE = args.CANDIDATE[0] - candidate = '{} RC{:02d}'.format(version, CANDIDATE) - confirm(u'Create test run tickets for {} version {} release candidate {}?'.format(yellow(product_map[args.PRODUCT]), yellow(args.VERSION), yellow('RC{:02d}'.format(CANDIDATE))), auto_yes=args.yes or args.dry_run) + candidate = '{} {}'.format(version, format_candidate(CANDIDATE)) + confirm(u'Create test run tickets for {} version {} release candidate {}?'.format(yellow(product_map[args.PRODUCT]), yellow(args.VERSION), yellow(format_candidate(CANDIDATE))), auto_yes=args.yes or args.dry_run) if args.verbose: print(faint('[{}]'.format(QUERY_LIST_TEST_INSTANCES.format(args.PRODUCT, version)))) print() @@ -247,7 +255,7 @@ def create_release_candidate(args): continue print() has_tests = True - print(u' - Creating test run ticket for release candidate {} ...'.format(yellow('RC{:02d}'.format(CANDIDATE)))) + print(u' - Creating test run ticket for release candidate {} ...'.format(yellow(format_candidate(CANDIDATE)))) if args.verbose: print(faint(u' [{}]'.format(QUERY_LIST_TEST_RUN_FOR_TICKET.format(args.PRODUCT, candidate, issue.key)))) has_test_instance_for_version = len(list(jira.search(QUERY_LIST_TEST_RUN_FOR_TICKET.format(args.PRODUCT, candidate, issue.key)))) @@ -291,7 +299,7 @@ def main(): nargs = '?' else: nargs = 1 - command.add('CANDIDATE', help='the number of the release candidate, e.g., 1 for RC01', type=int, nargs=nargs) + command.add('CANDIDATE', help='the number of the release candidate, e.g., 1 for RC01, or an 8 digit date in the format YYYYMMDD for snapshot releases', type=int, nargs=nargs) with program.command('list-tests', 'list test cases applicable to the provided specification', list_test_cases) as command: mixin_product(command)